| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/slow_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/slow_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 pref_service->SetBoolean(prefs::kPerformanceTracingEnabled, true); | 110 pref_service->SetBoolean(prefs::kPerformanceTracingEnabled, true); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void SlowHandler::LoadComplete(const base::ListValue* args) { | 113 void SlowHandler::LoadComplete(const base::ListValue* args) { |
| 114 UpdatePage(); | 114 UpdatePage(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void SlowHandler::UpdatePage() { | 117 void SlowHandler::UpdatePage() { |
| 118 PrefService* pref_service = profile_->GetPrefs(); | 118 PrefService* pref_service = profile_->GetPrefs(); |
| 119 bool enabled = pref_service->GetBoolean(prefs::kPerformanceTracingEnabled); | 119 bool enabled = pref_service->GetBoolean(prefs::kPerformanceTracingEnabled); |
| 120 base::FundamentalValue pref_value(enabled); | 120 base::Value pref_value(enabled); |
| 121 web_ui()->CallJavascriptFunctionUnsafe(kJsApiTracingPrefChanged, pref_value); | 121 web_ui()->CallJavascriptFunctionUnsafe(kJsApiTracingPrefChanged, pref_value); |
| 122 } | 122 } |
| 123 | 123 |
| 124 // SlowUI ----------------------------------------------------------------- | 124 // SlowUI ----------------------------------------------------------------- |
| 125 | 125 |
| 126 SlowUI::SlowUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 126 SlowUI::SlowUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 127 Profile* profile = Profile::FromWebUI(web_ui); | 127 Profile* profile = Profile::FromWebUI(web_ui); |
| 128 | 128 |
| 129 SlowHandler* handler = new SlowHandler(profile); | 129 SlowHandler* handler = new SlowHandler(profile); |
| 130 web_ui->AddMessageHandler(handler); | 130 web_ui->AddMessageHandler(handler); |
| 131 | 131 |
| 132 // Set up the chrome://slow/ source. | 132 // Set up the chrome://slow/ source. |
| 133 content::WebUIDataSource::Add(profile, CreateSlowUIHTMLSource()); | 133 content::WebUIDataSource::Add(profile, CreateSlowUIHTMLSource()); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace chromeos | 136 } // namespace chromeos |
| 137 | 137 |
| OLD | NEW |