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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 pref_service->SetBoolean(prefs::kPerformanceTracingEnabled, true); | 111 pref_service->SetBoolean(prefs::kPerformanceTracingEnabled, true); |
112 } | 112 } |
113 | 113 |
114 void SlowHandler::LoadComplete(const base::ListValue* args) { | 114 void SlowHandler::LoadComplete(const base::ListValue* args) { |
115 UpdatePage(); | 115 UpdatePage(); |
116 } | 116 } |
117 | 117 |
118 void SlowHandler::UpdatePage() { | 118 void SlowHandler::UpdatePage() { |
119 PrefService* pref_service = profile_->GetPrefs(); | 119 PrefService* pref_service = profile_->GetPrefs(); |
120 bool enabled = pref_service->GetBoolean(prefs::kPerformanceTracingEnabled); | 120 bool enabled = pref_service->GetBoolean(prefs::kPerformanceTracingEnabled); |
121 base::FundamentalValue pref_value(enabled); | 121 base::Value pref_value(enabled); |
122 web_ui()->CallJavascriptFunctionUnsafe(kJsApiTracingPrefChanged, pref_value); | 122 web_ui()->CallJavascriptFunctionUnsafe(kJsApiTracingPrefChanged, pref_value); |
123 } | 123 } |
124 | 124 |
125 // SlowUI ----------------------------------------------------------------- | 125 // SlowUI ----------------------------------------------------------------- |
126 | 126 |
127 SlowUI::SlowUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 127 SlowUI::SlowUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
128 Profile* profile = Profile::FromWebUI(web_ui); | 128 Profile* profile = Profile::FromWebUI(web_ui); |
129 | 129 |
130 web_ui->AddMessageHandler(base::MakeUnique<SlowHandler>(profile)); | 130 web_ui->AddMessageHandler(base::MakeUnique<SlowHandler>(profile)); |
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 |