ThOS fixes

This commit is contained in:
Alexander Frick 2024-02-06 19:40:20 -06:00
parent 183116ef06
commit b2167ef1c3
4 changed files with 125 additions and 5 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,41 @@
# Copyright 2024 The Chromium Authors and Alex313031
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//chrome/test/base/ash/js2gtest.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
assert(is_chromeos_ash, "Sample System Web App is ash-chrome only")
static_library("sample_system_web_app_ui") {
sources = [
"sample_page_handler.cc",
"sample_page_handler.h",
"sample_system_web_app_ui.cc",
"sample_system_web_app_ui.h",
"sample_system_web_app_untrusted_ui.cc",
"sample_system_web_app_untrusted_ui.h",
"url_constants.cc",
"url_constants.h",
]
deps = [
"//ash/webui/resources:sample_system_web_app_resources",
"//ash/webui/resources:sample_system_web_app_untrusted_resources",
"//ash/webui/sample_system_web_app_ui/mojom:trusted",
"//ash/webui/sample_system_web_app_ui/mojom:untrusted",
"//ash/webui/system_apps/public:system_web_app_config",
"//content/public/browser",
"//ui/webui",
]
}
js2gtest("browser_tests_js") {
test_type = "mojo_lite_webui"
sources = [ "test/sample_system_web_app_ui_browsertest.js" ]
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
}

View file

@ -0,0 +1,80 @@
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ash/settings/stats_reporting_controller.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "chrome/browser/ash/settings/cros_settings.h"
#include "chromeos/ash/components/settings/cros_settings_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
namespace {
constexpr char kPendingPref[] = "pending.cros.metrics.reportingEnabled";
} // namespace
namespace ash {
static StatsReportingController* g_stats_reporting_controller = nullptr;
// static
void StatsReportingController::Initialize(PrefService* local_state) {
CHECK(!g_stats_reporting_controller);
g_stats_reporting_controller = new StatsReportingController(local_state);
}
// static
bool StatsReportingController::IsInitialized() {
return g_stats_reporting_controller;
}
// static
void StatsReportingController::Shutdown() {
DCHECK(g_stats_reporting_controller);
delete g_stats_reporting_controller;
g_stats_reporting_controller = nullptr;
}
// static
StatsReportingController* StatsReportingController::Get() {
CHECK(g_stats_reporting_controller);
return g_stats_reporting_controller;
}
// static
void StatsReportingController::RegisterLocalStatePrefs(
PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(kPendingPref, false,
PrefRegistry::NO_REGISTRATION_FLAGS);
}
void StatsReportingController::SetEnabled(Profile* profile, bool enabled) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
Set(profile, base::Value(enabled));
}
bool StatsReportingController::IsEnabled() const {
// Disable Telemetry in ThoriumOS
return false;
}
StatsReportingController::StatsReportingController(PrefService* local_state)
: OwnerPendingSettingController(kStatsReportingPref,
kPendingPref,
local_state) {
setting_subscription_ = CrosSettings::Get()->AddSettingsObserver(
kStatsReportingPref,
base::BindRepeating(&StatsReportingController::NotifyObservers,
this->as_weak_ptr()));
}
StatsReportingController::~StatsReportingController() {
owner_settings_service_observation_.Reset();
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
} // namespace ash

View file

@ -1175,7 +1175,7 @@ bool TabStrip::ShouldDrawStrokes() const {
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (chromeos::features::IsJellyrollEnabled()) {
return false;
return true;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)