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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.h

Issue 1527015: Support PNG and quality control in chrome.tabs.captureVisibleTab(). (Closed)
Patch Set: Rebase for checkin. Created 10 years, 8 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_EXTENSION_TABS_MODULE_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/browser/extensions/extension_function.h" 10 #include "chrome/browser/extensions/extension_function.h"
11 #include "chrome/common/notification_service.h" 11 #include "chrome/common/notification_service.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 virtual void Observe(NotificationType type, 134 virtual void Observe(NotificationType type,
135 const NotificationSource& source, 135 const NotificationSource& source,
136 const NotificationDetails& details); 136 const NotificationDetails& details);
137 void GotLanguage(const std::string& language); 137 void GotLanguage(const std::string& language);
138 NotificationRegistrar registrar_; 138 NotificationRegistrar registrar_;
139 DECLARE_EXTENSION_FUNCTION_NAME("tabs.detectLanguage") 139 DECLARE_EXTENSION_FUNCTION_NAME("tabs.detectLanguage")
140 }; 140 };
141 class CaptureVisibleTabFunction : public AsyncExtensionFunction, 141 class CaptureVisibleTabFunction : public AsyncExtensionFunction,
142 public NotificationObserver { 142 public NotificationObserver {
143 private: 143 private:
144 enum ImageFormat {
145 FORMAT_JPEG,
146 FORMAT_PNG
147 };
148
149 // The default quality setting used when encoding jpegs.
150 static const int kDefaultQuality;
151
144 ~CaptureVisibleTabFunction() {} 152 ~CaptureVisibleTabFunction() {}
145 virtual bool RunImpl(); 153 virtual bool RunImpl();
146 virtual bool CaptureSnapshotFromBackingStore(BackingStore* backing_store); 154 virtual bool CaptureSnapshotFromBackingStore(BackingStore* backing_store);
147 virtual void Observe(NotificationType type, 155 virtual void Observe(NotificationType type,
148 const NotificationSource& source, 156 const NotificationSource& source,
149 const NotificationDetails& details); 157 const NotificationDetails& details);
150 virtual void SendResultFromBitmap(const SkBitmap& screen_capture); 158 virtual void SendResultFromBitmap(const SkBitmap& screen_capture);
151 159
152 NotificationRegistrar registrar_; 160 NotificationRegistrar registrar_;
153 161
162 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl().
163 ImageFormat image_format_;
164
165 // Quality setting to use when encoding jpegs. Set in RunImpl().
166 int image_quality_;
167
154 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") 168 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab")
155 }; 169 };
156 170
157 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ 171 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_function.cc ('k') | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698