| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // This gives the derived class an opportunity to perform some cleanup. | 117 // This gives the derived class an opportunity to perform some cleanup. |
| 118 virtual void GuestDestroyed() {} | 118 virtual void GuestDestroyed() {} |
| 119 | 119 |
| 120 // This method is invoked when the guest RenderView is ready, e.g. because we | 120 // This method is invoked when the guest RenderView is ready, e.g. because we |
| 121 // recreated it after a crash or after reattachment. | 121 // recreated it after a crash or after reattachment. |
| 122 // | 122 // |
| 123 // This gives the derived class an opportunity to perform some initialization | 123 // This gives the derived class an opportunity to perform some initialization |
| 124 // work. | 124 // work. |
| 125 virtual void GuestReady() {} | 125 virtual void GuestReady() {} |
| 126 | 126 |
| 127 // This method is called when embedder WebContents's fullscreen is toggled. |
| 128 // |
| 129 // If the guest asked the embedder to enter fullscreen, the guest uses this |
| 130 // signal to exit fullscreen state. |
| 131 virtual void EmbedderFullscreenToggled(bool entered_fullscreen) {} |
| 132 |
| 127 // This method is invoked when the contents auto-resized to give the container | 133 // This method is invoked when the contents auto-resized to give the container |
| 128 // an opportunity to match it if it wishes. | 134 // an opportunity to match it if it wishes. |
| 129 // | 135 // |
| 130 // This gives the derived class an opportunity to inform its container element | 136 // This gives the derived class an opportunity to inform its container element |
| 131 // or perform other actions. | 137 // or perform other actions. |
| 132 virtual void GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, | 138 virtual void GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, |
| 133 const gfx::Size& new_size) {} | 139 const gfx::Size& new_size) {} |
| 134 | 140 |
| 135 // This method queries whether autosize is supported for this particular view. | 141 // This method queries whether autosize is supported for this particular view. |
| 136 // By default, autosize is not supported. Derived classes can override this | 142 // By default, autosize is not supported. Derived classes can override this |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 void RunFileChooser(content::WebContents* web_contents, | 346 void RunFileChooser(content::WebContents* web_contents, |
| 341 const content::FileChooserParams& params) override; | 347 const content::FileChooserParams& params) override; |
| 342 bool ShouldFocusPageAfterCrash() final; | 348 bool ShouldFocusPageAfterCrash() final; |
| 343 bool PreHandleGestureEvent(content::WebContents* source, | 349 bool PreHandleGestureEvent(content::WebContents* source, |
| 344 const blink::WebGestureEvent& event) override; | 350 const blink::WebGestureEvent& event) override; |
| 345 void UpdatePreferredSize(content::WebContents* web_contents, | 351 void UpdatePreferredSize(content::WebContents* web_contents, |
| 346 const gfx::Size& pref_size) final; | 352 const gfx::Size& pref_size) final; |
| 347 void UpdateTargetURL(content::WebContents* source, const GURL& url) override; | 353 void UpdateTargetURL(content::WebContents* source, const GURL& url) override; |
| 348 | 354 |
| 349 private: | 355 private: |
| 350 class OwnerLifetimeObserver; | 356 class OwnerContentsObserver; |
| 351 | 357 |
| 352 class OpenerLifetimeObserver; | 358 class OpenerLifetimeObserver; |
| 353 | 359 |
| 354 void DispatchEvent(Event* event, int instance_id); | 360 void DispatchEvent(Event* event, int instance_id); |
| 355 | 361 |
| 356 void SendQueuedEvents(); | 362 void SendQueuedEvents(); |
| 357 | 363 |
| 358 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, | 364 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, |
| 359 const WebContentsCreatedCallback& callback, | 365 const WebContentsCreatedCallback& callback, |
| 360 content::WebContents* guest_web_contents); | 366 content::WebContents* guest_web_contents); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 base::WeakPtr<GuestViewBase> opener_; | 413 base::WeakPtr<GuestViewBase> opener_; |
| 408 | 414 |
| 409 // The parameters associated with the element hosting this GuestView that | 415 // The parameters associated with the element hosting this GuestView that |
| 410 // are passed in from JavaScript. This will typically be the view instance ID, | 416 // are passed in from JavaScript. This will typically be the view instance ID, |
| 411 // and element-specific parameters. These parameters are passed along to new | 417 // and element-specific parameters. These parameters are passed along to new |
| 412 // guests that are created from this guest. | 418 // guests that are created from this guest. |
| 413 scoped_ptr<base::DictionaryValue> attach_params_; | 419 scoped_ptr<base::DictionaryValue> attach_params_; |
| 414 | 420 |
| 415 // This observer ensures that this guest self-destructs if the embedder goes | 421 // This observer ensures that this guest self-destructs if the embedder goes |
| 416 // away. | 422 // away. |
| 417 scoped_ptr<OwnerLifetimeObserver> owner_lifetime_observer_; | 423 scoped_ptr<OwnerContentsObserver> owner_contents_observer_; |
| 418 | 424 |
| 419 // This observer ensures that if the guest is unattached and its opener goes | 425 // This observer ensures that if the guest is unattached and its opener goes |
| 420 // away then this guest also self-destructs. | 426 // away then this guest also self-destructs. |
| 421 scoped_ptr<OpenerLifetimeObserver> opener_lifetime_observer_; | 427 scoped_ptr<OpenerLifetimeObserver> opener_lifetime_observer_; |
| 422 | 428 |
| 423 // The size of the guest content. Note: In autosize mode, the container | 429 // The size of the guest content. Note: In autosize mode, the container |
| 424 // element may not match the size of the guest. | 430 // element may not match the size of the guest. |
| 425 gfx::Size guest_size_; | 431 gfx::Size guest_size_; |
| 426 | 432 |
| 427 // A pointer to the guest_host. | 433 // A pointer to the guest_host. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 448 // This is used to ensure pending tasks will not fire after this object is | 454 // This is used to ensure pending tasks will not fire after this object is |
| 449 // destroyed. | 455 // destroyed. |
| 450 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 456 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
| 451 | 457 |
| 452 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 458 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
| 453 }; | 459 }; |
| 454 | 460 |
| 455 } // namespace extensions | 461 } // namespace extensions |
| 456 | 462 |
| 457 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 463 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
| OLD | NEW |