Chromium Code Reviews| Index: chrome/browser/ui/webui/options/browser_options_handler.cc |
| diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc |
| index bc111f0bc31534ee5d939fa921c45a85838ab2d8..02acb397ea9c6a62f0c9d64d4ec0babaac5731b4 100644 |
| --- a/chrome/browser/ui/webui/options/browser_options_handler.cc |
| +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc |
| @@ -103,6 +103,7 @@ |
| #include "ash/desktop_background/user_wallpaper_delegate.h" |
| #include "ash/magnifier/magnifier_constants.h" |
| #include "ash/shell.h" |
| +#include "chrome/browser/browser_process_platform_part.h" |
| #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| #include "chrome/browser/chromeos/chromeos_utils.h" |
| #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| @@ -110,7 +111,6 @@ |
| #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| #include "chrome/browser/chromeos/reset/metrics.h" |
| #include "chrome/browser/chromeos/settings/cros_settings.h" |
| -#include "chrome/browser/chromeos/settings/device_settings_service.h" |
| #include "chrome/browser/chromeos/system/timezone_util.h" |
| #include "chrome/browser/policy/profile_policy_connector.h" |
| #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| @@ -123,7 +123,6 @@ |
| #include "components/user_manager/user.h" |
| #include "components/user_manager/user_manager.h" |
| #include "policy/policy_constants.h" |
| -#include "policy/proto/device_management_backend.pb.h" |
| #include "ui/gfx/image/image_skia.h" |
| #endif // defined(OS_CHROMEOS) |
| @@ -409,8 +408,12 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) { |
| IDS_OPTIONS_CONSUMER_MANAGEMENT_DESCRIPTION }, |
| { "consumerManagementEnrollButton", |
| IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLL_BUTTON }, |
| + { "consumerManagementEnrollingButton", |
| + IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLLING_BUTTON }, |
| { "consumerManagementUnenrollButton", |
| IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLL_BUTTON }, |
| + { "consumerManagementUnenrollingButton", |
| + IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLLING_BUTTON }, |
| { "deviceControlTitle", IDS_OPTIONS_DEVICE_CONTROL_SECTION_TITLE }, |
| { "enableContentProtectionAttestation", |
| IDS_OPTIONS_ENABLE_CONTENT_PROTECTION_ATTESTATION }, |
| @@ -631,14 +634,6 @@ void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) { |
| CommandLine::ForCurrentProcess()->HasSwitch( |
| chromeos::switches::kEnableConsumerManagement)); |
| - const enterprise_management::PolicyData* policy_data = |
| - chromeos::DeviceSettingsService::Get()->policy_data(); |
| - values->SetBoolean( |
| - "consumerManagementEnrolled", |
| - policy_data && |
| - policy_data->management_mode() == |
| - enterprise_management::PolicyData::CONSUMER_MANAGED); |
| - |
| RegisterTitle(values, "thirdPartyImeConfirmOverlay", |
| IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE); |
| #endif |
| @@ -772,6 +767,10 @@ void BrowserOptionsHandler::Uninitialize() { |
| #if defined(OS_WIN) |
| ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->RemoveObserver(this); |
| #endif |
| +#if defined(OS_CHROMEOS) |
| + g_browser_process->platform_part()->browser_policy_connector_chromeos()-> |
| + GetConsumerManagementService()->RemoveObserver(this); |
| +#endif |
| } |
| void BrowserOptionsHandler::OnStateChanged() { |
| @@ -952,6 +951,12 @@ void BrowserOptionsHandler::InitializePage() { |
| OnWallpaperManagedChanged( |
| chromeos::WallpaperManager::Get()->IsPolicyControlled( |
| user_manager::UserManager::Get()->GetActiveUser()->email())); |
| + |
| + policy::ConsumerManagementService* consumer_management_service = |
| + g_browser_process->platform_part()->browser_policy_connector_chromeos()-> |
| + GetConsumerManagementService(); |
| + OnConsumerManagementStatusChanged(consumer_management_service->GetStatus()); |
| + consumer_management_service->AddObserver(this); |
| #endif |
| } |
| @@ -1459,6 +1464,14 @@ void BrowserOptionsHandler::OnPowerwashDialogShow( |
| chromeos::reset::DIALOG_VIEW_TYPE_SIZE); |
| } |
| +void BrowserOptionsHandler::OnConsumerManagementStatusChanged( |
| + policy::ConsumerManagementService::Status status) { |
| + web_ui()->CallJavascriptFunction( |
| + "BrowserOptions.setConsumerManagementStatus", |
| + base::StringValue(policy::ConsumerManagementService::GetStatusString( |
|
bartfab (slow)
2014/08/21 11:39:35
Nit: How about we remove the argument from GetStat
davidyu
2014/08/22 05:14:13
Done.
|
| + status))); |
| +} |
| + |
| #endif // defined(OS_CHROMEOS) |
| void BrowserOptionsHandler::UpdateSyncState() { |