Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1124)

Unified Diff: chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.cc

Issue 985093002: Fix up Owner settings on first load (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: based off mattias' patch that injects CrosSettings for testing Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.cc
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.cc b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.cc
index 3abecb5a11f3006fbf3d48d6c89a7f2292a69fb6..dfbd9d41618f309f53c7d092d54a38761ac54c59 100644
--- a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.cc
+++ b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.cc
@@ -7,6 +7,7 @@
#include "base/path_service.h"
#include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
+#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chromeos/chromeos_paths.h"
@@ -19,6 +20,7 @@ namespace chromeos {
namespace {
DeviceSettingsService* g_device_settings_service_for_testing_ = nullptr;
+CrosSettings* g_cros_settings_for_testing = nullptr;
DeviceSettingsService* GetDeviceSettingsService() {
if (g_device_settings_service_for_testing_)
@@ -27,6 +29,12 @@ DeviceSettingsService* GetDeviceSettingsService() {
: nullptr;
}
+CrosSettings* GetCrosSettings() {
+ if (g_cros_settings_for_testing)
+ return g_cros_settings_for_testing;
+ return CrosSettings::IsInitialized() ? CrosSettings::Get() : nullptr;
+}
+
} // namespace
OwnerSettingsServiceChromeOSFactory::OwnerSettingsServiceChromeOSFactory()
@@ -58,6 +66,12 @@ void OwnerSettingsServiceChromeOSFactory::SetDeviceSettingsServiceForTesting(
g_device_settings_service_for_testing_ = device_settings_service;
}
+// static
+void OwnerSettingsServiceChromeOSFactory::SetCrosSettingsForTesting(
+ CrosSettings* cros_settings) {
+ g_cros_settings_for_testing = cros_settings;
+}
+
scoped_refptr<ownership::OwnerKeyUtil>
OwnerSettingsServiceChromeOSFactory::GetOwnerKeyUtil() {
if (owner_key_util_.get())
@@ -82,6 +96,7 @@ KeyedService* OwnerSettingsServiceChromeOSFactory::BuildInstanceFor(
return NULL;
return new OwnerSettingsServiceChromeOS(
GetDeviceSettingsService(),
+ GetCrosSettings(),
profile,
GetInstance()->GetOwnerKeyUtil());
}

Powered by Google App Engine
This is Rietveld 408576698