OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_VIEW_RENDERER_HOST_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_RENDER_HOST_VIEW_RENDERER_HOST_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_RENDER_HOST_VIEW_RENDERER_HOST_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_RENDER_HOST_VIEW_RENDERER_HOST_H_ |
7 | 7 |
8 #include "base/threading/non_thread_safe.h" | 8 #include "base/threading/non_thread_safe.h" |
9 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
10 | 10 |
11 namespace android_webview { | 11 namespace android_webview { |
12 | 12 |
13 // Provides RenderViewHost wrapper functionality for sending WebView-specific | 13 // Provides RenderViewHost wrapper functionality for sending WebView-specific |
14 // IPC messages to the renderer and from there to WebKit. | 14 // IPC messages to the renderer and from there to WebKit. |
15 class ViewRendererHost : public content::WebContentsObserver, | 15 class ViewRendererHost : public content::WebContentsObserver, |
16 public base::NonThreadSafe { | 16 public base::NonThreadSafe { |
17 public: | 17 public: |
18 class Client { | 18 class Client { |
19 public: | 19 public: |
20 virtual void OnPictureUpdated(int process_id, int render_view_id) = 0; | 20 virtual void OnPictureUpdated(int process_id, int render_view_id) = 0; |
| 21 virtual void OnPageScaleFactorChanged(int process_id, |
| 22 int render_view_id, |
| 23 float page_scale_factor) = 0; |
21 | 24 |
22 protected: | 25 protected: |
23 virtual ~Client() {} | 26 virtual ~Client() {} |
24 }; | 27 }; |
25 | 28 |
26 ViewRendererHost(content::WebContents* contents, Client* client); | 29 ViewRendererHost(content::WebContents* contents, Client* client); |
27 virtual ~ViewRendererHost(); | 30 virtual ~ViewRendererHost(); |
28 | 31 |
29 // Captures the latest available picture pile synchronously. | 32 // Captures the latest available picture pile synchronously. |
30 void CapturePictureSync(); | 33 void CapturePictureSync(); |
31 | 34 |
32 // Enables updating picture piles on every new frame. | 35 // Enables updating picture piles on every new frame. |
33 // OnPictureUpdated is called when a new picture is available, | 36 // OnPictureUpdated is called when a new picture is available, |
34 // stored by renderer id in RendererPictureMap. | 37 // stored by renderer id in RendererPictureMap. |
35 void EnableCapturePictureCallback(bool enabled); | 38 void EnableCapturePictureCallback(bool enabled); |
36 | 39 |
37 using content::WebContentsObserver::Observe; | 40 using content::WebContentsObserver::Observe; |
38 | 41 |
39 private: | 42 private: |
40 // content::WebContentsObserver implementation. | 43 // content::WebContentsObserver implementation. |
41 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 44 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 45 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
43 | 46 |
44 void OnPictureUpdated(); | 47 void OnPictureUpdated(); |
45 void OnDidActivateAcceleratedCompositing(int input_handler_id); | 48 void OnDidActivateAcceleratedCompositing(int input_handler_id); |
| 49 void OnPageScaleFactorChanged(float page_scale_factor); |
46 | 50 |
47 bool IsRenderViewReady() const; | 51 bool IsRenderViewReady() const; |
48 | 52 |
49 Client* client_; | 53 Client* client_; |
50 }; | 54 }; |
51 | 55 |
52 } // namespace android_webview | 56 } // namespace android_webview |
53 | 57 |
54 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_VIEW_RENDERER_HOST_H_ | 58 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_VIEW_RENDERER_HOST_H_ |
OLD | NEW |