| 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 CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GUEST_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GUEST_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GUEST_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GUEST_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 public: | 24 public: |
| 25 // The corresponding WebContentsImpl is passed in the constructor, and manages | 25 // The corresponding WebContentsImpl is passed in the constructor, and manages |
| 26 // our lifetime. This doesn't need to be the case, but is this way currently | 26 // our lifetime. This doesn't need to be the case, but is this way currently |
| 27 // because that's what was easiest when they were split. | 27 // because that's what was easiest when they were split. |
| 28 // WebContentsViewGuest always has a backing platform dependent view, | 28 // WebContentsViewGuest always has a backing platform dependent view, |
| 29 // |platform_view|. | 29 // |platform_view|. |
| 30 WebContentsViewGuest(WebContentsImpl* web_contents, | 30 WebContentsViewGuest(WebContentsImpl* web_contents, |
| 31 BrowserPluginGuest* guest, | 31 BrowserPluginGuest* guest, |
| 32 scoped_ptr<WebContentsView> platform_view, | 32 scoped_ptr<WebContentsView> platform_view, |
| 33 RenderViewHostDelegateView* platform_view_delegate_view); | 33 RenderViewHostDelegateView* platform_view_delegate_view); |
| 34 virtual ~WebContentsViewGuest(); | 34 ~WebContentsViewGuest() override; |
| 35 | 35 |
| 36 WebContents* web_contents(); | 36 WebContents* web_contents(); |
| 37 | 37 |
| 38 void OnGuestAttached(WebContentsView* parent_view); | 38 void OnGuestAttached(WebContentsView* parent_view); |
| 39 | 39 |
| 40 void OnGuestDetached(WebContentsView* old_parent_view); | 40 void OnGuestDetached(WebContentsView* old_parent_view); |
| 41 | 41 |
| 42 // Converts the guest specific coordinates in |params| to embedder specific | 42 // Converts the guest specific coordinates in |params| to embedder specific |
| 43 // ones. | 43 // ones. |
| 44 ContextMenuParams ConvertContextMenuParams( | 44 ContextMenuParams ConvertContextMenuParams( |
| 45 const ContextMenuParams& params) const; | 45 const ContextMenuParams& params) const; |
| 46 | 46 |
| 47 // WebContentsView implementation -------------------------------------------- | 47 // WebContentsView implementation -------------------------------------------- |
| 48 virtual gfx::NativeView GetNativeView() const override; | 48 gfx::NativeView GetNativeView() const override; |
| 49 virtual gfx::NativeView GetContentNativeView() const override; | 49 gfx::NativeView GetContentNativeView() const override; |
| 50 virtual gfx::NativeWindow GetTopLevelNativeWindow() const override; | 50 gfx::NativeWindow GetTopLevelNativeWindow() const override; |
| 51 virtual void GetContainerBounds(gfx::Rect* out) const override; | 51 void GetContainerBounds(gfx::Rect* out) const override; |
| 52 virtual void SizeContents(const gfx::Size& size) override; | 52 void SizeContents(const gfx::Size& size) override; |
| 53 virtual void Focus() override; | 53 void Focus() override; |
| 54 virtual void SetInitialFocus() override; | 54 void SetInitialFocus() override; |
| 55 virtual void StoreFocus() override; | 55 void StoreFocus() override; |
| 56 virtual void RestoreFocus() override; | 56 void RestoreFocus() override; |
| 57 virtual DropData* GetDropData() const override; | 57 DropData* GetDropData() const override; |
| 58 virtual gfx::Rect GetViewBounds() const override; | 58 gfx::Rect GetViewBounds() const override; |
| 59 virtual void CreateView(const gfx::Size& initial_size, | 59 void CreateView(const gfx::Size& initial_size, |
| 60 gfx::NativeView context) override; | 60 gfx::NativeView context) override; |
| 61 virtual RenderWidgetHostViewBase* CreateViewForWidget( | 61 RenderWidgetHostViewBase* CreateViewForWidget( |
| 62 RenderWidgetHost* render_widget_host, bool is_guest_view_hack) override; | 62 RenderWidgetHost* render_widget_host, |
| 63 virtual RenderWidgetHostViewBase* CreateViewForPopupWidget( | 63 bool is_guest_view_hack) override; |
| 64 RenderWidgetHostViewBase* CreateViewForPopupWidget( |
| 64 RenderWidgetHost* render_widget_host) override; | 65 RenderWidgetHost* render_widget_host) override; |
| 65 virtual void SetPageTitle(const base::string16& title) override; | 66 void SetPageTitle(const base::string16& title) override; |
| 66 virtual void RenderViewCreated(RenderViewHost* host) override; | 67 void RenderViewCreated(RenderViewHost* host) override; |
| 67 virtual void RenderViewSwappedIn(RenderViewHost* host) override; | 68 void RenderViewSwappedIn(RenderViewHost* host) override; |
| 68 virtual void SetOverscrollControllerEnabled(bool enabled) override; | 69 void SetOverscrollControllerEnabled(bool enabled) override; |
| 69 #if defined(OS_MACOSX) | 70 #if defined(OS_MACOSX) |
| 70 virtual void SetAllowOtherViews(bool allow) override; | 71 void SetAllowOtherViews(bool allow) override; |
| 71 virtual bool GetAllowOtherViews() const override; | 72 bool GetAllowOtherViews() const override; |
| 72 virtual bool IsEventTracking() const override; | 73 bool IsEventTracking() const override; |
| 73 virtual void CloseTabAfterEventTracking() override; | 74 void CloseTabAfterEventTracking() override; |
| 74 #endif | 75 #endif |
| 75 | 76 |
| 76 // Backend implementation of RenderViewHostDelegateView. | 77 // Backend implementation of RenderViewHostDelegateView. |
| 77 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, | 78 void ShowContextMenu(RenderFrameHost* render_frame_host, |
| 78 const ContextMenuParams& params) override; | 79 const ContextMenuParams& params) override; |
| 79 virtual void StartDragging(const DropData& drop_data, | 80 void StartDragging(const DropData& drop_data, |
| 80 blink::WebDragOperationsMask allowed_ops, | 81 blink::WebDragOperationsMask allowed_ops, |
| 81 const gfx::ImageSkia& image, | 82 const gfx::ImageSkia& image, |
| 82 const gfx::Vector2d& image_offset, | 83 const gfx::Vector2d& image_offset, |
| 83 const DragEventSourceInfo& event_info) override; | 84 const DragEventSourceInfo& event_info) override; |
| 84 virtual void UpdateDragCursor(blink::WebDragOperation operation) override; | 85 void UpdateDragCursor(blink::WebDragOperation operation) override; |
| 85 virtual void GotFocus() override; | 86 void GotFocus() override; |
| 86 virtual void TakeFocus(bool reverse) override; | 87 void TakeFocus(bool reverse) override; |
| 87 | 88 |
| 88 private: | 89 private: |
| 89 // The WebContentsImpl whose contents we display. | 90 // The WebContentsImpl whose contents we display. |
| 90 WebContentsImpl* web_contents_; | 91 WebContentsImpl* web_contents_; |
| 91 BrowserPluginGuest* guest_; | 92 BrowserPluginGuest* guest_; |
| 92 // The platform dependent view backing this WebContentsView. | 93 // The platform dependent view backing this WebContentsView. |
| 93 // Calls to this WebContentsViewGuest are forwarded to |platform_view_|. | 94 // Calls to this WebContentsViewGuest are forwarded to |platform_view_|. |
| 94 scoped_ptr<WebContentsView> platform_view_; | 95 scoped_ptr<WebContentsView> platform_view_; |
| 95 gfx::Size size_; | 96 gfx::Size size_; |
| 96 | 97 |
| 97 // Delegate view for guest's platform view. | 98 // Delegate view for guest's platform view. |
| 98 RenderViewHostDelegateView* platform_view_delegate_view_; | 99 RenderViewHostDelegateView* platform_view_delegate_view_; |
| 99 | 100 |
| 100 DISALLOW_COPY_AND_ASSIGN(WebContentsViewGuest); | 101 DISALLOW_COPY_AND_ASSIGN(WebContentsViewGuest); |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 } // namespace content | 104 } // namespace content |
| 104 | 105 |
| 105 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GUEST_H_ | 106 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_GUEST_H_ |
| OLD | NEW |