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_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_ANDROID_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_ANDROID_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_ANDROID_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 9 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
10 #include "content/browser/web_contents/web_contents_view.h" | 10 #include "content/browser/web_contents/web_contents_view.h" |
11 #include "content/public/browser/web_contents_view_delegate.h" | 11 #include "content/public/browser/web_contents_view_delegate.h" |
12 #include "content/public/common/context_menu_params.h" | 12 #include "content/public/common/context_menu_params.h" |
13 #include "ui/gfx/geometry/rect_f.h" | 13 #include "ui/gfx/geometry/rect_f.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 class ContentViewCoreImpl; | 16 class ContentViewCoreImpl; |
17 class WebContentsImpl; | 17 class WebContentsImpl; |
18 | 18 |
19 // Android-specific implementation of the WebContentsView. | 19 // Android-specific implementation of the WebContentsView. |
20 class WebContentsViewAndroid : public WebContentsView, | 20 class WebContentsViewAndroid : public WebContentsView, |
21 public RenderViewHostDelegateView { | 21 public RenderViewHostDelegateView { |
22 public: | 22 public: |
23 WebContentsViewAndroid(WebContentsImpl* web_contents, | 23 WebContentsViewAndroid(WebContentsImpl* web_contents, |
24 WebContentsViewDelegate* delegate); | 24 WebContentsViewDelegate* delegate); |
25 virtual ~WebContentsViewAndroid(); | 25 ~WebContentsViewAndroid() override; |
26 | 26 |
27 // Sets the interface to the view system. ContentViewCoreImpl is owned | 27 // Sets the interface to the view system. ContentViewCoreImpl is owned |
28 // by its Java ContentViewCore counterpart, whose lifetime is managed | 28 // by its Java ContentViewCore counterpart, whose lifetime is managed |
29 // by the UI frontend. | 29 // by the UI frontend. |
30 void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 30 void SetContentViewCore(ContentViewCoreImpl* content_view_core); |
31 | 31 |
32 // WebContentsView implementation -------------------------------------------- | 32 // WebContentsView implementation -------------------------------------------- |
33 virtual gfx::NativeView GetNativeView() const override; | 33 gfx::NativeView GetNativeView() const override; |
34 virtual gfx::NativeView GetContentNativeView() const override; | 34 gfx::NativeView GetContentNativeView() const override; |
35 virtual gfx::NativeWindow GetTopLevelNativeWindow() const override; | 35 gfx::NativeWindow GetTopLevelNativeWindow() const override; |
36 virtual void GetContainerBounds(gfx::Rect* out) const override; | 36 void GetContainerBounds(gfx::Rect* out) const override; |
37 virtual void SizeContents(const gfx::Size& size) override; | 37 void SizeContents(const gfx::Size& size) override; |
38 virtual void Focus() override; | 38 void Focus() override; |
39 virtual void SetInitialFocus() override; | 39 void SetInitialFocus() override; |
40 virtual void StoreFocus() override; | 40 void StoreFocus() override; |
41 virtual void RestoreFocus() override; | 41 void RestoreFocus() override; |
42 virtual DropData* GetDropData() const override; | 42 DropData* GetDropData() const override; |
43 virtual gfx::Rect GetViewBounds() const override; | 43 gfx::Rect GetViewBounds() const override; |
44 virtual void CreateView( | 44 void CreateView(const gfx::Size& initial_size, |
45 const gfx::Size& initial_size, gfx::NativeView context) override; | 45 gfx::NativeView context) override; |
46 virtual RenderWidgetHostViewBase* CreateViewForWidget( | 46 RenderWidgetHostViewBase* CreateViewForWidget( |
47 RenderWidgetHost* render_widget_host, bool is_guest_view_hack) override; | 47 RenderWidgetHost* render_widget_host, |
48 virtual RenderWidgetHostViewBase* CreateViewForPopupWidget( | 48 bool is_guest_view_hack) override; |
| 49 RenderWidgetHostViewBase* CreateViewForPopupWidget( |
49 RenderWidgetHost* render_widget_host) override; | 50 RenderWidgetHost* render_widget_host) override; |
50 virtual void SetPageTitle(const base::string16& title) override; | 51 void SetPageTitle(const base::string16& title) override; |
51 virtual void RenderViewCreated(RenderViewHost* host) override; | 52 void RenderViewCreated(RenderViewHost* host) override; |
52 virtual void RenderViewSwappedIn(RenderViewHost* host) override; | 53 void RenderViewSwappedIn(RenderViewHost* host) override; |
53 virtual void SetOverscrollControllerEnabled(bool enabled) override; | 54 void SetOverscrollControllerEnabled(bool enabled) override; |
54 | 55 |
55 // Backend implementation of RenderViewHostDelegateView. | 56 // Backend implementation of RenderViewHostDelegateView. |
56 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, | 57 void ShowContextMenu(RenderFrameHost* render_frame_host, |
57 const ContextMenuParams& params) override; | 58 const ContextMenuParams& params) override; |
58 virtual void ShowPopupMenu(RenderFrameHost* render_frame_host, | 59 void ShowPopupMenu(RenderFrameHost* render_frame_host, |
59 const gfx::Rect& bounds, | 60 const gfx::Rect& bounds, |
60 int item_height, | 61 int item_height, |
61 double item_font_size, | 62 double item_font_size, |
62 int selected_item, | 63 int selected_item, |
63 const std::vector<MenuItem>& items, | 64 const std::vector<MenuItem>& items, |
64 bool right_aligned, | 65 bool right_aligned, |
65 bool allow_multiple_selection) override; | 66 bool allow_multiple_selection) override; |
66 virtual void HidePopupMenu() override; | 67 void HidePopupMenu() override; |
67 virtual void StartDragging(const DropData& drop_data, | 68 void StartDragging(const DropData& drop_data, |
68 blink::WebDragOperationsMask allowed_ops, | 69 blink::WebDragOperationsMask allowed_ops, |
69 const gfx::ImageSkia& image, | 70 const gfx::ImageSkia& image, |
70 const gfx::Vector2d& image_offset, | 71 const gfx::Vector2d& image_offset, |
71 const DragEventSourceInfo& event_info) override; | 72 const DragEventSourceInfo& event_info) override; |
72 virtual void UpdateDragCursor(blink::WebDragOperation operation) override; | 73 void UpdateDragCursor(blink::WebDragOperation operation) override; |
73 virtual void GotFocus() override; | 74 void GotFocus() override; |
74 virtual void TakeFocus(bool reverse) override; | 75 void TakeFocus(bool reverse) override; |
75 | 76 |
76 private: | 77 private: |
77 // The WebContents whose contents we display. | 78 // The WebContents whose contents we display. |
78 WebContentsImpl* web_contents_; | 79 WebContentsImpl* web_contents_; |
79 | 80 |
80 // ContentViewCoreImpl is our interface to the view system. | 81 // ContentViewCoreImpl is our interface to the view system. |
81 ContentViewCoreImpl* content_view_core_; | 82 ContentViewCoreImpl* content_view_core_; |
82 | 83 |
83 // Interface for extensions to WebContentsView. Used to show the context menu. | 84 // Interface for extensions to WebContentsView. Used to show the context menu. |
84 scoped_ptr<WebContentsViewDelegate> delegate_; | 85 scoped_ptr<WebContentsViewDelegate> delegate_; |
85 | 86 |
86 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAndroid); | 87 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAndroid); |
87 }; | 88 }; |
88 | 89 |
89 } // namespace content | 90 } // namespace content |
90 | 91 |
91 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_ANDROID_H_ | 92 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_ANDROID_H_ |
OLD | NEW |