Make sure webrtc::VideoSourceInterface is released on the main render thread.
[chromium-blink-merge.git] / content / public / browser / android / content_view_core.h
blob1501985b8a53bfa15439eb84ada178e1b8f34d63
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 "ui/gfx/rect.h"
16 class SkBitmap;
18 namespace cc {
19 class Layer;
22 namespace gfx {
23 class Size;
24 class SizeF;
25 class Vector2dF;
28 namespace ui {
29 class ViewAndroid;
30 class WindowAndroid;
33 namespace content {
34 class WebContents;
36 // Native side of the ContentViewCore.java, which is the primary way of
37 // communicating with the native Chromium code on Android. This is a
38 // public interface used by native code outside of the content module.
39 class CONTENT_EXPORT ContentViewCore {
40 public:
41 // Returns the existing ContentViewCore for |web_contents|, or NULL.
42 static ContentViewCore* FromWebContents(WebContents* web_contents);
43 static ContentViewCore* GetNativeContentViewCore(JNIEnv* env, jobject obj);
45 virtual WebContents* GetWebContents() const = 0;
46 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0;
47 virtual ui::ViewAndroid* GetViewAndroid() const = 0;
48 virtual ui::WindowAndroid* GetWindowAndroid() const = 0;
49 virtual scoped_refptr<cc::Layer> GetLayer() const = 0;
50 virtual void LoadUrl(NavigationController::LoadURLParams& params) = 0;
51 virtual void ShowPastePopup(int x, int y) = 0;
53 // Request a scaled content readback. The result is passed through the
54 // callback. The boolean parameter indicates whether the readback was a
55 // success or not. The content is passed through the SkBitmap parameter.
56 virtual void GetScaledContentBitmap(
57 float scale,
58 jobject bitmap_config,
59 gfx::Rect src_rect,
60 const base::Callback<void(bool, const SkBitmap&)>& result_callback) = 0;
61 virtual float GetDpiScale() const = 0;
62 virtual void PauseVideo() = 0;
63 virtual void PauseOrResumeGeolocation(bool should_pause) = 0;
65 // Observer callback for frame metadata updates.
66 typedef base::Callback<void(
67 const gfx::SizeF& content_size,
68 const gfx::Vector2dF& scroll_offset,
69 float page_scale_factor)> UpdateFrameInfoCallback;
71 protected:
72 virtual ~ContentViewCore() {};
75 }; // namespace content
77 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_