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_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // Returns the given extension's background page, or NULL if none. | 49 // Returns the given extension's background page, or NULL if none. |
50 static content::RenderView* GetBackgroundPage( | 50 static content::RenderView* GetBackgroundPage( |
51 const std::string& extension_id); | 51 const std::string& extension_id); |
52 | 52 |
53 ExtensionHelper(content::RenderView* render_view, Dispatcher* dispatcher); | 53 ExtensionHelper(content::RenderView* render_view, Dispatcher* dispatcher); |
54 virtual ~ExtensionHelper(); | 54 virtual ~ExtensionHelper(); |
55 | 55 |
56 int tab_id() const { return tab_id_; } | 56 int tab_id() const { return tab_id_; } |
57 int browser_window_id() const { return browser_window_id_; } | 57 int browser_window_id() const { return browser_window_id_; } |
58 chrome::ViewType view_type() const { return view_type_; } | 58 chrome::ViewType view_type() const { return view_type_; } |
59 | 59 Dispatcher* dispatcher() const { return dispatcher_; } |
60 // Helper to add a logging message to the root frame's console. | |
61 void AddMessageToRootConsole(content::ConsoleMessageLevel level, | |
62 const std::string& message); | |
63 | 60 |
64 private: | 61 private: |
65 // RenderViewObserver implementation. | 62 // RenderViewObserver implementation. |
66 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 63 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
67 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE; | 64 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE; |
68 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; | 65 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; |
69 virtual void DidCreateDocumentElement(WebKit::WebFrame* frame) OVERRIDE; | 66 virtual void DidCreateDocumentElement(WebKit::WebFrame* frame) OVERRIDE; |
70 virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) OVERRIDE; | 67 virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) OVERRIDE; |
71 virtual void FrameDetached(WebKit::WebFrame* frame) OVERRIDE; | 68 virtual void FrameDetached(WebKit::WebFrame* frame) OVERRIDE; |
72 virtual void DidCreateDataSource(WebKit::WebFrame* frame, | 69 virtual void DidCreateDataSource(WebKit::WebFrame* frame, |
(...skipping 19 matching lines...) Expand all Loading... |
92 const std::string& error_message); | 89 const std::string& error_message); |
93 void OnExecuteCode(const ExtensionMsg_ExecuteCode_Params& params); | 90 void OnExecuteCode(const ExtensionMsg_ExecuteCode_Params& params); |
94 void OnGetApplicationInfo(int page_id); | 91 void OnGetApplicationInfo(int page_id); |
95 void OnNotifyRendererViewType(chrome::ViewType view_type); | 92 void OnNotifyRendererViewType(chrome::ViewType view_type); |
96 void OnSetTabId(int tab_id); | 93 void OnSetTabId(int tab_id); |
97 void OnUpdateBrowserWindowId(int window_id); | 94 void OnUpdateBrowserWindowId(int window_id); |
98 void OnAddMessageToConsole(content::ConsoleMessageLevel level, | 95 void OnAddMessageToConsole(content::ConsoleMessageLevel level, |
99 const std::string& message); | 96 const std::string& message); |
100 void OnAppWindowClosed(); | 97 void OnAppWindowClosed(); |
101 | 98 |
102 // Helper to add a logging message to the root frame's console. | |
103 void AddMessageToRootConsole(content::ConsoleMessageLevel level, | |
104 const string16& message); | |
105 | |
106 Dispatcher* dispatcher_; | 99 Dispatcher* dispatcher_; |
107 | 100 |
108 // The app info that we are processing. This is used when installing an app | 101 // The app info that we are processing. This is used when installing an app |
109 // via application definition. The in-progress web app is stored here while | 102 // via application definition. The in-progress web app is stored here while |
110 // its manifest and icons are downloaded. | 103 // its manifest and icons are downloaded. |
111 scoped_ptr<WebApplicationInfo> pending_app_info_; | 104 scoped_ptr<WebApplicationInfo> pending_app_info_; |
112 | 105 |
113 // Used to download the application definition file. | 106 // Used to download the application definition file. |
114 scoped_ptr<webkit_glue::ResourceFetcher> app_definition_fetcher_; | 107 scoped_ptr<webkit_glue::ResourceFetcher> app_definition_fetcher_; |
115 | 108 |
(...skipping 14 matching lines...) Expand all Loading... |
130 | 123 |
131 // Id number of browser window which RenderView is attached to. | 124 // Id number of browser window which RenderView is attached to. |
132 int browser_window_id_; | 125 int browser_window_id_; |
133 | 126 |
134 DISALLOW_COPY_AND_ASSIGN(ExtensionHelper); | 127 DISALLOW_COPY_AND_ASSIGN(ExtensionHelper); |
135 }; | 128 }; |
136 | 129 |
137 } // namespace extensions | 130 } // namespace extensions |
138 | 131 |
139 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_ | 132 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_HELPER_H_ |
OLD | NEW |