| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/options/managed_user_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/managed_user_settings_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 base::Bind(&ManagedUserSettingsHandler::OnLocalPassphraseChanged, | 105 base::Bind(&ManagedUserSettingsHandler::OnLocalPassphraseChanged, |
| 106 base::Unretained(this))); | 106 base::Unretained(this))); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void ManagedUserSettingsHandler::InitializePage() { | 109 void ManagedUserSettingsHandler::InitializePage() { |
| 110 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 110 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 111 switches::kEnableManagedUsers)) { | 111 switches::kEnableManagedUsers)) { |
| 112 return; | 112 return; |
| 113 } | 113 } |
| 114 | 114 |
| 115 #if !defined(OS_CHROMEOS) |
| 115 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); | 116 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 116 bool passphrase_empty = | 117 bool passphrase_empty = |
| 117 pref_service->GetString(prefs::kManagedModeLocalPassphrase).empty(); | 118 pref_service->GetString(prefs::kManagedModeLocalPassphrase).empty(); |
| 118 base::FundamentalValue is_passphrase_set(!passphrase_empty); | 119 base::FundamentalValue is_passphrase_set(!passphrase_empty); |
| 119 web_ui()->CallJavascriptFunction( | 120 web_ui()->CallJavascriptFunction( |
| 120 "ManagedUserSettings.passphraseChanged", | 121 "ManagedUserSettings.passphraseChanged", |
| 121 is_passphrase_set); | 122 is_passphrase_set); |
| 123 #endif |
| 122 | 124 |
| 123 // Populate the list. | 125 // Populate the list. |
| 124 UpdateViewFromModel(); | 126 UpdateViewFromModel(); |
| 125 } | 127 } |
| 126 | 128 |
| 127 void ManagedUserSettingsHandler::HandlePageOpened(const base::ListValue* args) { | 129 void ManagedUserSettingsHandler::HandlePageOpened(const base::ListValue* args) { |
| 128 start_time_ = base::TimeTicks::Now(); | 130 start_time_ = base::TimeTicks::Now(); |
| 129 content::RecordAction(UserMetricsAction("ManagedMode_OpenSettings")); | 131 content::RecordAction(UserMetricsAction("ManagedMode_OpenSettings")); |
| 130 ManagedUserService* service = ManagedUserServiceFactory::GetForProfile( | 132 ManagedUserService* service = ManagedUserServiceFactory::GetForProfile( |
| 131 Profile::FromWebUI(web_ui())); | 133 Profile::FromWebUI(web_ui())); |
| 132 ManagedModeNavigationObserver* observer = | 134 ManagedModeNavigationObserver* observer = |
| 133 ManagedModeNavigationObserver::FromWebContents( | 135 ManagedModeNavigationObserver::FromWebContents( |
| 134 web_ui()->GetWebContents()); | 136 web_ui()->GetWebContents()); |
| 135 | 137 |
| 136 // Check if we need to give initial elevation for startup of a new profile. | 138 // Check if we need to give initial elevation for startup of a new profile. |
| 137 if (service->startup_elevation()) { | 139 if (service->startup_elevation()) { |
| 138 service->set_startup_elevation(false); | 140 service->set_startup_elevation(false); |
| 141 #if !defined(OS_CHROMEOS) |
| 139 observer->set_elevated(true); | 142 observer->set_elevated(true); |
| 143 #endif |
| 140 } else { | 144 } else { |
| 141 has_seen_settings_dialog_ = true; | 145 has_seen_settings_dialog_ = true; |
| 142 } | 146 } |
| 143 | 147 |
| 144 if (observer->is_elevated()) { | 148 if (observer->is_elevated()) { |
| 145 web_ui()->CallJavascriptFunction("ManagedUserSettings.isAuthenticated", | 149 web_ui()->CallJavascriptFunction("ManagedUserSettings.isAuthenticated", |
| 146 base::FundamentalValue(true)); | 150 base::FundamentalValue(true)); |
| 147 } | 151 } |
| 148 } | 152 } |
| 149 | 153 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 void ManagedUserSettingsHandler::UpdateViewFromModel() { | 323 void ManagedUserSettingsHandler::UpdateViewFromModel() { |
| 320 ListValue entries; | 324 ListValue entries; |
| 321 AddCurrentURLEntries(web_ui(), &entries); | 325 AddCurrentURLEntries(web_ui(), &entries); |
| 322 | 326 |
| 323 web_ui()->CallJavascriptFunction( | 327 web_ui()->CallJavascriptFunction( |
| 324 "ManagedUserSettings.setManualExceptions", | 328 "ManagedUserSettings.setManualExceptions", |
| 325 entries); | 329 entries); |
| 326 } | 330 } |
| 327 | 331 |
| 328 } // namespace options | 332 } // namespace options |
| OLD | NEW |