| 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/view_android.h" | 16 #include "ui/android/view_android.h" | 
| 17 #include "ui/gfx/geometry/rect_f.h" | 17 #include "ui/gfx/geometry/rect_f.h" | 
| 18 | 18 | 
| 19 namespace content { | 19 namespace content { | 
| 20 class ContentViewCoreImpl; | 20 class ContentViewCoreImpl; | 
|  | 21 class RenderWidgetHostViewAndroid; | 
|  | 22 class SynchronousCompositorClient; | 
| 21 class WebContentsImpl; | 23 class WebContentsImpl; | 
| 22 | 24 | 
| 23 // Android-specific implementation of the WebContentsView. | 25 // Android-specific implementation of the WebContentsView. | 
| 24 class WebContentsViewAndroid : public WebContentsView, | 26 class WebContentsViewAndroid : public WebContentsView, | 
| 25                                public RenderViewHostDelegateView { | 27                                public RenderViewHostDelegateView { | 
| 26  public: | 28  public: | 
| 27   WebContentsViewAndroid(WebContentsImpl* web_contents, | 29   WebContentsViewAndroid(WebContentsImpl* web_contents, | 
| 28                          WebContentsViewDelegate* delegate); | 30                          WebContentsViewDelegate* delegate); | 
| 29   ~WebContentsViewAndroid() override; | 31   ~WebContentsViewAndroid() override; | 
| 30 | 32 | 
| 31   // Sets the interface to the view system. ContentViewCoreImpl is owned | 33   // Sets the interface to the view system. ContentViewCoreImpl is owned | 
| 32   // by its Java ContentViewCore counterpart, whose lifetime is managed | 34   // by its Java ContentViewCore counterpart, whose lifetime is managed | 
| 33   // by the UI frontend. | 35   // by the UI frontend. | 
| 34   void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 36   void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 
| 35 | 37 | 
|  | 38   void set_synchronous_compositor_client(SynchronousCompositorClient* client) { | 
|  | 39     synchronous_compositor_client_ = client; | 
|  | 40   } | 
|  | 41   SynchronousCompositorClient* synchronous_compositor_client() const { | 
|  | 42     return synchronous_compositor_client_; | 
|  | 43   } | 
|  | 44 | 
| 36   // WebContentsView implementation -------------------------------------------- | 45   // WebContentsView implementation -------------------------------------------- | 
| 37   gfx::NativeView GetNativeView() const override; | 46   gfx::NativeView GetNativeView() const override; | 
| 38   gfx::NativeView GetContentNativeView() const override; | 47   gfx::NativeView GetContentNativeView() const override; | 
| 39   gfx::NativeWindow GetTopLevelNativeWindow() const override; | 48   gfx::NativeWindow GetTopLevelNativeWindow() const override; | 
| 40   void GetScreenInfo(ScreenInfo* screen_info) const override; | 49   void GetScreenInfo(ScreenInfo* screen_info) const override; | 
| 41   void GetContainerBounds(gfx::Rect* out) const override; | 50   void GetContainerBounds(gfx::Rect* out) const override; | 
| 42   void SizeContents(const gfx::Size& size) override; | 51   void SizeContents(const gfx::Size& size) override; | 
| 43   void Focus() override; | 52   void Focus() override; | 
| 44   void SetInitialFocus() override; | 53   void SetInitialFocus() override; | 
| 45   void StoreFocus() override; | 54   void StoreFocus() override; | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 84                      const gfx::Point& screen_location); | 93                      const gfx::Point& screen_location); | 
| 85   void OnDragUpdated(const gfx::Point& location, | 94   void OnDragUpdated(const gfx::Point& location, | 
| 86                      const gfx::Point& screen_location); | 95                      const gfx::Point& screen_location); | 
| 87   void OnDragExited(); | 96   void OnDragExited(); | 
| 88   void OnPerformDrop(DropData* drop_data, | 97   void OnPerformDrop(DropData* drop_data, | 
| 89                      const gfx::Point& location, | 98                      const gfx::Point& location, | 
| 90                      const gfx::Point& screen_location); | 99                      const gfx::Point& screen_location); | 
| 91   void OnDragEnded(); | 100   void OnDragEnded(); | 
| 92 | 101 | 
| 93  private: | 102  private: | 
|  | 103   void SetSynchronousCompositorClientFor(RenderWidgetHostViewAndroid* rwhv); | 
|  | 104 | 
| 94   // The WebContents whose contents we display. | 105   // The WebContents whose contents we display. | 
| 95   WebContentsImpl* web_contents_; | 106   WebContentsImpl* web_contents_; | 
| 96 | 107 | 
| 97   // ContentViewCoreImpl is our interface to the view system. | 108   // ContentViewCoreImpl is our interface to the view system. | 
| 98   ContentViewCoreImpl* content_view_core_; | 109   ContentViewCoreImpl* content_view_core_; | 
| 99 | 110 | 
| 100   // Interface for extensions to WebContentsView. Used to show the context menu. | 111   // Interface for extensions to WebContentsView. Used to show the context menu. | 
| 101   std::unique_ptr<WebContentsViewDelegate> delegate_; | 112   std::unique_ptr<WebContentsViewDelegate> delegate_; | 
| 102 | 113 | 
| 103   // The native view associated with the contents of the web. | 114   // The native view associated with the contents of the web. | 
| 104   ui::ViewAndroid view_; | 115   ui::ViewAndroid view_; | 
| 105 | 116 | 
|  | 117   // Interface used to get notified of events from the synchronous compositor. | 
|  | 118   SynchronousCompositorClient* synchronous_compositor_client_; | 
|  | 119 | 
| 106   DISALLOW_COPY_AND_ASSIGN(WebContentsViewAndroid); | 120   DISALLOW_COPY_AND_ASSIGN(WebContentsViewAndroid); | 
| 107 }; | 121 }; | 
| 108 | 122 | 
| 109 } // namespace content | 123 } // namespace content | 
| 110 | 124 | 
| 111 #endif  // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_ANDROID_H_ | 125 #endif  // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_ANDROID_H_ | 
| OLD | NEW | 
|---|