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

Side by Side 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 histograms.xml 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 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 CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "chrome/browser/extensions/chrome_extension_function.h" 12 #include "chrome/browser/extensions/chrome_extension_function.h"
13 #include "chrome/browser/extensions/chrome_extension_function_details.h" 13 #include "chrome/browser/extensions/chrome_extension_function_details.h"
14 #include "chrome/common/extensions/api/tabs.h" 14 #include "chrome/common/extensions/api/tabs.h"
15 #include "components/ui/zoom/zoom_controller.h" 15 #include "components/ui/zoom/zoom_controller.h"
16 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
18 #include "extensions/browser/api/capture_web_contents_function.h" 18 #include "extensions/browser/api/capture_web_contents.h"
19 #include "extensions/browser/api/execute_code_function.h" 19 #include "extensions/browser/api/execute_code_function.h"
20 #include "extensions/common/extension_resource.h" 20 #include "extensions/common/extension_resource.h"
21 #include "extensions/common/user_script.h" 21 #include "extensions/common/user_script.h"
22 #include "url/gurl.h" 22 #include "url/gurl.h"
23 23
24 class GURL; 24 class GURL;
25 class SkBitmap; 25 class SkBitmap;
26 class TabStripModel; 26 class TabStripModel;
27 27
28 namespace base { 28 namespace base {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 ~TabsDetectLanguageFunction() override {} 188 ~TabsDetectLanguageFunction() override {}
189 bool RunAsync() override; 189 bool RunAsync() override;
190 190
191 void Observe(int type, 191 void Observe(int type,
192 const content::NotificationSource& source, 192 const content::NotificationSource& source,
193 const content::NotificationDetails& details) override; 193 const content::NotificationDetails& details) override;
194 void GotLanguage(const std::string& language); 194 void GotLanguage(const std::string& language);
195 content::NotificationRegistrar registrar_; 195 content::NotificationRegistrar registrar_;
196 DECLARE_EXTENSION_FUNCTION("tabs.detectLanguage", TABS_DETECTLANGUAGE) 196 DECLARE_EXTENSION_FUNCTION("tabs.detectLanguage", TABS_DETECTLANGUAGE)
197 }; 197 };
198 class TabsCaptureVisibleTabFunction 198
199 : public extensions::CaptureWebContentsFunction { 199 class TabsCaptureVisibleTabFunction : public extensions::CaptureWebContents,
200 public AsyncExtensionFunction {
200 public: 201 public:
201 TabsCaptureVisibleTabFunction(); 202 TabsCaptureVisibleTabFunction();
202 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 203 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
203 204
205 // ExtensionFunction implementation.
206 bool HasPermission() override;
207 bool RunAsync() override;
208
204 protected: 209 protected:
205 ~TabsCaptureVisibleTabFunction() override {} 210 ~TabsCaptureVisibleTabFunction() override {}
206 211
207 private: 212 private:
208 ChromeExtensionFunctionDetails chrome_details_; 213 ChromeExtensionFunctionDetails chrome_details_;
209 214
210 // extensions::CaptureWebContentsFunction: 215 content::WebContents* GetWebContentsForID(int window_id);
216
217 // extensions::CaptureWebContents:
211 bool IsScreenshotEnabled() override; 218 bool IsScreenshotEnabled() override;
212 content::WebContents* GetWebContentsForID(int id) override; 219 void OnCaptureSuccess(const SkBitmap& bitmap) override;
213 void OnCaptureFailure(FailureReason reason) override; 220 void OnCaptureFailure(FailureReason reason) override;
214 221
215 DECLARE_EXTENSION_FUNCTION("tabs.captureVisibleTab", TABS_CAPTUREVISIBLETAB) 222 DECLARE_EXTENSION_FUNCTION("tabs.captureVisibleTab", TABS_CAPTUREVISIBLETAB)
216 }; 223 };
217 224
218 // Implement API call tabs.executeScript and tabs.insertCSS. 225 // Implement API call tabs.executeScript and tabs.insertCSS.
219 class ExecuteCodeInTabFunction : public ExecuteCodeFunction { 226 class ExecuteCodeInTabFunction : public ExecuteCodeFunction {
220 public: 227 public:
221 ExecuteCodeInTabFunction(); 228 ExecuteCodeInTabFunction();
222 229
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 ~TabsGetZoomSettingsFunction() override {} 316 ~TabsGetZoomSettingsFunction() override {}
310 317
311 bool RunAsync() override; 318 bool RunAsync() override;
312 319
313 DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS) 320 DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS)
314 }; 321 };
315 322
316 } // namespace extensions 323 } // namespace extensions
317 324
318 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ 325 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/tabs/tabs_api.cc » ('j') | extensions/browser/api/capture_web_contents.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698