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 namespace android_webview { | 14 namespace android_webview { |
15 | 15 |
16 // Provides RenderViewHost wrapper functionality for sending WebView-specific | 16 // Provides RenderViewHost wrapper functionality for sending WebView-specific |
17 // IPC messages to the renderer and from there to WebKit. | 17 // IPC messages to the renderer and from there to WebKit. |
18 class AwRenderViewHostExt : public content::WebContentsObserver, | 18 class AwRenderViewHostExt : public content::WebContentsObserver, |
19 public base::NonThreadSafe { | 19 public base::NonThreadSafe { |
20 public: | 20 public: |
21 class Client { | |
22 public: | |
23 virtual void OnPictureUpdated(int process_id, int render_view_id) = 0; | |
24 | |
25 protected: | |
26 virtual ~Client() {} | |
27 }; | |
28 | |
29 // To send receive messages to a RenderView we take the WebContents instance, | 21 // To send receive messages to a RenderView we take the WebContents instance, |
30 // as it internally handles RenderViewHost instances changing underneath us. | 22 // as it internally handles RenderViewHost instances changing underneath us. |
31 AwRenderViewHostExt(content::WebContents* contents, Client* client); | 23 AwRenderViewHostExt(content::WebContents* contents); |
32 virtual ~AwRenderViewHostExt(); | 24 virtual ~AwRenderViewHostExt(); |
33 | 25 |
34 // |result| will be invoked with the outcome of the request. | 26 // |result| will be invoked with the outcome of the request. |
35 typedef base::Callback<void(bool)> DocumentHasImagesResult; | 27 typedef base::Callback<void(bool)> DocumentHasImagesResult; |
36 void DocumentHasImages(DocumentHasImagesResult result); | 28 void DocumentHasImages(DocumentHasImagesResult result); |
37 | 29 |
38 // Clear all WebCore memory cache (not only for this view). | 30 // Clear all WebCore memory cache (not only for this view). |
39 void ClearCache(); | 31 void ClearCache(); |
40 | 32 |
41 // Do a hit test at the view port coordinates and asynchronously update | 33 // Do a hit test at the view port coordinates and asynchronously update |
(...skipping 19 matching lines...) Expand all Loading... |
61 | 53 |
62 std::map<int, DocumentHasImagesResult> pending_document_has_images_requests_; | 54 std::map<int, DocumentHasImagesResult> pending_document_has_images_requests_; |
63 | 55 |
64 // Master copy of hit test data on the browser side. This is updated | 56 // Master copy of hit test data on the browser side. This is updated |
65 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged | 57 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged |
66 // is called in AwRenderViewExt. | 58 // is called in AwRenderViewExt. |
67 AwHitTestData last_hit_test_data_; | 59 AwHitTestData last_hit_test_data_; |
68 | 60 |
69 bool has_new_hit_test_data_; | 61 bool has_new_hit_test_data_; |
70 | 62 |
71 Client* client_; | |
72 | |
73 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); | 63 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); |
74 }; | 64 }; |
75 | 65 |
76 } // namespace android_webview | 66 } // namespace android_webview |
77 | 67 |
78 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ | 68 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ |
OLD | NEW |