Chromium Code Reviews| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 | 289 |
| 290 // Dispatches an event to the view. | 290 // Dispatches an event to the view. |
| 291 void DispatchEventToView(Event* event); | 291 void DispatchEventToView(Event* event); |
| 292 | 292 |
| 293 protected: | 293 protected: |
| 294 GuestViewBase(content::WebContents* owner_web_contents, | 294 GuestViewBase(content::WebContents* owner_web_contents, |
| 295 int guest_instance_id); | 295 int guest_instance_id); |
| 296 | 296 |
| 297 ~GuestViewBase() override; | 297 ~GuestViewBase() override; |
| 298 | 298 |
| 299 // WebContentsObserver implementation. | |
|
lazyboy
2015/01/23 20:08:01
Also note this private->public changes to overridd
Fady Samuel
2015/01/23 20:13:22
Done. CQ'ing now.
| |
| 300 void DidStopLoading(content::RenderViewHost* render_view_host) final; | |
| 301 void RenderViewReady() final; | |
| 302 void WebContentsDestroyed() final; | |
| 303 | |
| 304 // WebContentsDelegate implementation. | |
| 305 void ActivateContents(content::WebContents* contents) final; | |
| 306 void DeactivateContents(content::WebContents* contents) final; | |
| 307 void ContentsZoomChange(bool zoom_in) override; | |
| 308 void HandleKeyboardEvent( | |
| 309 content::WebContents* source, | |
| 310 const content::NativeWebKeyboardEvent& event) override; | |
| 311 void RunFileChooser(content::WebContents* web_contents, | |
| 312 const content::FileChooserParams& params) override; | |
| 313 bool ShouldFocusPageAfterCrash() final; | |
| 314 bool PreHandleGestureEvent(content::WebContents* source, | |
| 315 const blink::WebGestureEvent& event) final; | |
| 316 void UpdatePreferredSize(content::WebContents* web_contents, | |
| 317 const gfx::Size& pref_size) final; | |
| 318 | |
| 299 private: | 319 private: |
| 300 class OwnerLifetimeObserver; | 320 class OwnerLifetimeObserver; |
| 301 | 321 |
| 302 class OpenerLifetimeObserver; | 322 class OpenerLifetimeObserver; |
| 303 | 323 |
| 304 void DispatchEvent(Event* event, int instance_id); | 324 void DispatchEvent(Event* event, int instance_id); |
| 305 | 325 |
| 306 void SendQueuedEvents(); | 326 void SendQueuedEvents(); |
| 307 | 327 |
| 308 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, | 328 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, |
| 309 const WebContentsCreatedCallback& callback, | 329 const WebContentsCreatedCallback& callback, |
| 310 content::WebContents* guest_web_contents); | 330 content::WebContents* guest_web_contents); |
| 311 | 331 |
| 312 // Dispatches the onResize event to the embedder. | 332 // Dispatches the onResize event to the embedder. |
| 313 void DispatchOnResizeEvent(const gfx::Size& old_size, | 333 void DispatchOnResizeEvent(const gfx::Size& old_size, |
| 314 const gfx::Size& new_size); | 334 const gfx::Size& new_size); |
| 315 | 335 |
| 316 void SetUpSizing(const base::DictionaryValue& params); | 336 void SetUpSizing(const base::DictionaryValue& params); |
| 317 | 337 |
| 318 void StartTrackingEmbedderZoomLevel(); | 338 void StartTrackingEmbedderZoomLevel(); |
| 319 void StopTrackingEmbedderZoomLevel(); | 339 void StopTrackingEmbedderZoomLevel(); |
| 320 | 340 |
| 321 static void RegisterGuestViewTypes(); | 341 static void RegisterGuestViewTypes(); |
| 322 | 342 |
| 323 // WebContentsObserver implementation. | |
| 324 void DidStopLoading(content::RenderViewHost* render_view_host) final; | |
| 325 void RenderViewReady() final; | |
| 326 void WebContentsDestroyed() final; | |
| 327 | |
| 328 // WebContentsDelegate implementation. | |
| 329 void ActivateContents(content::WebContents* contents) final; | |
| 330 void DeactivateContents(content::WebContents* contents) final; | |
| 331 void ContentsZoomChange(bool zoom_in) override; | |
| 332 void HandleKeyboardEvent( | |
| 333 content::WebContents* source, | |
| 334 const content::NativeWebKeyboardEvent& event) override; | |
| 335 void RunFileChooser(content::WebContents* web_contents, | |
| 336 const content::FileChooserParams& params) override; | |
| 337 bool ShouldFocusPageAfterCrash() final; | |
| 338 bool PreHandleGestureEvent(content::WebContents* source, | |
| 339 const blink::WebGestureEvent& event) final; | |
| 340 void UpdatePreferredSize(content::WebContents* web_contents, | |
| 341 const gfx::Size& pref_size) final; | |
| 342 | |
| 343 // This guest tracks the lifetime of the WebContents specified by | 343 // This guest tracks the lifetime of the WebContents specified by |
| 344 // |owner_web_contents_|. If |owner_web_contents_| is destroyed then this | 344 // |owner_web_contents_|. If |owner_web_contents_| is destroyed then this |
| 345 // guest will also self-destruct. | 345 // guest will also self-destruct. |
| 346 content::WebContents* owner_web_contents_; | 346 content::WebContents* owner_web_contents_; |
| 347 std::string owner_extension_id_; | 347 std::string owner_extension_id_; |
| 348 content::BrowserContext* const browser_context_; | 348 content::BrowserContext* const browser_context_; |
| 349 | 349 |
| 350 // |guest_instance_id_| is a profile-wide unique identifier for a guest | 350 // |guest_instance_id_| is a profile-wide unique identifier for a guest |
| 351 // WebContents. | 351 // WebContents. |
| 352 const int guest_instance_id_; | 352 const int guest_instance_id_; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 // This is used to ensure pending tasks will not fire after this object is | 414 // This is used to ensure pending tasks will not fire after this object is |
| 415 // destroyed. | 415 // destroyed. |
| 416 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 416 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
| 417 | 417 |
| 418 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 418 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
| 419 }; | 419 }; |
| 420 | 420 |
| 421 } // namespace extensions | 421 } // namespace extensions |
| 422 | 422 |
| 423 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 423 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
| OLD | NEW |