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 CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_
6 #define CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_
10 #include "base/android/scoped_java_ref.h"
11 #include "base/callback.h"
12 #include "content/common/content_export.h"
13 #include "content/public/browser/navigation_controller.h"
32 class WebCompositorInputHandler
;
38 // Native side of the ContentViewCore.java, which is the primary way of
39 // communicating with the native Chromium code on Android. This is a
40 // public interface used by native code outside of the content module.
41 class CONTENT_EXPORT ContentViewCore
{
43 // Returns the existing ContentViewCore for |web_contents|, or NULL.
44 static ContentViewCore
* FromWebContents(WebContents
* web_contents
);
45 static ContentViewCore
* GetNativeContentViewCore(JNIEnv
* env
, jobject obj
);
47 virtual WebContents
* GetWebContents() const = 0;
48 virtual base::android::ScopedJavaLocalRef
<jobject
> GetJavaObject() = 0;
49 virtual ui::ViewAndroid
* GetViewAndroid() const = 0;
50 virtual ui::WindowAndroid
* GetWindowAndroid() const = 0;
51 virtual scoped_refptr
<cc::Layer
> GetLayer() const = 0;
52 virtual void LoadUrl(NavigationController::LoadURLParams
& params
) = 0;
53 virtual jint
GetCurrentRenderProcessId(JNIEnv
* env
, jobject obj
) = 0;
54 virtual void ShowPastePopup(int x
, int y
) = 0;
55 virtual unsigned int GetScaledContentTexture(
57 gfx::Size
* out_size
) = 0;
58 virtual float GetDpiScale() const = 0;
59 virtual void SetInputHandler(
60 WebKit::WebCompositorInputHandler
* input_handler
) = 0;
61 virtual void RequestContentClipping(const gfx::Rect
& clipping
,
62 const gfx::Size
& content_size
) = 0;
64 // Observer callback for frame metadata updates.
65 typedef base::Callback
<void(
66 const gfx::SizeF
& content_size
,
67 const gfx::Vector2dF
& scroll_offset
,
68 float page_scale_factor
)> UpdateFrameInfoCallback
;
70 virtual void AddFrameInfoCallback(
71 const UpdateFrameInfoCallback
& callback
) = 0;
72 virtual void RemoveFrameInfoCallback(
73 const UpdateFrameInfoCallback
& callback
) = 0;
76 virtual ~ContentViewCore() {};
79 }; // namespace content
81 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_