[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / public / browser / android / content_view_core.h
blobe528090c6d2af7fdb881e3ed4997bdab06e57c0d
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_
8 #include <jni.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"
14 #include "content/public/browser/readback_types.h"
15 #include "third_party/skia/include/core/SkImageInfo.h"
16 #include "ui/gfx/geometry/rect.h"
18 class SkBitmap;
20 namespace cc {
21 class Layer;
24 namespace gfx {
25 class Size;
26 class SizeF;
27 class Vector2dF;
30 namespace ui {
31 class ViewAndroid;
32 class WindowAndroid;
35 namespace content {
36 class WebContents;
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 {
42 public:
43 // Returns the existing ContentViewCore for |web_contents|, or nullptr.
44 static ContentViewCore* FromWebContents(WebContents* web_contents);
45 static ContentViewCore* GetNativeContentViewCore(JNIEnv* env, jobject obj);
47 virtual WebContents* GetWebContents() const = 0;
49 // May return null reference.
50 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0;
51 virtual ui::ViewAndroid* GetViewAndroid() const = 0;
52 virtual ui::WindowAndroid* GetWindowAndroid() const = 0;
53 virtual const scoped_refptr<cc::Layer>& GetLayer() const = 0;
54 virtual void ShowPastePopup(int x, int y) = 0;
56 // Request a scaled content readback. The result is passed through the
57 // callback. The boolean parameter indicates whether the readback was a
58 // success or not. The content is passed through the SkBitmap parameter.
59 virtual void GetScaledContentBitmap(
60 float scale,
61 SkColorType color_type,
62 gfx::Rect src_rect,
63 ReadbackRequestCallback& result_callback) = 0;
64 virtual float GetDpiScale() const = 0;
65 virtual void PauseOrResumeGeolocation(bool should_pause) = 0;
67 // Observer callback for frame metadata updates.
68 typedef base::Callback<void(
69 const gfx::SizeF& content_size,
70 const gfx::Vector2dF& scroll_offset,
71 float page_scale_factor)> UpdateFrameInfoCallback;
73 // Text surrounding selection.
74 virtual void RequestTextSurroundingSelection(
75 int max_length,
76 const base::Callback<void(const base::string16& content,
77 int start_offset,
78 int end_offset)>& callback) = 0;
80 protected:
81 virtual ~ContentViewCore() {};
84 }; // namespace content
86 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_