OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 221 } |
222 | 222 |
223 // Destroy this guest. | 223 // Destroy this guest. |
224 void Destroy(); | 224 void Destroy(); |
225 | 225 |
226 // Saves the attach state of the custom element hosting this GuestView. | 226 // Saves the attach state of the custom element hosting this GuestView. |
227 void SetAttachParams(const base::DictionaryValue& params); | 227 void SetAttachParams(const base::DictionaryValue& params); |
228 void SetOpener(GuestViewBase* opener); | 228 void SetOpener(GuestViewBase* opener); |
229 | 229 |
230 // BrowserPluginGuestDelegate implementation. | 230 // BrowserPluginGuestDelegate implementation. |
231 virtual void DidAttach(int guest_proxy_routing_id) override final; | 231 void DidAttach(int guest_proxy_routing_id) final; |
232 virtual void ElementSizeChanged(const gfx::Size& old_size, | 232 void ElementSizeChanged(const gfx::Size& old_size, |
233 const gfx::Size& new_size) override final; | 233 const gfx::Size& new_size) final; |
234 virtual void GuestSizeChanged(const gfx::Size& old_size, | 234 void GuestSizeChanged(const gfx::Size& old_size, |
235 const gfx::Size& new_size) override final; | 235 const gfx::Size& new_size) final; |
236 virtual void RegisterDestructionCallback( | 236 void RegisterDestructionCallback(const DestructionCallback& callback) final; |
237 const DestructionCallback& callback) override final; | 237 void WillAttach(content::WebContents* embedder_web_contents, |
238 virtual void WillAttach( | 238 int browser_plugin_instance_id) final; |
239 content::WebContents* embedder_web_contents, | |
240 int browser_plugin_instance_id) override final; | |
241 | 239 |
242 // Dispatches an event |event_name| to the embedder with the |event| fields. | 240 // Dispatches an event |event_name| to the embedder with the |event| fields. |
243 void DispatchEventToEmbedder(Event* event); | 241 void DispatchEventToEmbedder(Event* event); |
244 | 242 |
245 protected: | 243 protected: |
246 GuestViewBase(content::BrowserContext* browser_context, | 244 GuestViewBase(content::BrowserContext* browser_context, |
247 int guest_instance_id); | 245 int guest_instance_id); |
248 | 246 |
249 virtual ~GuestViewBase(); | 247 ~GuestViewBase() override; |
250 | 248 |
251 private: | 249 private: |
252 class EmbedderLifetimeObserver; | 250 class EmbedderLifetimeObserver; |
253 | 251 |
254 void SendQueuedEvents(); | 252 void SendQueuedEvents(); |
255 | 253 |
256 void CompleteInit(const std::string& embedder_extension_id, | 254 void CompleteInit(const std::string& embedder_extension_id, |
257 content::WebContents* embedder_web_contents, | 255 content::WebContents* embedder_web_contents, |
258 const WebContentsCreatedCallback& callback, | 256 const WebContentsCreatedCallback& callback, |
259 content::WebContents* guest_web_contents); | 257 content::WebContents* guest_web_contents); |
260 | 258 |
261 static void RegisterGuestViewTypes(); | 259 static void RegisterGuestViewTypes(); |
262 | 260 |
263 // WebContentsObserver implementation. | 261 // WebContentsObserver implementation. |
264 virtual void DidStopLoading( | 262 void DidStopLoading(content::RenderViewHost* render_view_host) final; |
265 content::RenderViewHost* render_view_host) override final; | 263 void RenderViewReady() final; |
266 virtual void RenderViewReady() override final; | 264 void WebContentsDestroyed() final; |
267 virtual void WebContentsDestroyed() override final; | |
268 | 265 |
269 // WebContentsDelegate implementation. | 266 // WebContentsDelegate implementation. |
270 virtual void ActivateContents(content::WebContents* contents) override final; | 267 void ActivateContents(content::WebContents* contents) final; |
271 virtual void DeactivateContents( | 268 void DeactivateContents(content::WebContents* contents) final; |
272 content::WebContents* contents) override final; | 269 void RunFileChooser(content::WebContents* web_contents, |
273 virtual void RunFileChooser( | 270 const content::FileChooserParams& params) override; |
274 content::WebContents* web_contents, | 271 bool ShouldFocusPageAfterCrash() final; |
275 const content::FileChooserParams& params) override; | 272 bool PreHandleGestureEvent(content::WebContents* source, |
276 virtual bool ShouldFocusPageAfterCrash() override final; | 273 const blink::WebGestureEvent& event) final; |
277 virtual bool PreHandleGestureEvent( | |
278 content::WebContents* source, | |
279 const blink::WebGestureEvent& event) override final; | |
280 | 274 |
281 content::WebContents* embedder_web_contents_; | 275 content::WebContents* embedder_web_contents_; |
282 std::string embedder_extension_id_; | 276 std::string embedder_extension_id_; |
283 int embedder_render_process_id_; | 277 int embedder_render_process_id_; |
284 content::BrowserContext* browser_context_; | 278 content::BrowserContext* browser_context_; |
285 | 279 |
286 // |guest_instance_id_| is a profile-wide unique identifier for a guest | 280 // |guest_instance_id_| is a profile-wide unique identifier for a guest |
287 // WebContents. | 281 // WebContents. |
288 const int guest_instance_id_; | 282 const int guest_instance_id_; |
289 | 283 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 // This is used to ensure pending tasks will not fire after this object is | 327 // This is used to ensure pending tasks will not fire after this object is |
334 // destroyed. | 328 // destroyed. |
335 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 329 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
336 | 330 |
337 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 331 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
338 }; | 332 }; |
339 | 333 |
340 } // namespace extensions | 334 } // namespace extensions |
341 | 335 |
342 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 336 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
OLD | NEW |