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/geometry/point_f.h"
14 #include "ui/gfx/geometry/size.h"
15 #include "ui/gfx/geometry/size_f.h"
24 namespace android_webview
{
26 // Render process side of AwRenderViewHostExt, this provides cross-process
27 // implementation of miscellaneous WebView functions that we need to poke
28 // WebKit directly to implement (and that aren't needed in the chrome app).
29 class AwRenderViewExt
: public content::RenderViewObserver
{
31 static void RenderViewCreated(content::RenderView
* render_view
);
34 AwRenderViewExt(content::RenderView
* render_view
);
35 ~AwRenderViewExt() override
;
37 // RenderView::Observer:
38 bool OnMessageReceived(const IPC::Message
& message
) override
;
39 void FocusedNodeChanged(const blink::WebNode
& node
) override
;
40 void DidCommitCompositorFrame() override
;
41 void DidUpdateLayout() override
;
42 void Navigate(const GURL
& url
) override
;
44 void OnDocumentHasImagesRequest(int id
);
46 void OnDoHitTest(const gfx::PointF
& touch_center
,
47 const gfx::SizeF
& touch_area
);
49 void OnSetTextZoomFactor(float zoom_factor
);
51 void OnResetScrollAndScaleState();
53 void OnSetInitialPageScale(double page_scale_factor
);
55 void OnSetBackgroundColor(SkColor c
);
57 void UpdatePageScaleFactor();
59 void CheckContentsSize();
61 bool capture_picture_enabled_
;
63 float page_scale_factor_
;
65 gfx::Size last_sent_contents_size_
;
66 base::OneShotTimer
<AwRenderViewExt
> check_contents_size_timer_
;
68 DISALLOW_COPY_AND_ASSIGN(AwRenderViewExt
);
71 } // namespace android_webview
73 #endif // ANDROID_WEBVIEW_RENDERER_AW_RENDER_VIEW_EXT_H_