| 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/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 struct FrameNavigateParams; | 17 struct FrameNavigateParams; |
| 18 struct LoadCommittedDetails; | 18 struct LoadCommittedDetails; |
| 19 } // namespace content | 19 } // namespace content |
| 20 | 20 |
| 21 namespace android_webview { | 21 namespace android_webview { |
| 22 | 22 |
| 23 class AwRenderViewHostExtClient { |
| 24 public: |
| 25 // Called when the RenderView page scale changes. |
| 26 virtual void OnPageScaleFactorChanged(float page_scale_factor) = 0; |
| 27 |
| 28 protected: |
| 29 virtual ~AwRenderViewHostExtClient() {} |
| 30 }; |
| 31 |
| 23 // Provides RenderViewHost wrapper functionality for sending WebView-specific | 32 // Provides RenderViewHost wrapper functionality for sending WebView-specific |
| 24 // IPC messages to the renderer and from there to WebKit. | 33 // IPC messages to the renderer and from there to WebKit. |
| 25 class AwRenderViewHostExt : public content::WebContentsObserver, | 34 class AwRenderViewHostExt : public content::WebContentsObserver, |
| 26 public base::NonThreadSafe { | 35 public base::NonThreadSafe { |
| 27 public: | 36 public: |
| 37 |
| 28 // To send receive messages to a RenderView we take the WebContents instance, | 38 // To send receive messages to a RenderView we take the WebContents instance, |
| 29 // as it internally handles RenderViewHost instances changing underneath us. | 39 // as it internally handles RenderViewHost instances changing underneath us. |
| 30 AwRenderViewHostExt(content::WebContents* contents); | 40 AwRenderViewHostExt( |
| 41 AwRenderViewHostExtClient* client, content::WebContents* contents); |
| 31 virtual ~AwRenderViewHostExt(); | 42 virtual ~AwRenderViewHostExt(); |
| 32 | 43 |
| 33 // |result| will be invoked with the outcome of the request. | 44 // |result| will be invoked with the outcome of the request. |
| 34 typedef base::Callback<void(bool)> DocumentHasImagesResult; | 45 typedef base::Callback<void(bool)> DocumentHasImagesResult; |
| 35 void DocumentHasImages(DocumentHasImagesResult result); | 46 void DocumentHasImages(DocumentHasImagesResult result); |
| 36 | 47 |
| 37 // Clear all WebCore memory cache (not only for this view). | 48 // Clear all WebCore memory cache (not only for this view). |
| 38 void ClearCache(); | 49 void ClearCache(); |
| 39 | 50 |
| 40 // Do a hit test at the view port coordinates and asynchronously update | 51 // Do a hit test at the view port coordinates and asynchronously update |
| (...skipping 22 matching lines...) Expand all Loading... |
| 63 private: | 74 private: |
| 64 // content::WebContentsObserver implementation. | 75 // content::WebContentsObserver implementation. |
| 65 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 76 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
| 66 virtual void DidNavigateAnyFrame( | 77 virtual void DidNavigateAnyFrame( |
| 67 const content::LoadCommittedDetails& details, | 78 const content::LoadCommittedDetails& details, |
| 68 const content::FrameNavigateParams& params) OVERRIDE; | 79 const content::FrameNavigateParams& params) OVERRIDE; |
| 69 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 80 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 70 | 81 |
| 71 void OnDocumentHasImagesResponse(int msg_id, bool has_images); | 82 void OnDocumentHasImagesResponse(int msg_id, bool has_images); |
| 72 void OnUpdateHitTestData(const AwHitTestData& hit_test_data); | 83 void OnUpdateHitTestData(const AwHitTestData& hit_test_data); |
| 73 void OnPictureUpdated(); | 84 void OnDidActivateAcceleratedCompositing(int input_handler_id); |
| 85 void OnPageScaleFactorChanged(float page_scale_factor); |
| 74 | 86 |
| 75 bool IsRenderViewReady() const; | 87 bool IsRenderViewReady() const; |
| 76 | 88 |
| 89 AwRenderViewHostExtClient* client_; |
| 90 |
| 77 std::map<int, DocumentHasImagesResult> pending_document_has_images_requests_; | 91 std::map<int, DocumentHasImagesResult> pending_document_has_images_requests_; |
| 78 | 92 |
| 79 // Master copy of hit test data on the browser side. This is updated | 93 // Master copy of hit test data on the browser side. This is updated |
| 80 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged | 94 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged |
| 81 // is called in AwRenderViewExt. | 95 // is called in AwRenderViewExt. |
| 82 AwHitTestData last_hit_test_data_; | 96 AwHitTestData last_hit_test_data_; |
| 83 | 97 |
| 84 bool has_new_hit_test_data_; | 98 bool has_new_hit_test_data_; |
| 85 | 99 |
| 86 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); | 100 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); |
| 87 }; | 101 }; |
| 88 | 102 |
| 89 } // namespace android_webview | 103 } // namespace android_webview |
| 90 | 104 |
| 91 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ | 105 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ |
| OLD | NEW |