| 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 COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ | 5 #ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ |
| 6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ | 6 #define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <queue> | 9 #include <queue> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "components/guest_view/common/guest_view_constants.h" | 14 #include "components/guest_view/common/guest_view_constants.h" |
| 15 #include "components/ui/zoom/zoom_observer.h" | 15 #include "components/zoom/zoom_observer.h" |
| 16 #include "content/public/browser/browser_plugin_guest_delegate.h" | 16 #include "content/public/browser/browser_plugin_guest_delegate.h" |
| 17 #include "content/public/browser/guest_host.h" | 17 #include "content/public/browser/guest_host.h" |
| 18 #include "content/public/browser/render_process_host_observer.h" | 18 #include "content/public/browser/render_process_host_observer.h" |
| 19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 #include "content/public/browser/web_contents_delegate.h" | 20 #include "content/public/browser/web_contents_delegate.h" |
| 21 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
| 22 | 22 |
| 23 struct RendererContentSettingRules; | 23 struct RendererContentSettingRules; |
| 24 | 24 |
| 25 namespace guest_view { | 25 namespace guest_view { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 44 | 44 |
| 45 // A GuestViewBase is the base class browser-side API implementation for a | 45 // A GuestViewBase is the base class browser-side API implementation for a |
| 46 // <*view> tag. GuestViewBase maintains an association between a guest | 46 // <*view> tag. GuestViewBase maintains an association between a guest |
| 47 // WebContents and an owner WebContents. It receives events issued from | 47 // WebContents and an owner WebContents. It receives events issued from |
| 48 // the guest and relays them to the owner. GuestViewBase tracks the lifetime | 48 // the guest and relays them to the owner. GuestViewBase tracks the lifetime |
| 49 // of its owner. A GuestViewBase's owner is referred to as an embedder if | 49 // of its owner. A GuestViewBase's owner is referred to as an embedder if |
| 50 // it is attached to a container within the owner's WebContents. | 50 // it is attached to a container within the owner's WebContents. |
| 51 class GuestViewBase : public content::BrowserPluginGuestDelegate, | 51 class GuestViewBase : public content::BrowserPluginGuestDelegate, |
| 52 public content::WebContentsDelegate, | 52 public content::WebContentsDelegate, |
| 53 public content::WebContentsObserver, | 53 public content::WebContentsObserver, |
| 54 public ui_zoom::ZoomObserver { | 54 public zoom::ZoomObserver { |
| 55 public: | 55 public: |
| 56 // Returns a *ViewGuest if this GuestView is of the given view type. | 56 // Returns a *ViewGuest if this GuestView is of the given view type. |
| 57 template <typename T> | 57 template <typename T> |
| 58 T* As() { | 58 T* As() { |
| 59 if (IsViewType(T::Type)) | 59 if (IsViewType(T::Type)) |
| 60 return static_cast<T*>(this); | 60 return static_cast<T*>(this); |
| 61 | 61 |
| 62 return nullptr; | 62 return nullptr; |
| 63 } | 63 } |
| 64 | 64 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 void UpdateTargetURL(content::WebContents* source, const GURL& url) final; | 372 void UpdateTargetURL(content::WebContents* source, const GURL& url) final; |
| 373 bool ShouldResumeRequestsForCreatedWindow() final; | 373 bool ShouldResumeRequestsForCreatedWindow() final; |
| 374 | 374 |
| 375 // WebContentsObserver implementation. | 375 // WebContentsObserver implementation. |
| 376 void DidStopLoading() final; | 376 void DidStopLoading() final; |
| 377 void RenderViewReady() final; | 377 void RenderViewReady() final; |
| 378 void WebContentsDestroyed() final; | 378 void WebContentsDestroyed() final; |
| 379 | 379 |
| 380 // ui_zoom::ZoomObserver implementation. | 380 // ui_zoom::ZoomObserver implementation. |
| 381 void OnZoomChanged( | 381 void OnZoomChanged( |
| 382 const ui_zoom::ZoomController::ZoomChangedEventData& data) final; | 382 const zoom::ZoomController::ZoomChangedEventData& data) final; |
| 383 | 383 |
| 384 void SendQueuedEvents(); | 384 void SendQueuedEvents(); |
| 385 | 385 |
| 386 void CompleteInit(std::unique_ptr<base::DictionaryValue> create_params, | 386 void CompleteInit(std::unique_ptr<base::DictionaryValue> create_params, |
| 387 const WebContentsCreatedCallback& callback, | 387 const WebContentsCreatedCallback& callback, |
| 388 content::WebContents* guest_web_contents); | 388 content::WebContents* guest_web_contents); |
| 389 | 389 |
| 390 // Dispatches the onResize event to the embedder. | 390 // Dispatches the onResize event to the embedder. |
| 391 void DispatchOnResizeEvent(const gfx::Size& old_size, | 391 void DispatchOnResizeEvent(const gfx::Size& old_size, |
| 392 const gfx::Size& new_size); | 392 const gfx::Size& new_size); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 // This is used to ensure pending tasks will not fire after this object is | 479 // This is used to ensure pending tasks will not fire after this object is |
| 480 // destroyed. | 480 // destroyed. |
| 481 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 481 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
| 482 | 482 |
| 483 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 483 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
| 484 }; | 484 }; |
| 485 | 485 |
| 486 } // namespace guest_view | 486 } // namespace guest_view |
| 487 | 487 |
| 488 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ | 488 #endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_ |
| OLD | NEW |