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
3 // found in the LICENSE file.
5 #ifndef ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_
6 #define ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/timer/timer.h"
11 #include "content/public/renderer/render_view_observer.h"
12 #include "third_party/skia/include/core/SkColor.h"
13 #include "ui/gfx/size.h"
22 namespace android_webview
{
24 // Render process side of AwRenderViewHostExt, this provides cross-process
25 // implementation of miscellaneous WebView functions that we need to poke
26 // WebKit directly to implement (and that aren't needed in the chrome app).
27 class AwRenderViewExt
: public content::RenderViewObserver
{
29 static void RenderViewCreated(content::RenderView
* render_view
);
32 AwRenderViewExt(content::RenderView
* render_view
);
33 virtual ~AwRenderViewExt();
35 // RenderView::Observer:
36 virtual bool OnMessageReceived(const IPC::Message
& message
) OVERRIDE
;
37 virtual void FocusedNodeChanged(const blink::WebNode
& node
) OVERRIDE
;
38 virtual void DidCommitCompositorFrame() OVERRIDE
;
39 virtual void DidUpdateLayout() OVERRIDE
;
40 virtual void Navigate(const GURL
& url
) OVERRIDE
;
42 void OnDocumentHasImagesRequest(int id
);
44 void OnDoHitTest(int view_x
, int view_y
);
46 void OnSetTextZoomFactor(float zoom_factor
);
48 void OnResetScrollAndScaleState();
50 void OnSetInitialPageScale(double page_scale_factor
);
52 void OnSetBackgroundColor(SkColor c
);
54 void UpdatePageScaleFactor();
56 void CheckContentsSize();
58 bool capture_picture_enabled_
;
60 float page_scale_factor_
;
62 gfx::Size last_sent_contents_size_
;
63 base::OneShotTimer
<AwRenderViewExt
> check_contents_size_timer_
;
65 DISALLOW_COPY_AND_ASSIGN(AwRenderViewExt
);
68 } // namespace android_webview
70 #endif // ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_