| 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_RENDERER_AW_RENDER_VIEW_EXT_H_ | 5 #ifndef ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_ |
| 6 #define ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_ | 6 #define ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/timer/timer.h" |
| 10 #include "content/public/renderer/render_view_observer.h" | 11 #include "content/public/renderer/render_view_observer.h" |
| 11 #include "third_party/WebKit/public/web/WebPermissionClient.h" | 12 #include "third_party/WebKit/public/web/WebPermissionClient.h" |
| 12 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "ui/gfx/size.h" |
| 13 | 15 |
| 14 namespace WebKit { | 16 namespace WebKit { |
| 15 | 17 |
| 16 class WebNode; | 18 class WebNode; |
| 17 class WebURL; | 19 class WebURL; |
| 18 | 20 |
| 19 } // namespace WebKit | 21 } // namespace WebKit |
| 20 | 22 |
| 21 namespace android_webview { | 23 namespace android_webview { |
| 22 | 24 |
| 23 // Render process side of AwRenderViewHostExt, this provides cross-process | 25 // Render process side of AwRenderViewHostExt, this provides cross-process |
| 24 // implementation of miscellaneous WebView functions that we need to poke | 26 // implementation of miscellaneous WebView functions that we need to poke |
| 25 // WebKit directly to implement (and that aren't needed in the chrome app). | 27 // WebKit directly to implement (and that aren't needed in the chrome app). |
| 26 class AwRenderViewExt : public content::RenderViewObserver, | 28 class AwRenderViewExt : public content::RenderViewObserver, |
| 27 public WebKit::WebPermissionClient { | 29 public WebKit::WebPermissionClient { |
| 28 public: | 30 public: |
| 29 static void RenderViewCreated(content::RenderView* render_view); | 31 static void RenderViewCreated(content::RenderView* render_view); |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 AwRenderViewExt(content::RenderView* render_view); | 34 AwRenderViewExt(content::RenderView* render_view); |
| 33 virtual ~AwRenderViewExt(); | 35 virtual ~AwRenderViewExt(); |
| 34 | 36 |
| 35 // RenderView::Observer: | 37 // RenderView::Observer: |
| 36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 38 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 37 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, | 39 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, |
| 38 bool is_new_navigation) OVERRIDE; | 40 bool is_new_navigation) OVERRIDE; |
| 39 virtual void FocusedNodeChanged(const WebKit::WebNode& node) OVERRIDE; | 41 virtual void FocusedNodeChanged(const WebKit::WebNode& node) OVERRIDE; |
| 40 virtual void DidCommitCompositorFrame() OVERRIDE; | 42 virtual void DidCommitCompositorFrame() OVERRIDE; |
| 43 virtual void DidUpdateLayout() OVERRIDE; |
| 41 virtual void Navigate(const GURL& url) OVERRIDE; | 44 virtual void Navigate(const GURL& url) OVERRIDE; |
| 42 | 45 |
| 43 void OnDocumentHasImagesRequest(int id); | 46 void OnDocumentHasImagesRequest(int id); |
| 44 | 47 |
| 45 void OnDoHitTest(int view_x, int view_y); | 48 void OnDoHitTest(int view_x, int view_y); |
| 46 | 49 |
| 47 void OnSetTextZoomLevel(double zoom_level); | 50 void OnSetTextZoomLevel(double zoom_level); |
| 48 | 51 |
| 49 void OnResetScrollAndScaleState(); | 52 void OnResetScrollAndScaleState(); |
| 50 | 53 |
| 51 void OnSetInitialPageScale(double page_scale_factor); | 54 void OnSetInitialPageScale(double page_scale_factor); |
| 52 void OnSetBackgroundColor(SkColor c); | 55 void OnSetBackgroundColor(SkColor c); |
| 53 | 56 |
| 54 void UpdatePageScaleFactor(); | 57 void UpdatePageScaleFactor(); |
| 55 | 58 |
| 59 void OnEnableContentsSizeNotifications(); |
| 60 void CheckContentsSize(); |
| 61 |
| 56 // WebKit::WebPermissionClient implementation. | 62 // WebKit::WebPermissionClient implementation. |
| 57 virtual bool allowDisplayingInsecureContent( | 63 virtual bool allowDisplayingInsecureContent( |
| 58 WebKit::WebFrame* frame, | 64 WebKit::WebFrame* frame, |
| 59 bool enabled_per_settings, | 65 bool enabled_per_settings, |
| 60 const WebKit::WebSecurityOrigin& origin, | 66 const WebKit::WebSecurityOrigin& origin, |
| 61 const WebKit::WebURL& url) OVERRIDE; | 67 const WebKit::WebURL& url) OVERRIDE; |
| 62 virtual bool allowRunningInsecureContent( | 68 virtual bool allowRunningInsecureContent( |
| 63 WebKit::WebFrame* frame, | 69 WebKit::WebFrame* frame, |
| 64 bool enabled_per_settings, | 70 bool enabled_per_settings, |
| 65 const WebKit::WebSecurityOrigin& origin, | 71 const WebKit::WebSecurityOrigin& origin, |
| 66 const WebKit::WebURL& url) OVERRIDE; | 72 const WebKit::WebURL& url) OVERRIDE; |
| 67 | 73 |
| 68 bool capture_picture_enabled_; | 74 bool capture_picture_enabled_; |
| 69 | 75 |
| 70 float page_scale_factor_; | 76 float page_scale_factor_; |
| 71 | 77 |
| 78 bool send_contents_size_updates_; |
| 79 gfx::Size last_sent_contents_size_; |
| 80 base::OneShotTimer<AwRenderViewExt> check_contents_size_timer_; |
| 81 |
| 72 DISALLOW_COPY_AND_ASSIGN(AwRenderViewExt); | 82 DISALLOW_COPY_AND_ASSIGN(AwRenderViewExt); |
| 73 }; | 83 }; |
| 74 | 84 |
| 75 } // namespace android_webview | 85 } // namespace android_webview |
| 76 | 86 |
| 77 #endif // ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_ | 87 #endif // ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_ |
| OLD | NEW |