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

Unified Diff: extensions/browser/api/guest_view/web_view/web_view_internal_api.h

Issue 1582053002: Implement webview.captureVisibleRegion() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test so it waits for the first frame to be generated. Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/guest_view/web_view/web_view_internal_api.h
diff --git a/extensions/browser/api/guest_view/web_view/web_view_internal_api.h b/extensions/browser/api/guest_view/web_view/web_view_internal_api.h
index dcdb8289a623a2429f9afcd9a783fe4b6c382553..388491eac49ceed464d0007dadfc4d6eb1a0613c 100644
--- a/extensions/browser/api/guest_view/web_view/web_view_internal_api.h
+++ b/extensions/browser/api/guest_view/web_view/web_view_internal_api.h
@@ -8,8 +8,8 @@
#include <stdint.h>
#include "base/macros.h"
-#include "extensions/browser/api/capture_web_contents_function.h"
#include "extensions/browser/api/execute_code_function.h"
+#include "extensions/browser/api/web_contents_capture_client.h"
#include "extensions/browser/extension_function.h"
#include "extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
@@ -37,6 +37,29 @@ class WebViewInternalExtensionFunction : public AsyncExtensionFunction {
virtual bool RunAsyncSafe(WebViewGuest* guest) = 0;
};
+class WebViewInternalCaptureVisibleRegionFunction
+ : public WebViewInternalExtensionFunction,
+ public WebContentsCaptureClient {
+ public:
+ DECLARE_EXTENSION_FUNCTION("webViewInternal.captureVisibleRegion",
+ WEBVIEWINTERNAL_CAPTUREVISIBLEREGION);
+ WebViewInternalCaptureVisibleRegionFunction() {}
+
+ protected:
+ ~WebViewInternalCaptureVisibleRegionFunction() override {}
+
+ private:
+ // WebViewInternalExtensionFunction implementation.
+ bool RunAsyncSafe(WebViewGuest* guest) override;
+
+ // extensions::WebContentsCaptureClient:
+ bool IsScreenshotEnabled() override;
+ void OnCaptureSuccess(const SkBitmap& bitmap) override;
+ void OnCaptureFailure(FailureReason reason) override;
+
+ DISALLOW_COPY_AND_ASSIGN(WebViewInternalCaptureVisibleRegionFunction);
+};
+
class WebViewInternalNavigateFunction
: public WebViewInternalExtensionFunction {
public:

Powered by Google App Engine
This is Rietveld 408576698