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

Unified Diff: chrome/browser/extensions/api/tabs/tabs_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: chrome/browser/extensions/api/tabs/tabs_api.h
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.h b/chrome/browser/extensions/api/tabs/tabs_api.h
index b398e70c10d922a5d580e57890fb54a6e511300c..e0a5f241efe5d6f45178269ed407ca3bd89afb14 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.h
+++ b/chrome/browser/extensions/api/tabs/tabs_api.h
@@ -15,8 +15,8 @@
#include "components/ui/zoom/zoom_controller.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.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/common/extension_resource.h"
#include "extensions/common/user_script.h"
#include "url/gurl.h"
@@ -195,21 +195,29 @@ class TabsDetectLanguageFunction : public ChromeAsyncExtensionFunction,
content::NotificationRegistrar registrar_;
DECLARE_EXTENSION_FUNCTION("tabs.detectLanguage", TABS_DETECTLANGUAGE)
};
+
class TabsCaptureVisibleTabFunction
- : public extensions::CaptureWebContentsFunction {
+ : public extensions::WebContentsCaptureClient,
+ public AsyncExtensionFunction {
public:
TabsCaptureVisibleTabFunction();
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
+ // ExtensionFunction implementation.
+ bool HasPermission() override;
+ bool RunAsync() override;
+
protected:
~TabsCaptureVisibleTabFunction() override {}
private:
ChromeExtensionFunctionDetails chrome_details_;
- // extensions::CaptureWebContentsFunction:
+ content::WebContents* GetWebContentsForID(int window_id);
+
+ // extensions::WebContentsCaptureClient:
bool IsScreenshotEnabled() override;
- content::WebContents* GetWebContentsForID(int id) override;
+ void OnCaptureSuccess(const SkBitmap& bitmap) override;
void OnCaptureFailure(FailureReason reason) override;
DECLARE_EXTENSION_FUNCTION("tabs.captureVisibleTab", TABS_CAPTUREVISIBLETAB)
« no previous file with comments | « no previous file | chrome/browser/extensions/api/tabs/tabs_api.cc » ('j') | extensions/browser/api/web_contents_capture_client.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698