| 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 ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/web_contents_observer.h" | 8 #include "content/public/browser/web_contents_observer.h" |
| 9 | 9 |
| 10 #include "android_webview/common/aw_hit_test_data.h" | 10 #include "android_webview/common/aw_hit_test_data.h" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/threading/non_thread_safe.h" | 13 #include "base/sequence_checker.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 15 #include "ui/gfx/geometry/point_f.h" | 15 #include "ui/gfx/geometry/point_f.h" |
| 16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
| 17 #include "ui/gfx/geometry/size_f.h" | 17 #include "ui/gfx/geometry/size_f.h" |
| 18 | 18 |
| 19 namespace android_webview { | 19 namespace android_webview { |
| 20 | 20 |
| 21 class AwRenderViewHostExtClient { | 21 class AwRenderViewHostExtClient { |
| 22 public: | 22 public: |
| 23 // Called when the RenderView page scale changes. | 23 // Called when the RenderView page scale changes. |
| 24 virtual void OnWebLayoutPageScaleFactorChanged(float page_scale_factor) = 0; | 24 virtual void OnWebLayoutPageScaleFactorChanged(float page_scale_factor) = 0; |
| 25 virtual void OnWebLayoutContentsSizeChanged( | 25 virtual void OnWebLayoutContentsSizeChanged( |
| 26 const gfx::Size& contents_size) = 0; | 26 const gfx::Size& contents_size) = 0; |
| 27 | 27 |
| 28 protected: | 28 protected: |
| 29 virtual ~AwRenderViewHostExtClient() {} | 29 virtual ~AwRenderViewHostExtClient() {} |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 // Provides RenderViewHost wrapper functionality for sending WebView-specific | 32 // Provides RenderViewHost wrapper functionality for sending WebView-specific |
| 33 // IPC messages to the renderer and from there to WebKit. | 33 // IPC messages to the renderer and from there to WebKit. |
| 34 class AwRenderViewHostExt : public content::WebContentsObserver, | 34 class AwRenderViewHostExt : public content::WebContentsObserver { |
| 35 public base::NonThreadSafe { | |
| 36 public: | 35 public: |
| 37 | 36 |
| 38 // To send receive messages to a RenderView we take the WebContents instance, | 37 // To send receive messages to a RenderView we take the WebContents instance, |
| 39 // as it internally handles RenderViewHost instances changing underneath us. | 38 // as it internally handles RenderViewHost instances changing underneath us. |
| 40 AwRenderViewHostExt( | 39 AwRenderViewHostExt( |
| 41 AwRenderViewHostExtClient* client, content::WebContents* contents); | 40 AwRenderViewHostExtClient* client, content::WebContents* contents); |
| 42 ~AwRenderViewHostExt() override; | 41 ~AwRenderViewHostExt() override; |
| 43 | 42 |
| 44 // |result| will be invoked with the outcome of the request. | 43 // |result| will be invoked with the outcome of the request. |
| 45 typedef base::Callback<void(bool)> DocumentHasImagesResult; | 44 typedef base::Callback<void(bool)> DocumentHasImagesResult; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // *current* RVH. | 109 // *current* RVH. |
| 111 std::map<int, DocumentHasImagesResult> image_requests_callback_map_; | 110 std::map<int, DocumentHasImagesResult> image_requests_callback_map_; |
| 112 | 111 |
| 113 // Master copy of hit test data on the browser side. This is updated | 112 // Master copy of hit test data on the browser side. This is updated |
| 114 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged | 113 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged |
| 115 // is called in AwRenderViewExt. | 114 // is called in AwRenderViewExt. |
| 116 AwHitTestData last_hit_test_data_; | 115 AwHitTestData last_hit_test_data_; |
| 117 | 116 |
| 118 bool has_new_hit_test_data_; | 117 bool has_new_hit_test_data_; |
| 119 | 118 |
| 119 SEQUENCE_CHECKER(sequence_checker_); |
| 120 |
| 120 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); | 121 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); |
| 121 }; | 122 }; |
| 122 | 123 |
| 123 } // namespace android_webview | 124 } // namespace android_webview |
| 124 | 125 |
| 125 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ | 126 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ |
| OLD | NEW |