Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: content/public/browser/android/content_view_core.h

Issue 176943004: [Android] Implement asynchronous zero-copy bitmap capture API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_
6 #define CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "content/public/browser/navigation_controller.h" 13 #include "content/public/browser/navigation_controller.h"
14 14 #include "third_party/skia/include/core/SkBitmap.h"
15 class SkBitmap; 15 #include "ui/gfx/rect.h"
16 16
17 namespace cc { 17 namespace cc {
18 class Layer; 18 class Layer;
19 } 19 }
20 20
21 namespace gfx { 21 namespace gfx {
22 class Size; 22 class Size;
23 class SizeF; 23 class SizeF;
24 class Vector2dF; 24 class Vector2dF;
25 } 25 }
26 26
27 namespace ui { 27 namespace ui {
28 class ViewAndroid; 28 class ViewAndroid;
29 class WindowAndroid; 29 class WindowAndroid;
30 } 30 }
31 31
32 namespace content { 32 namespace content {
33 class WebContents; 33 class WebContents;
34 34
35 typedef base::Callback<void(SkBitmap*& bitmap,
36 const gfx::Size&,
37 SkBitmap::Config)> BitmapAllocator;
38
35 // Native side of the ContentViewCore.java, which is the primary way of 39 // Native side of the ContentViewCore.java, which is the primary way of
36 // communicating with the native Chromium code on Android. This is a 40 // communicating with the native Chromium code on Android. This is a
37 // public interface used by native code outside of the content module. 41 // public interface used by native code outside of the content module.
38 class CONTENT_EXPORT ContentViewCore { 42 class CONTENT_EXPORT ContentViewCore {
39 public: 43 public:
40 // Returns the existing ContentViewCore for |web_contents|, or NULL. 44 // Returns the existing ContentViewCore for |web_contents|, or NULL.
41 static ContentViewCore* FromWebContents(WebContents* web_contents); 45 static ContentViewCore* FromWebContents(WebContents* web_contents);
42 static ContentViewCore* GetNativeContentViewCore(JNIEnv* env, jobject obj); 46 static ContentViewCore* GetNativeContentViewCore(JNIEnv* env, jobject obj);
43 47
44 virtual WebContents* GetWebContents() const = 0; 48 virtual WebContents* GetWebContents() const = 0;
45 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0; 49 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0;
46 virtual ui::ViewAndroid* GetViewAndroid() const = 0; 50 virtual ui::ViewAndroid* GetViewAndroid() const = 0;
47 virtual ui::WindowAndroid* GetWindowAndroid() const = 0; 51 virtual ui::WindowAndroid* GetWindowAndroid() const = 0;
48 virtual scoped_refptr<cc::Layer> GetLayer() const = 0; 52 virtual scoped_refptr<cc::Layer> GetLayer() const = 0;
49 virtual void LoadUrl(NavigationController::LoadURLParams& params) = 0; 53 virtual void LoadUrl(NavigationController::LoadURLParams& params) = 0;
50 virtual jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj) = 0; 54 virtual jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj) = 0;
51 virtual void ShowPastePopup(int x, int y) = 0; 55 virtual void ShowPastePopup(int x, int y) = 0;
52 56
53 // Request a scaled content readback. The result is passed through the 57 // Request a scaled content readback. The result is passed through the
54 // callback. The boolean parameter indicates whether the readback was a 58 // callback. The boolean parameter indicates whether the readback was a
55 // success or not. The content is passed through the SkBitmap parameter. 59 // success or not. The content is passed through the SkBitmap parameter.
56 // |out_size| is returned with the size of the content. 60 // |bitmap_config| is optional parameter to specify the configuration of the
61 // output bitmap.
62 // |bounding_rect| is optional parameter to specify the bounds of the capture.
63 // |bitmap_allocator| is optional parameter to specify custom bitmap allocator
64 // to be used while sending back the bitmap.
57 virtual void GetScaledContentBitmap( 65 virtual void GetScaledContentBitmap(
58 float scale, 66 float scale,
59 const base::Callback<void(bool, const SkBitmap&)>& result_callback) = 0; 67 const base::Callback<void(bool, const SkBitmap&)>& result_callback,
68 SkBitmap::Config bitmap_config = SkBitmap::kARGB_8888_Config,
69 const gfx::Rect& bounding_rect = gfx::Rect(),
70 const BitmapAllocator bitmap_allocator = BitmapAllocator()) = 0;
60 virtual float GetDpiScale() const = 0; 71 virtual float GetDpiScale() const = 0;
61 virtual void PauseVideo() = 0; 72 virtual void PauseVideo() = 0;
62 virtual void PauseOrResumeGeolocation(bool should_pause) = 0; 73 virtual void PauseOrResumeGeolocation(bool should_pause) = 0;
63 74
64 // Observer callback for frame metadata updates. 75 // Observer callback for frame metadata updates.
65 typedef base::Callback<void( 76 typedef base::Callback<void(
66 const gfx::SizeF& content_size, 77 const gfx::SizeF& content_size,
67 const gfx::Vector2dF& scroll_offset, 78 const gfx::Vector2dF& scroll_offset,
68 float page_scale_factor)> UpdateFrameInfoCallback; 79 float page_scale_factor)> UpdateFrameInfoCallback;
69 80
70 protected: 81 protected:
71 virtual ~ContentViewCore() {}; 82 virtual ~ContentViewCore() {};
72 }; 83 };
73 84
74 }; // namespace content 85 }; // namespace content
75 86
76 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ 87 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698