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" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // Provides RenderViewHost wrapper functionality for sending WebView-specific | 38 // Provides RenderViewHost wrapper functionality for sending WebView-specific |
39 // IPC messages to the renderer and from there to WebKit. | 39 // IPC messages to the renderer and from there to WebKit. |
40 class AwRenderViewHostExt : public content::WebContentsObserver, | 40 class AwRenderViewHostExt : public content::WebContentsObserver, |
41 public base::NonThreadSafe { | 41 public base::NonThreadSafe { |
42 public: | 42 public: |
43 | 43 |
44 // To send receive messages to a RenderView we take the WebContents instance, | 44 // To send receive messages to a RenderView we take the WebContents instance, |
45 // as it internally handles RenderViewHost instances changing underneath us. | 45 // as it internally handles RenderViewHost instances changing underneath us. |
46 AwRenderViewHostExt( | 46 AwRenderViewHostExt( |
47 AwRenderViewHostExtClient* client, content::WebContents* contents); | 47 AwRenderViewHostExtClient* client, content::WebContents* contents); |
48 virtual ~AwRenderViewHostExt(); | 48 ~AwRenderViewHostExt() override; |
49 | 49 |
50 // |result| will be invoked with the outcome of the request. | 50 // |result| will be invoked with the outcome of the request. |
51 typedef base::Callback<void(bool)> DocumentHasImagesResult; | 51 typedef base::Callback<void(bool)> DocumentHasImagesResult; |
52 void DocumentHasImages(DocumentHasImagesResult result); | 52 void DocumentHasImages(DocumentHasImagesResult result); |
53 | 53 |
54 // Clear all WebCore memory cache (not only for this view). | 54 // Clear all WebCore memory cache (not only for this view). |
55 void ClearCache(); | 55 void ClearCache(); |
56 | 56 |
57 // Do a hit test at the view port coordinates and asynchronously update | 57 // Do a hit test at the view port coordinates and asynchronously update |
58 // |last_hit_test_data_|. Width and height in |touch_area| are in density | 58 // |last_hit_test_data_|. Width and height in |touch_area| are in density |
(...skipping 16 matching lines...) Expand all Loading... |
75 void ResetScrollAndScaleState(); | 75 void ResetScrollAndScaleState(); |
76 | 76 |
77 // Sets the initial page scale. This overrides initial scale set by | 77 // Sets the initial page scale. This overrides initial scale set by |
78 // the meta viewport tag. | 78 // the meta viewport tag. |
79 void SetInitialPageScale(double page_scale_factor); | 79 void SetInitialPageScale(double page_scale_factor); |
80 void SetBackgroundColor(SkColor c); | 80 void SetBackgroundColor(SkColor c); |
81 void SetJsOnlineProperty(bool network_up); | 81 void SetJsOnlineProperty(bool network_up); |
82 | 82 |
83 private: | 83 private: |
84 // content::WebContentsObserver implementation. | 84 // content::WebContentsObserver implementation. |
85 virtual void RenderViewCreated(content::RenderViewHost* view_host) override; | 85 void RenderViewCreated(content::RenderViewHost* view_host) override; |
86 virtual void RenderProcessGone(base::TerminationStatus status) override; | 86 void RenderProcessGone(base::TerminationStatus status) override; |
87 virtual void DidNavigateAnyFrame( | 87 void DidNavigateAnyFrame(content::RenderFrameHost* render_frame_host, |
88 content::RenderFrameHost* render_frame_host, | 88 const content::LoadCommittedDetails& details, |
89 const content::LoadCommittedDetails& details, | 89 const content::FrameNavigateParams& params) override; |
90 const content::FrameNavigateParams& params) override; | 90 bool OnMessageReceived(const IPC::Message& message) override; |
91 virtual bool OnMessageReceived(const IPC::Message& message) override; | |
92 | 91 |
93 void OnDocumentHasImagesResponse(int msg_id, bool has_images); | 92 void OnDocumentHasImagesResponse(int msg_id, bool has_images); |
94 void OnUpdateHitTestData(const AwHitTestData& hit_test_data); | 93 void OnUpdateHitTestData(const AwHitTestData& hit_test_data); |
95 void OnPageScaleFactorChanged(float page_scale_factor); | 94 void OnPageScaleFactorChanged(float page_scale_factor); |
96 void OnContentsSizeChanged(const gfx::Size& contents_size); | 95 void OnContentsSizeChanged(const gfx::Size& contents_size); |
97 | 96 |
98 bool IsRenderViewReady() const; | 97 bool IsRenderViewReady() const; |
99 | 98 |
100 AwRenderViewHostExtClient* client_; | 99 AwRenderViewHostExtClient* client_; |
101 | 100 |
102 SkColor background_color_; | 101 SkColor background_color_; |
103 | 102 |
104 std::map<int, DocumentHasImagesResult> pending_document_has_images_requests_; | 103 std::map<int, DocumentHasImagesResult> pending_document_has_images_requests_; |
105 | 104 |
106 // Master copy of hit test data on the browser side. This is updated | 105 // Master copy of hit test data on the browser side. This is updated |
107 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged | 106 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged |
108 // is called in AwRenderViewExt. | 107 // is called in AwRenderViewExt. |
109 AwHitTestData last_hit_test_data_; | 108 AwHitTestData last_hit_test_data_; |
110 | 109 |
111 bool has_new_hit_test_data_; | 110 bool has_new_hit_test_data_; |
112 | 111 |
113 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); | 112 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); |
114 }; | 113 }; |
115 | 114 |
116 } // namespace android_webview | 115 } // namespace android_webview |
117 | 116 |
118 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ | 117 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ |
OLD | NEW |