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