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

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_api.h

Issue 12881005: Allow CopyFromBackingStore to fallback to copying from the renderer side if the accelerated surface… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unused include Created 7 years, 9 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
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 virtual ~TabsDetectLanguageFunction() {} 167 virtual ~TabsDetectLanguageFunction() {}
168 virtual bool RunImpl() OVERRIDE; 168 virtual bool RunImpl() OVERRIDE;
169 169
170 virtual void Observe(int type, 170 virtual void Observe(int type,
171 const content::NotificationSource& source, 171 const content::NotificationSource& source,
172 const content::NotificationDetails& details) OVERRIDE; 172 const content::NotificationDetails& details) OVERRIDE;
173 void GotLanguage(const std::string& language); 173 void GotLanguage(const std::string& language);
174 content::NotificationRegistrar registrar_; 174 content::NotificationRegistrar registrar_;
175 DECLARE_EXTENSION_FUNCTION("tabs.detectLanguage", TABS_DETECTLANGUAGE) 175 DECLARE_EXTENSION_FUNCTION("tabs.detectLanguage", TABS_DETECTLANGUAGE)
176 }; 176 };
177 class TabsCaptureVisibleTabFunction : public AsyncExtensionFunction, 177 class TabsCaptureVisibleTabFunction : public AsyncExtensionFunction {
178 public content::NotificationObserver {
179 public: 178 public:
180 static void RegisterUserPrefs(PrefRegistrySyncable* registry); 179 static void RegisterUserPrefs(PrefRegistrySyncable* registry);
181 180
182 protected: 181 protected:
183 enum ImageFormat { 182 enum ImageFormat {
184 FORMAT_JPEG, 183 FORMAT_JPEG,
185 FORMAT_PNG 184 FORMAT_PNG
186 }; 185 };
187 186
188 // The default quality setting used when encoding jpegs. 187 // The default quality setting used when encoding jpegs.
189 static const int kDefaultQuality; 188 static const int kDefaultQuality;
190 189
191 virtual ~TabsCaptureVisibleTabFunction() {} 190 virtual ~TabsCaptureVisibleTabFunction() {}
192 virtual bool RunImpl() OVERRIDE; 191 virtual bool RunImpl() OVERRIDE;
193 virtual bool GetTabToCapture(content::WebContents** web_contents); 192 virtual bool GetTabToCapture(content::WebContents** web_contents);
194 virtual void Observe(int type,
195 const content::NotificationSource& source,
196 const content::NotificationDetails& details) OVERRIDE;
197 void SendResultFromBitmap(const SkBitmap& screen_capture); 193 void SendResultFromBitmap(const SkBitmap& screen_capture);
198 194
199 private: 195 private:
196 // Callback for the RWH::CopyFromBackingStore call.
200 void CopyFromBackingStoreComplete(bool succeeded, 197 void CopyFromBackingStoreComplete(bool succeeded,
201 const SkBitmap& bitmap); 198 const SkBitmap& bitmap);
202 199
203 content::NotificationRegistrar registrar_; 200 // Callback for the RWH::GetSnapshotFromRenderer call. This path is used if
201 // CopyFromBackingStore fails for some reason.
202 void GetSnapshotFromRendererComplete(bool succeeded,
203 const SkBitmap& bitmap);
204 void SendInternalError();
204 205
205 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). 206 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl().
206 ImageFormat image_format_; 207 ImageFormat image_format_;
207 208
208 // Quality setting to use when encoding jpegs. Set in RunImpl(). 209 // Quality setting to use when encoding jpegs. Set in RunImpl().
209 int image_quality_; 210 int image_quality_;
210 211
211 DECLARE_EXTENSION_FUNCTION("tabs.captureVisibleTab", TABS_CAPTUREVISIBLETAB) 212 DECLARE_EXTENSION_FUNCTION("tabs.captureVisibleTab", TABS_CAPTUREVISIBLETAB)
212 }; 213 };
213 214
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 }; 278 };
278 279
279 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { 280 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction {
280 private: 281 private:
281 virtual ~TabsInsertCSSFunction() {} 282 virtual ~TabsInsertCSSFunction() {}
282 283
283 DECLARE_EXTENSION_FUNCTION("tabs.insertCSS", TABS_INSERTCSS) 284 DECLARE_EXTENSION_FUNCTION("tabs.insertCSS", TABS_INSERTCSS)
284 }; 285 };
285 286
286 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ 287 #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') | content/common/view_messages.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698