| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/chromeos/login/enable_debugging_screen_handler
.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler
.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 void EnableDebuggingScreenHandler::UpdateUIState( | 266 void EnableDebuggingScreenHandler::UpdateUIState( |
| 267 EnableDebuggingScreenHandler::UIState state) { | 267 EnableDebuggingScreenHandler::UIState state) { |
| 268 if (state == UI_STATE_SETUP || | 268 if (state == UI_STATE_SETUP || |
| 269 state == UI_STATE_ERROR || | 269 state == UI_STATE_ERROR || |
| 270 state == UI_STATE_DONE) { | 270 state == UI_STATE_DONE) { |
| 271 PrefService* prefs = g_browser_process->local_state(); | 271 PrefService* prefs = g_browser_process->local_state(); |
| 272 prefs->ClearPref(prefs::kDebuggingFeaturesRequested); | 272 prefs->ClearPref(prefs::kDebuggingFeaturesRequested); |
| 273 prefs->CommitPendingWrite(); | 273 prefs->CommitPendingWrite(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 web_ui()->CallJavascriptFunction( | 276 web_ui()->CallJavascriptFunctionUnsafe( |
| 277 "login.EnableDebuggingScreen.updateState", | 277 "login.EnableDebuggingScreen.updateState", |
| 278 base::FundamentalValue(static_cast<int>(state))); | 278 base::FundamentalValue(static_cast<int>(state))); |
| 279 } | 279 } |
| 280 | 280 |
| 281 void EnableDebuggingScreenHandler::HandleOnLearnMore() { | 281 void EnableDebuggingScreenHandler::HandleOnLearnMore() { |
| 282 VLOG(1) << "Trying to view the help article about debugging features."; | 282 VLOG(1) << "Trying to view the help article about debugging features."; |
| 283 const std::string help_content = | 283 const std::string help_content = |
| 284 l10n_util::GetStringUTF8(IDS_ENABLE_DEBUGGING_HELP); | 284 l10n_util::GetStringUTF8(IDS_ENABLE_DEBUGGING_HELP); |
| 285 const GURL data_url = GURL("data:text/html;charset=utf-8," + help_content); | 285 const GURL data_url = GURL("data:text/html;charset=utf-8," + help_content); |
| 286 | 286 |
| 287 LoginWebDialog* dialog = new LoginWebDialog( | 287 LoginWebDialog* dialog = new LoginWebDialog( |
| 288 Profile::FromWebUI(web_ui()), | 288 Profile::FromWebUI(web_ui()), |
| 289 NULL, | 289 NULL, |
| 290 GetNativeWindow(), | 290 GetNativeWindow(), |
| 291 base::string16(), | 291 base::string16(), |
| 292 data_url); | 292 data_url); |
| 293 dialog->Show(); | 293 dialog->Show(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace chromeos | 296 } // namespace chromeos |
| OLD | NEW |