OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_UI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_UI_H_ |
7 | 7 |
8 #include <unordered_set> | 8 #include <unordered_set> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
13 #include "content/public/browser/web_ui_controller.h" | 13 #include "content/public/browser/web_ui_controller.h" |
14 | 14 |
15 class GURL; | |
16 | |
17 namespace settings { | 15 namespace settings { |
18 | 16 |
19 class SettingsPageUIHandler; | 17 class SettingsPageUIHandler; |
20 | 18 |
21 // The WebUI handler for chrome://md-settings. | 19 // The WebUI handler for chrome://md-settings. |
22 class MdSettingsUI : public content::WebUIController, | 20 class MdSettingsUI : public content::WebUIController, |
23 public content::WebContentsObserver { | 21 public content::WebContentsObserver { |
24 public: | 22 public: |
25 MdSettingsUI(content::WebUI* web_ui, const GURL& url); | 23 explicit MdSettingsUI(content::WebUI* web_ui); |
26 ~MdSettingsUI() override; | 24 ~MdSettingsUI() override; |
27 | 25 |
28 // content::WebContentsObserver: | 26 // content::WebContentsObserver: |
29 void DidStartProvisionalLoadForFrame( | 27 void DidStartProvisionalLoadForFrame( |
30 content::RenderFrameHost* render_frame_host, | 28 content::RenderFrameHost* render_frame_host, |
31 const GURL& validated_url, | 29 const GURL& validated_url, |
32 bool is_error_page, | 30 bool is_error_page, |
33 bool is_iframe_srcdoc) override; | 31 bool is_iframe_srcdoc) override; |
34 void DocumentLoadedInFrame( | 32 void DocumentLoadedInFrame( |
35 content::RenderFrameHost *render_frame_host) override; | 33 content::RenderFrameHost *render_frame_host) override; |
36 void DocumentOnLoadCompletedInMainFrame() override; | 34 void DocumentOnLoadCompletedInMainFrame() override; |
37 | 35 |
38 private: | 36 private: |
39 void AddSettingsPageUIHandler(SettingsPageUIHandler* handler); | 37 void AddSettingsPageUIHandler(SettingsPageUIHandler* handler); |
40 | 38 |
41 // Weak references; all |handlers_| are owned by |web_ui()|. | 39 // Weak references; all |handlers_| are owned by |web_ui()|. |
42 std::unordered_set<SettingsPageUIHandler*> handlers_; | 40 std::unordered_set<SettingsPageUIHandler*> handlers_; |
43 | 41 |
44 base::Time load_start_time_; | 42 base::Time load_start_time_; |
45 | 43 |
46 DISALLOW_COPY_AND_ASSIGN(MdSettingsUI); | 44 DISALLOW_COPY_AND_ASSIGN(MdSettingsUI); |
47 }; | 45 }; |
48 | 46 |
49 } // namespace settings | 47 } // namespace settings |
50 | 48 |
51 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_UI_H_ | 49 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_MD_SETTINGS_UI_H_ |
OLD | NEW |