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_HOST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 content::RenderViewHost* render_view_host) OVERRIDE; | 135 content::RenderViewHost* render_view_host) OVERRIDE; |
136 virtual void RenderViewReady() OVERRIDE; | 136 virtual void RenderViewReady() OVERRIDE; |
137 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 137 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
138 virtual void DocumentAvailableInMainFrame() OVERRIDE; | 138 virtual void DocumentAvailableInMainFrame() OVERRIDE; |
139 virtual void DidStopLoading() OVERRIDE; | 139 virtual void DidStopLoading() OVERRIDE; |
140 | 140 |
141 // content::WebContentsDelegate | 141 // content::WebContentsDelegate |
142 virtual content::WebContents* OpenURLFromTab( | 142 virtual content::WebContents* OpenURLFromTab( |
143 content::WebContents* source, | 143 content::WebContents* source, |
144 const content::OpenURLParams& params) OVERRIDE; | 144 const content::OpenURLParams& params) OVERRIDE; |
145 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 145 virtual bool PreHandleKeyboardEvent( |
146 bool* is_keyboard_shortcut) OVERRIDE; | 146 const content::NativeWebKeyboardEvent& event, |
147 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) | 147 bool* is_keyboard_shortcut) OVERRIDE; |
148 OVERRIDE; | 148 virtual void HandleKeyboardEvent( |
| 149 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
149 virtual void ResizeDueToAutoResize(content::WebContents* source, | 150 virtual void ResizeDueToAutoResize(content::WebContents* source, |
150 const gfx::Size& new_size) OVERRIDE; | 151 const gfx::Size& new_size) OVERRIDE; |
151 virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator() | 152 virtual content::JavaScriptDialogCreator* |
152 OVERRIDE; | 153 GetJavaScriptDialogCreator() OVERRIDE; |
153 virtual void RunFileChooser( | 154 virtual void RunFileChooser( |
154 content::WebContents* tab, | 155 content::WebContents* tab, |
155 const content::FileChooserParams& params) OVERRIDE; | 156 const content::FileChooserParams& params) OVERRIDE; |
156 virtual void AddNewContents(content::WebContents* source, | 157 virtual void AddNewContents(content::WebContents* source, |
157 content::WebContents* new_contents, | 158 content::WebContents* new_contents, |
158 WindowOpenDisposition disposition, | 159 WindowOpenDisposition disposition, |
159 const gfx::Rect& initial_pos, | 160 const gfx::Rect& initial_pos, |
160 bool user_gesture) OVERRIDE; | 161 bool user_gesture) OVERRIDE; |
161 virtual void CloseContents(content::WebContents* contents) OVERRIDE; | 162 virtual void CloseContents(content::WebContents* contents) OVERRIDE; |
162 | 163 |
163 // content::NotificationObserver | 164 // content::NotificationObserver |
164 virtual void Observe(int type, | 165 virtual void Observe(int type, |
165 const content::NotificationSource& source, | 166 const content::NotificationSource& source, |
166 const content::NotificationDetails& details) OVERRIDE; | 167 const content::NotificationDetails& details) OVERRIDE; |
167 | 168 |
168 private: | 169 private: |
169 friend class ProcessCreationQueue; | 170 friend class ProcessCreationQueue; |
170 | 171 |
171 // Actually create the RenderView for this host. See CreateRenderViewSoon. | 172 // Actually create the RenderView for this host. See CreateRenderViewSoon. |
172 void CreateRenderViewNow(); | 173 void CreateRenderViewNow(); |
173 | 174 |
174 // Navigates to the initial page. | 175 // Navigates to the initial page. |
175 void LoadInitialURL(); | 176 void LoadInitialURL(); |
176 | 177 |
177 // Closes this host (results in deletion). | 178 // Closes this host (results in deletion). |
178 void Close(); | 179 void Close(); |
179 | 180 |
180 // ExtensionFunctionDispatcher::Delegate | 181 // ExtensionFunctionDispatcher::Delegate |
181 virtual ExtensionWindowController* GetExtensionWindowController() | 182 virtual ExtensionWindowController* |
182 const OVERRIDE; | 183 GetExtensionWindowController() const OVERRIDE; |
183 | 184 |
184 // Message handlers. | 185 // Message handlers. |
185 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 186 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
186 void OnEventAck(); | 187 void OnEventAck(); |
187 void OnIncrementLazyKeepaliveCount(); | 188 void OnIncrementLazyKeepaliveCount(); |
188 void OnDecrementLazyKeepaliveCount(); | 189 void OnDecrementLazyKeepaliveCount(); |
189 | 190 |
190 // Handles keyboard events that were not handled by HandleKeyboardEvent(). | 191 // Handles keyboard events that were not handled by HandleKeyboardEvent(). |
191 // Platform specific implementation may override this method to handle the | 192 // Platform specific implementation may override this method to handle the |
192 // event in platform specific way. | 193 // event in platform specific way. |
193 virtual void UnhandledKeyboardEvent(const NativeWebKeyboardEvent& event) {} | 194 virtual void UnhandledKeyboardEvent( |
| 195 const content::NativeWebKeyboardEvent& event) {} |
194 | 196 |
195 // Returns true if we're hosting a background page. | 197 // Returns true if we're hosting a background page. |
196 // This isn't valid until CreateRenderView is called. | 198 // This isn't valid until CreateRenderView is called. |
197 bool is_background_page() const { return !view(); } | 199 bool is_background_page() const { return !view(); } |
198 | 200 |
199 // The extension that we're hosting in this view. | 201 // The extension that we're hosting in this view. |
200 const Extension* extension_; | 202 const Extension* extension_; |
201 | 203 |
202 // Id of extension that we're hosting in this view. | 204 // Id of extension that we're hosting in this view. |
203 const std::string extension_id_; | 205 const std::string extension_id_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // The relevant WebContents associated with this ExtensionHost, if any. | 245 // The relevant WebContents associated with this ExtensionHost, if any. |
244 content::WebContents* associated_web_contents_; | 246 content::WebContents* associated_web_contents_; |
245 | 247 |
246 // Used to measure how long it's been since the host was created. | 248 // Used to measure how long it's been since the host was created. |
247 PerfTimer since_created_; | 249 PerfTimer since_created_; |
248 | 250 |
249 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 251 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
250 }; | 252 }; |
251 | 253 |
252 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 254 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
OLD | NEW |