| 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 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "ui/gfx/size.h" |
| 14 | 15 |
| 15 class GURL; | 16 class GURL; |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 struct FrameNavigateParams; | 19 struct FrameNavigateParams; |
| 19 struct LoadCommittedDetails; | 20 struct LoadCommittedDetails; |
| 20 } // namespace content | 21 } // namespace content |
| 21 | 22 |
| 22 namespace android_webview { | 23 namespace android_webview { |
| 23 | 24 |
| 24 class AwRenderViewHostExtClient { | 25 class AwRenderViewHostExtClient { |
| 25 public: | 26 public: |
| 26 // Called when the RenderView page scale changes. | 27 // Called when the RenderView page scale changes. |
| 27 virtual void OnWebLayoutPageScaleFactorChanged(float page_scale_factor) = 0; | 28 virtual void OnWebLayoutPageScaleFactorChanged(float page_scale_factor) = 0; |
| 29 virtual void OnWebLayoutContentsSizeChanged( |
| 30 const gfx::Size& contents_size) = 0; |
| 28 | 31 |
| 29 protected: | 32 protected: |
| 30 virtual ~AwRenderViewHostExtClient() {} | 33 virtual ~AwRenderViewHostExtClient() {} |
| 31 }; | 34 }; |
| 32 | 35 |
| 33 // Provides RenderViewHost wrapper functionality for sending WebView-specific | 36 // Provides RenderViewHost wrapper functionality for sending WebView-specific |
| 34 // IPC messages to the renderer and from there to WebKit. | 37 // IPC messages to the renderer and from there to WebKit. |
| 35 class AwRenderViewHostExt : public content::WebContentsObserver, | 38 class AwRenderViewHostExt : public content::WebContentsObserver, |
| 36 public base::NonThreadSafe { | 39 public base::NonThreadSafe { |
| 37 public: | 40 public: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 67 void SetTextZoomLevel(double level); | 70 void SetTextZoomLevel(double level); |
| 68 | 71 |
| 69 void ResetScrollAndScaleState(); | 72 void ResetScrollAndScaleState(); |
| 70 | 73 |
| 71 // Sets the initial page scale. This overrides initial scale set by | 74 // Sets the initial page scale. This overrides initial scale set by |
| 72 // the meta viewport tag. | 75 // the meta viewport tag. |
| 73 void SetInitialPageScale(double page_scale_factor); | 76 void SetInitialPageScale(double page_scale_factor); |
| 74 void SetBackgroundColor(SkColor c); | 77 void SetBackgroundColor(SkColor c); |
| 75 void SetJsOnlineProperty(bool network_up); | 78 void SetJsOnlineProperty(bool network_up); |
| 76 | 79 |
| 80 void EnableContentsSizeNotifications(); |
| 81 |
| 77 private: | 82 private: |
| 78 // content::WebContentsObserver implementation. | 83 // content::WebContentsObserver implementation. |
| 79 virtual void RenderViewCreated(content::RenderViewHost* view_host) OVERRIDE; | 84 virtual void RenderViewCreated(content::RenderViewHost* view_host) OVERRIDE; |
| 80 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 85 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; |
| 81 virtual void DidNavigateAnyFrame( | 86 virtual void DidNavigateAnyFrame( |
| 82 const content::LoadCommittedDetails& details, | 87 const content::LoadCommittedDetails& details, |
| 83 const content::FrameNavigateParams& params) OVERRIDE; | 88 const content::FrameNavigateParams& params) OVERRIDE; |
| 84 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 89 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 85 | 90 |
| 86 void OnDocumentHasImagesResponse(int msg_id, bool has_images); | 91 void OnDocumentHasImagesResponse(int msg_id, bool has_images); |
| 87 void OnUpdateHitTestData(const AwHitTestData& hit_test_data); | 92 void OnUpdateHitTestData(const AwHitTestData& hit_test_data); |
| 88 void OnPageScaleFactorChanged(float page_scale_factor); | 93 void OnPageScaleFactorChanged(float page_scale_factor); |
| 94 void OnContentsSizeChanged(const gfx::Size& contents_size); |
| 89 | 95 |
| 90 bool IsRenderViewReady() const; | 96 bool IsRenderViewReady() const; |
| 91 | 97 |
| 92 AwRenderViewHostExtClient* client_; | 98 AwRenderViewHostExtClient* client_; |
| 93 | 99 |
| 94 SkColor background_color_; | 100 SkColor background_color_; |
| 95 | 101 |
| 96 std::map<int, DocumentHasImagesResult> pending_document_has_images_requests_; | 102 std::map<int, DocumentHasImagesResult> pending_document_has_images_requests_; |
| 97 | 103 |
| 98 // Master copy of hit test data on the browser side. This is updated | 104 // Master copy of hit test data on the browser side. This is updated |
| 99 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged | 105 // as a result of DoHitTest called explicitly or when the FocusedNodeChanged |
| 100 // is called in AwRenderViewExt. | 106 // is called in AwRenderViewExt. |
| 101 AwHitTestData last_hit_test_data_; | 107 AwHitTestData last_hit_test_data_; |
| 102 | 108 |
| 103 bool has_new_hit_test_data_; | 109 bool has_new_hit_test_data_; |
| 104 | 110 |
| 105 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); | 111 DISALLOW_COPY_AND_ASSIGN(AwRenderViewHostExt); |
| 106 }; | 112 }; |
| 107 | 113 |
| 108 } // namespace android_webview | 114 } // namespace android_webview |
| 109 | 115 |
| 110 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ | 116 #endif // ANDROID_WEBVIEW_BROWSER_RENDER_HOST_RENDER_VIEW_HOST_EXT_H_ |
| OLD | NEW |