OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_EXTENSION_WEB_UI_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 namespace user_prefs { | 26 namespace user_prefs { |
27 class PrefRegistrySyncable; | 27 class PrefRegistrySyncable; |
28 } | 28 } |
29 | 29 |
30 // This class implements WebUI for extensions and allows extensions to put UI in | 30 // This class implements WebUI for extensions and allows extensions to put UI in |
31 // the main tab contents area. For example, each extension can specify an | 31 // the main tab contents area. For example, each extension can specify an |
32 // "options_page", and that page is displayed in the tab contents area and is | 32 // "options_page", and that page is displayed in the tab contents area and is |
33 // hosted by this class. | 33 // hosted by this class. |
| 34 // TODO(devlin): The above description has nothing to do with this class as far |
| 35 // as I can tell. |
34 class ExtensionWebUI : public content::WebUIController { | 36 class ExtensionWebUI : public content::WebUIController { |
35 public: | 37 public: |
36 static const char kExtensionURLOverrides[]; | 38 static const char kExtensionURLOverrides[]; |
37 | 39 |
| 40 // Returns true if the given url requires WebUI bindings. |
| 41 static bool NeedsExtensionWebUI(content::BrowserContext* browser_context, |
| 42 const GURL& url); |
| 43 |
38 ExtensionWebUI(content::WebUI* web_ui, const GURL& url); | 44 ExtensionWebUI(content::WebUI* web_ui, const GURL& url); |
39 | 45 |
40 ~ExtensionWebUI() override; | 46 ~ExtensionWebUI() override; |
41 | 47 |
42 virtual extensions::BookmarkManagerPrivateDragEventRouter* | 48 extensions::BookmarkManagerPrivateDragEventRouter* |
43 bookmark_manager_private_drag_event_router(); | 49 bookmark_manager_private_drag_event_router(); |
44 | 50 |
| 51 // TODO(devlin): The rest of this class is static methods dealing with |
| 52 // chrome url overrides (e.g. changing chrome://newtab to go to an extension- |
| 53 // provided new tab page). This should be in a separate class from the WebUI |
| 54 // controller for the bookmark manager. |
45 // BrowserURLHandler | 55 // BrowserURLHandler |
46 static bool HandleChromeURLOverride(GURL* url, | 56 static bool HandleChromeURLOverride(GURL* url, |
47 content::BrowserContext* browser_context); | 57 content::BrowserContext* browser_context); |
48 static bool HandleChromeURLOverrideReverse( | 58 static bool HandleChromeURLOverrideReverse( |
49 GURL* url, content::BrowserContext* browser_context); | 59 GURL* url, content::BrowserContext* browser_context); |
50 | 60 |
51 // Initialize the Chrome URL overrides. This must happen *before* any further | 61 // Initialize the Chrome URL overrides. This must happen *before* any further |
52 // calls for URL overrides! | 62 // calls for URL overrides! |
53 static void InitializeChromeURLOverrides(Profile* profile); | 63 static void InitializeChromeURLOverrides(Profile* profile); |
54 | 64 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 static void UnregisterAndReplaceOverride(const std::string& page, | 100 static void UnregisterAndReplaceOverride(const std::string& page, |
91 Profile* profile, | 101 Profile* profile, |
92 base::ListValue* list, | 102 base::ListValue* list, |
93 const base::Value* override); | 103 const base::Value* override); |
94 | 104 |
95 // TODO(aa): This seems out of place. Why is it not with the event routers for | 105 // TODO(aa): This seems out of place. Why is it not with the event routers for |
96 // the other extension APIs? | 106 // the other extension APIs? |
97 std::unique_ptr<extensions::BookmarkManagerPrivateDragEventRouter> | 107 std::unique_ptr<extensions::BookmarkManagerPrivateDragEventRouter> |
98 bookmark_manager_private_drag_event_router_; | 108 bookmark_manager_private_drag_event_router_; |
99 | 109 |
100 // The URL this WebUI was created for. | 110 DISALLOW_COPY_AND_ASSIGN(ExtensionWebUI); |
101 GURL url_; | |
102 }; | 111 }; |
103 | 112 |
104 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_ | 113 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_ |
OLD | NEW |