Chromium Code Reviews| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 11 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
| 12 #include "content/browser/web_contents/web_contents_view.h" | 12 #include "content/browser/web_contents/web_contents_view.h" |
| 13 #include "content/public/browser/web_contents_view_delegate.h" | 13 #include "content/public/browser/web_contents_view_delegate.h" |
| 14 #include "content/public/common/context_menu_params.h" | 14 #include "content/public/common/context_menu_params.h" |
| 15 #include "content/public/common/drop_data.h" | 15 #include "content/public/common/drop_data.h" |
| 16 #include "ui/android/overscroll_refresh.h" | |
| 16 #include "ui/android/view_android.h" | 17 #include "ui/android/view_android.h" |
| 17 #include "ui/gfx/geometry/rect_f.h" | 18 #include "ui/gfx/geometry/rect_f.h" |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 class ContentViewCoreImpl; | 21 class ContentViewCoreImpl; |
| 21 class SynchronousCompositorClient; | 22 class SynchronousCompositorClient; |
| 22 class WebContentsImpl; | 23 class WebContentsImpl; |
| 23 | 24 |
| 24 // Android-specific implementation of the WebContentsView. | 25 // Android-specific implementation of the WebContentsView. |
| 25 class WebContentsViewAndroid : public WebContentsView, | 26 class WebContentsViewAndroid : public WebContentsView, |
| 26 public RenderViewHostDelegateView { | 27 public RenderViewHostDelegateView { |
| 27 public: | 28 public: |
| 28 WebContentsViewAndroid(WebContentsImpl* web_contents, | 29 WebContentsViewAndroid(WebContentsImpl* web_contents, |
| 29 WebContentsViewDelegate* delegate); | 30 WebContentsViewDelegate* delegate); |
| 30 ~WebContentsViewAndroid() override; | 31 ~WebContentsViewAndroid() override; |
| 31 | 32 |
| 32 // Sets the interface to the view system. ContentViewCoreImpl is owned | 33 // Sets the interface to the view system. ContentViewCoreImpl is owned |
| 33 // by its Java ContentViewCore counterpart, whose lifetime is managed | 34 // by its Java ContentViewCore counterpart, whose lifetime is managed |
| 34 // by the UI frontend. | 35 // by the UI frontend. |
| 35 void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 36 void SetContentViewCore(ContentViewCoreImpl* content_view_core); |
| 36 | 37 |
| 37 void set_synchronous_compositor_client(SynchronousCompositorClient* client) { | 38 void set_synchronous_compositor_client(SynchronousCompositorClient* client) { |
| 38 synchronous_compositor_client_ = client; | 39 synchronous_compositor_client_ = client; |
| 39 } | 40 } |
| 40 | 41 |
| 41 SynchronousCompositorClient* synchronous_compositor_client() const { | 42 SynchronousCompositorClient* synchronous_compositor_client() const { |
| 42 return synchronous_compositor_client_; | 43 return synchronous_compositor_client_; |
| 43 } | 44 } |
| 44 | 45 |
| 46 void SetOverscrollRefreshHandler( | |
| 47 std::unique_ptr<ui::OverscrollRefreshHandler> overscroll_refresh_handler); | |
| 48 | |
| 49 ui::OverscrollRefreshHandler* GetOverscrollRefreshHandler() const override; | |
|
boliu
2016/12/03 01:05:28
Move this next to the other RenderViewHostDelegate
rlanday
2016/12/05 19:53:56
Ok
| |
| 50 | |
| 45 // WebContentsView implementation -------------------------------------------- | 51 // WebContentsView implementation -------------------------------------------- |
| 46 gfx::NativeView GetNativeView() const override; | 52 gfx::NativeView GetNativeView() const override; |
| 47 gfx::NativeView GetContentNativeView() const override; | 53 gfx::NativeView GetContentNativeView() const override; |
| 48 gfx::NativeWindow GetTopLevelNativeWindow() const override; | 54 gfx::NativeWindow GetTopLevelNativeWindow() const override; |
| 49 void GetScreenInfo(ScreenInfo* screen_info) const override; | 55 void GetScreenInfo(ScreenInfo* screen_info) const override; |
| 50 void GetContainerBounds(gfx::Rect* out) const override; | 56 void GetContainerBounds(gfx::Rect* out) const override; |
| 51 void SizeContents(const gfx::Size& size) override; | 57 void SizeContents(const gfx::Size& size) override; |
| 52 void Focus() override; | 58 void Focus() override; |
| 53 void SetInitialFocus() override; | 59 void SetInitialFocus() override; |
| 54 void StoreFocus() override; | 60 void StoreFocus() override; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 const gfx::Point& screen_location); | 106 const gfx::Point& screen_location); |
| 101 void OnDragEnded(); | 107 void OnDragEnded(); |
| 102 | 108 |
| 103 private: | 109 private: |
| 104 // The WebContents whose contents we display. | 110 // The WebContents whose contents we display. |
| 105 WebContentsImpl* web_contents_; | 111 WebContentsImpl* web_contents_; |
| 106 | 112 |
| 107 // ContentViewCoreImpl is our interface to the view system. | 113 // ContentViewCoreImpl is our interface to the view system. |
| 108 ContentViewCoreImpl* content_view_core_; | 114 ContentViewCoreImpl* content_view_core_; |
| 109 | 115 |
| 116 // Handles "overscroll to refresh" events | |
| 117 std::unique_ptr<ui::OverscrollRefreshHandler> overscroll_refresh_handler_; | |
| 118 | |
| 110 // Interface for extensions to WebContentsView. Used to show the context menu. | 119 // Interface for extensions to WebContentsView. Used to show the context menu. |
| 111 std::unique_ptr<WebContentsViewDelegate> delegate_; | 120 std::unique_ptr<WebContentsViewDelegate> delegate_; |
| 112 | 121 |
| 113 // The native view associated with the contents of the web. | 122 // The native view associated with the contents of the web. |
| 114 ui::ViewAndroid view_; | 123 ui::ViewAndroid view_; |
| 115 | 124 |
| 116 // Interface used to get notified of events from the synchronous compositor. | 125 // Interface used to get notified of events from the synchronous compositor. |
| 117 SynchronousCompositorClient* synchronous_compositor_client_; | 126 SynchronousCompositorClient* synchronous_compositor_client_; |
| 118 | 127 |
| 119 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAndroid); | 128 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAndroid); |
| 120 }; | 129 }; |
| 121 | 130 |
| 122 } // namespace content | 131 } // namespace content |
| 123 | 132 |
| 124 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_ANDROID_H_ | 133 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_ANDROID_H_ |
| OLD | NEW |