| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/settings/md_settings_ui.h" | 5 #include "chrome/browser/ui/webui/settings/md_settings_ui.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #endif // defined(OS_CHROMEOS) | 37 #endif // defined(OS_CHROMEOS) |
| 38 | 38 |
| 39 namespace settings { | 39 namespace settings { |
| 40 | 40 |
| 41 SettingsPageUIHandler::SettingsPageUIHandler() { | 41 SettingsPageUIHandler::SettingsPageUIHandler() { |
| 42 } | 42 } |
| 43 | 43 |
| 44 SettingsPageUIHandler::~SettingsPageUIHandler() { | 44 SettingsPageUIHandler::~SettingsPageUIHandler() { |
| 45 } | 45 } |
| 46 | 46 |
| 47 void SettingsPageUIHandler::CallJavascriptCallback( | 47 void SettingsPageUIHandler::ResolveJavascriptCallback( |
| 48 const base::Value& callback_id, const base::Value& response) { | 48 const base::Value& callback_id, |
| 49 const base::Value& response) { |
| 49 // cr.webUIResponse is a global JS function exposed from cr.js. | 50 // cr.webUIResponse is a global JS function exposed from cr.js. |
| 50 web_ui()->CallJavascriptFunction("cr.webUIResponse", callback_id, response); | 51 web_ui()->CallJavascriptFunction( |
| 52 "cr.webUIResponse", callback_id, |
| 53 base::FundamentalValue(true), response); |
| 54 } |
| 55 |
| 56 void SettingsPageUIHandler::RejectJavascriptCallback( |
| 57 const base::Value& callback_id, |
| 58 const base::Value& response) { |
| 59 // cr.webUIResponse is a global JS function exposed from cr.js. |
| 60 web_ui()->CallJavascriptFunction( |
| 61 "cr.webUIResponse", callback_id, |
| 62 base::FundamentalValue(false), response); |
| 51 } | 63 } |
| 52 | 64 |
| 53 MdSettingsUI::MdSettingsUI(content::WebUI* web_ui) | 65 MdSettingsUI::MdSettingsUI(content::WebUI* web_ui) |
| 54 : content::WebUIController(web_ui), | 66 : content::WebUIController(web_ui), |
| 55 WebContentsObserver(web_ui->GetWebContents()) { | 67 WebContentsObserver(web_ui->GetWebContents()) { |
| 56 Profile* profile = Profile::FromWebUI(web_ui); | 68 Profile* profile = Profile::FromWebUI(web_ui); |
| 57 AddSettingsPageUIHandler(new AppearanceHandler(web_ui)); | 69 AddSettingsPageUIHandler(new AppearanceHandler(web_ui)); |
| 58 AddSettingsPageUIHandler(new ClearBrowsingDataHandler(web_ui)); | 70 AddSettingsPageUIHandler(new ClearBrowsingDataHandler(web_ui)); |
| 59 AddSettingsPageUIHandler(new DownloadsHandler()); | 71 AddSettingsPageUIHandler(new DownloadsHandler()); |
| 60 AddSettingsPageUIHandler(new FontHandler(web_ui)); | 72 AddSettingsPageUIHandler(new FontHandler(web_ui)); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", | 133 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", |
| 122 base::Time::Now() - load_start_time_); | 134 base::Time::Now() - load_start_time_); |
| 123 } | 135 } |
| 124 | 136 |
| 125 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { | 137 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { |
| 126 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", | 138 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", |
| 127 base::Time::Now() - load_start_time_); | 139 base::Time::Now() - load_start_time_); |
| 128 } | 140 } |
| 129 | 141 |
| 130 } // namespace settings | 142 } // namespace settings |
| OLD | NEW |