| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 AddLocalizedStrings(html_source, profile); | 118 AddLocalizedStrings(html_source, profile); |
| 119 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML); | 119 html_source->SetDefaultResource(IDR_SETTINGS_SETTINGS_HTML); |
| 120 | 120 |
| 121 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), | 121 content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), |
| 122 html_source); | 122 html_source); |
| 123 } | 123 } |
| 124 | 124 |
| 125 MdSettingsUI::~MdSettingsUI() { | 125 MdSettingsUI::~MdSettingsUI() { |
| 126 } | 126 } |
| 127 | 127 |
| 128 void MdSettingsUI::AddSettingsPageUIHandler( | 128 void MdSettingsUI::RenderViewReused( |
| 129 content::WebUIMessageHandler* handler_raw) { | 129 content::RenderViewHost* /*render_view_host*/) { |
| 130 scoped_ptr<content::WebUIMessageHandler> handler(handler_raw); | 130 for (SettingsPageUIHandler* handler : handlers_) |
| 131 DCHECK(handler.get()); | 131 handler->RenderViewReused(); |
| 132 } |
| 132 | 133 |
| 133 web_ui()->AddMessageHandler(handler.release()); | 134 void MdSettingsUI::AddSettingsPageUIHandler(SettingsPageUIHandler* handler) { |
| 135 DCHECK(handler); |
| 136 handlers_.insert(handler); |
| 137 web_ui()->AddMessageHandler(handler); // |handler| is owned by |web_ui()|. |
| 134 } | 138 } |
| 135 | 139 |
| 136 void MdSettingsUI::DidStartProvisionalLoadForFrame( | 140 void MdSettingsUI::DidStartProvisionalLoadForFrame( |
| 137 content::RenderFrameHost* render_frame_host, | 141 content::RenderFrameHost* render_frame_host, |
| 138 const GURL& validated_url, | 142 const GURL& validated_url, |
| 139 bool is_error_page, | 143 bool is_error_page, |
| 140 bool is_iframe_srcdoc) { | 144 bool is_iframe_srcdoc) { |
| 141 load_start_time_ = base::Time::Now(); | 145 load_start_time_ = base::Time::Now(); |
| 142 } | 146 } |
| 143 | 147 |
| 144 void MdSettingsUI::DocumentLoadedInFrame( | 148 void MdSettingsUI::DocumentLoadedInFrame( |
| 145 content::RenderFrameHost* render_frame_host) { | 149 content::RenderFrameHost* render_frame_host) { |
| 146 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", | 150 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", |
| 147 base::Time::Now() - load_start_time_); | 151 base::Time::Now() - load_start_time_); |
| 148 } | 152 } |
| 149 | 153 |
| 150 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { | 154 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { |
| 151 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", | 155 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", |
| 152 base::Time::Now() - load_start_time_); | 156 base::Time::Now() - load_start_time_); |
| 153 } | 157 } |
| 154 | 158 |
| 155 } // namespace settings | 159 } // namespace settings |
| OLD | NEW |