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