OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "chrome/browser/extensions/extension_bookmark_manager_api.h" | 12 #include "chrome/browser/extensions/extension_bookmark_manager_api.h" |
13 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 13 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
14 #include "chrome/browser/favicon_service.h" | 14 #include "chrome/browser/favicon_service.h" |
15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
16 #include "content/browser/webui/web_ui.h" | 16 #include "content/browser/webui/web_ui.h" |
17 | 17 |
18 class GURL; | 18 class GURL; |
19 class ListValue; | 19 class ListValue; |
20 class PrefService; | 20 class PrefService; |
21 class Profile; | 21 class Profile; |
22 class RenderViewHost; | 22 class RenderViewHost; |
23 class TabContents; | 23 class TabContents; |
24 struct ViewHostMsg_DomMessage_Params; | 24 struct ExtensionHostMsg_DomMessage_Params; |
25 | 25 |
26 // This class implements WebUI for extensions and allows extensions to put UI in | 26 // This class implements WebUI for extensions and allows extensions to put UI in |
27 // the main tab contents area. For example, each extension can specify an | 27 // the main tab contents area. For example, each extension can specify an |
28 // "options_page", and that page is displayed in the tab contents area and is | 28 // "options_page", and that page is displayed in the tab contents area and is |
29 // hosted by this class. | 29 // hosted by this class. |
30 class ExtensionWebUI | 30 class ExtensionWebUI |
31 : public WebUI, | 31 : public WebUI, |
32 public ExtensionFunctionDispatcher::Delegate { | 32 public ExtensionFunctionDispatcher::Delegate { |
33 public: | 33 public: |
34 static const char kExtensionURLOverrides[]; | 34 static const char kExtensionURLOverrides[]; |
35 | 35 |
36 explicit ExtensionWebUI(TabContents* tab_contents, const GURL& url); | 36 explicit ExtensionWebUI(TabContents* tab_contents, const GURL& url); |
37 | 37 |
38 virtual ~ExtensionWebUI(); | 38 virtual ~ExtensionWebUI(); |
39 | 39 |
40 ExtensionFunctionDispatcher* extension_function_dispatcher() const { | 40 ExtensionFunctionDispatcher* extension_function_dispatcher() const { |
41 return extension_function_dispatcher_.get(); | 41 return extension_function_dispatcher_.get(); |
42 } | 42 } |
43 | 43 |
44 // WebUI | 44 // WebUI |
45 virtual void RenderViewCreated(RenderViewHost* render_view_host); | 45 virtual void RenderViewCreated(RenderViewHost* render_view_host); |
46 virtual void RenderViewReused(RenderViewHost* render_view_host); | 46 virtual void RenderViewReused(RenderViewHost* render_view_host); |
47 virtual void ProcessWebUIMessage(const ViewHostMsg_DomMessage_Params& params); | 47 virtual void ProcessWebUIMessage( |
| 48 const ExtensionHostMsg_DomMessage_Params& params); |
48 | 49 |
49 // ExtensionFunctionDispatcher::Delegate | 50 // ExtensionFunctionDispatcher::Delegate |
50 virtual Browser* GetBrowser(); | 51 virtual Browser* GetBrowser(); |
51 virtual gfx::NativeView GetNativeViewOfHost(); | 52 virtual gfx::NativeView GetNativeViewOfHost(); |
52 virtual gfx::NativeWindow GetCustomFrameNativeWindow(); | 53 virtual gfx::NativeWindow GetCustomFrameNativeWindow(); |
53 virtual TabContents* associated_tab_contents() const; | 54 virtual TabContents* associated_tab_contents() const; |
54 | 55 |
55 virtual ExtensionBookmarkManagerEventRouter* | 56 virtual ExtensionBookmarkManagerEventRouter* |
56 extension_bookmark_manager_event_router(); | 57 extension_bookmark_manager_event_router(); |
57 | 58 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // TODO(aa): This seems out of place. Why is it not with the event routers for | 98 // TODO(aa): This seems out of place. Why is it not with the event routers for |
98 // the other extension APIs? | 99 // the other extension APIs? |
99 scoped_ptr<ExtensionBookmarkManagerEventRouter> | 100 scoped_ptr<ExtensionBookmarkManagerEventRouter> |
100 extension_bookmark_manager_event_router_; | 101 extension_bookmark_manager_event_router_; |
101 | 102 |
102 // The URL this WebUI was created for. | 103 // The URL this WebUI was created for. |
103 GURL url_; | 104 GURL url_; |
104 }; | 105 }; |
105 | 106 |
106 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_ | 107 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_ |
OLD | NEW |