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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" | |
12 #include "chrome/browser/favicon/favicon_service.h" | 11 #include "chrome/browser/favicon/favicon_service.h" |
13 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
14 #include "content/public/browser/web_ui_controller.h" | 13 #include "content/public/browser/web_ui_controller.h" |
15 | 14 |
16 namespace content { | 15 namespace content { |
| 16 class BrowserContext; |
17 class WebContents; | 17 class WebContents; |
18 } | 18 } |
19 | 19 |
| 20 namespace extensions { |
| 21 class BookmarkManagerPrivateEventRouter; |
| 22 } |
| 23 |
20 class PrefService; | 24 class PrefService; |
21 class Profile; | 25 class Profile; |
22 | 26 |
23 // This class implements WebUI for extensions and allows extensions to put UI in | 27 // This class implements WebUI for extensions and allows extensions to put UI in |
24 // the main tab contents area. For example, each extension can specify an | 28 // the main tab contents area. For example, each extension can specify an |
25 // "options_page", and that page is displayed in the tab contents area and is | 29 // "options_page", and that page is displayed in the tab contents area and is |
26 // hosted by this class. | 30 // hosted by this class. |
27 class ExtensionWebUI : public content::WebUIController { | 31 class ExtensionWebUI : public content::WebUIController { |
28 public: | 32 public: |
29 static const char kExtensionURLOverrides[]; | 33 static const char kExtensionURLOverrides[]; |
30 | 34 |
31 ExtensionWebUI(content::WebUI* web_ui, const GURL& url); | 35 ExtensionWebUI(content::WebUI* web_ui, const GURL& url); |
32 | 36 |
33 virtual ~ExtensionWebUI(); | 37 virtual ~ExtensionWebUI(); |
34 | 38 |
35 virtual BookmarkManagerExtensionEventRouter* | 39 virtual extensions::BookmarkManagerPrivateEventRouter* |
36 bookmark_manager_extension_event_router(); | 40 bookmark_manager_private_event_router(); |
37 | 41 |
38 // BrowserURLHandler | 42 // BrowserURLHandler |
39 static bool HandleChromeURLOverride(GURL* url, | 43 static bool HandleChromeURLOverride(GURL* url, |
40 content::BrowserContext* browser_context); | 44 content::BrowserContext* browser_context); |
41 static bool HandleChromeURLOverrideReverse( | 45 static bool HandleChromeURLOverrideReverse( |
42 GURL* url, content::BrowserContext* browser_context); | 46 GURL* url, content::BrowserContext* browser_context); |
43 | 47 |
44 // Register and unregister a dictionary of one or more overrides. | 48 // Register and unregister a dictionary of one or more overrides. |
45 // Page names are the keys, and chrome-extension: URLs are the values. | 49 // Page names are the keys, and chrome-extension: URLs are the values. |
46 // (e.g. { "newtab": "chrome-extension://<id>/my_new_tab.html" } | 50 // (e.g. { "newtab": "chrome-extension://<id>/my_new_tab.html" } |
(...skipping 18 matching lines...) Expand all Loading... |
65 private: | 69 private: |
66 // Unregister the specified override, and if it's the currently active one, | 70 // Unregister the specified override, and if it's the currently active one, |
67 // ensure that something takes its place. | 71 // ensure that something takes its place. |
68 static void UnregisterAndReplaceOverride(const std::string& page, | 72 static void UnregisterAndReplaceOverride(const std::string& page, |
69 Profile* profile, | 73 Profile* profile, |
70 base::ListValue* list, | 74 base::ListValue* list, |
71 const base::Value* override); | 75 const base::Value* override); |
72 | 76 |
73 // TODO(aa): This seems out of place. Why is it not with the event routers for | 77 // TODO(aa): This seems out of place. Why is it not with the event routers for |
74 // the other extension APIs? | 78 // the other extension APIs? |
75 scoped_ptr<BookmarkManagerExtensionEventRouter> | 79 scoped_ptr<extensions::BookmarkManagerPrivateEventRouter> |
76 bookmark_manager_extension_event_router_; | 80 bookmark_manager_private_event_router_; |
77 | 81 |
78 // The URL this WebUI was created for. | 82 // The URL this WebUI was created for. |
79 GURL url_; | 83 GURL url_; |
80 }; | 84 }; |
81 | 85 |
82 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_ | 86 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_ |
OLD | NEW |