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

Unified Diff: chrome/browser/policy/browser_policy_connector.cc

Issue 10829235: Revert r150536 - "Added a timezone policy and pyauto tests for it." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.h ('k') | chrome/browser/policy/device_policy_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/browser_policy_connector.cc
diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc
index 9d35b22369ac2a8dc3ae37e1086def0672308d07..552de44eb74d1a5fe0d766259fdaf9a6be25e22a 100644
--- a/chrome/browser/policy/browser_policy_connector.cc
+++ b/chrome/browser/policy/browser_policy_connector.cc
@@ -46,13 +46,10 @@
#endif
#if defined(OS_CHROMEOS)
-#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/login/authenticator.h"
#include "chrome/browser/chromeos/login/user_manager.h"
-#include "chrome/browser/chromeos/settings/cros_settings.h"
-#include "chrome/browser/chromeos/settings/cros_settings_provider.h"
#include "chrome/browser/chromeos/system/statistics_provider.h"
-#include "chrome/browser/chromeos/system/timezone_settings.h"
#include "chrome/browser/policy/app_pack_updater.h"
#include "chrome/browser/policy/cros_user_policy_cache.h"
#include "chrome/browser/policy/device_policy_cache.h"
@@ -152,14 +149,17 @@ void BrowserPolicyConnector::Init() {
InitializeDevicePolicy();
- // Skip the final initialization if this is a unit test.
- if (MessageLoop::current()) {
- // Complete the initialization once the message loops are spinning.
- MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&BrowserPolicyConnector::CompleteInitialization,
- weak_ptr_factory_.GetWeakPtr()));
- }
+ // Don't bother updating the cache if this is a unit test.
+ if (!MessageLoop::current())
+ return;
+
+ // Create the AppPackUpdater to start updating the cache. It requires the
+ // system request context, which isn't available yet; therefore it is
+ // created only once the loops are running.
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(base::IgnoreResult(&BrowserPolicyConnector::GetAppPackUpdater),
+ weak_ptr_factory_.GetWeakPtr()));
#endif
}
@@ -545,6 +545,16 @@ void BrowserPolicyConnector::InitializeDevicePolicy() {
device_data_store_.get(),
device_policy_cache,
GetDeviceManagementUrl()));
+
+ // Skip the final initialization if this is a unit test.
+ if (!MessageLoop::current())
+ return;
+
+ // Initialize the subsystem once the message loops are spinning.
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&BrowserPolicyConnector::CompleteInitialization,
+ weak_ptr_factory_.GetWeakPtr()));
}
}
#endif
@@ -552,12 +562,6 @@ void BrowserPolicyConnector::InitializeDevicePolicy() {
void BrowserPolicyConnector::CompleteInitialization() {
#if defined(OS_CHROMEOS)
-
- // Create the AppPackUpdater to start updating the cache. It requires the
- // system request context, which isn't available in Init(); therefore it is
- // created only once the loops are running.
- GetAppPackUpdater();
-
if (device_cloud_policy_subsystem_.get()) {
// Read serial number and machine model. This must be done before we call
// CompleteInitialization() below such that the serial number is available
@@ -590,28 +594,6 @@ void BrowserPolicyConnector::CompleteInitialization() {
g_browser_process->local_state(),
chromeos::system::StatisticsProvider::GetInstance(),
NULL));
-
- SetTimezoneIfPolicyAvailable();
-#endif
-}
-
-void BrowserPolicyConnector::SetTimezoneIfPolicyAvailable() {
-#if defined(OS_CHROMEOS)
- typedef chromeos::CrosSettingsProvider Provider;
- Provider::TrustedStatus result =
- chromeos::CrosSettings::Get()->PrepareTrustedValues(
- base::Bind(&BrowserPolicyConnector::SetTimezoneIfPolicyAvailable,
- weak_ptr_factory_.GetWeakPtr()));
-
- if (result != Provider::TRUSTED)
- return;
-
- std::string timezone;
- if (chromeos::CrosSettings::Get()->GetString(
- chromeos::kSystemTimezonePolicy, &timezone)) {
- chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID(
- UTF8ToUTF16(timezone));
- }
#endif
}
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.h ('k') | chrome/browser/policy/device_policy_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698