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

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

Issue 9234042: Re-land alexbost's experimental offscreenTabs API. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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_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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "chrome/browser/extensions/extension_function.h" 13 #include "chrome/browser/extensions/extension_function.h"
14 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
16 #include "content/public/browser/web_contents_observer.h" 16 #include "content/public/browser/web_contents_observer.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 18
19 class BackingStore; 19 class BackingStore;
20 class Extension;
21 class GURL;
20 class SkBitmap; 22 class SkBitmap;
23 class TabContentsWrapper;
21 namespace base { 24 namespace base {
22 class DictionaryValue; 25 class DictionaryValue;
23 } // namespace base 26 } // namespace base
24 namespace content { 27 namespace content {
25 class WebContents; 28 class WebContents;
26 } // namespace content 29 } // namespace content
30
27 // Windows 31 // Windows
28 class GetWindowFunction : public SyncExtensionFunction { 32 class GetWindowFunction : public SyncExtensionFunction {
29 virtual ~GetWindowFunction() {} 33 virtual ~GetWindowFunction() {}
30 virtual bool RunImpl() OVERRIDE; 34 virtual bool RunImpl() OVERRIDE;
31 DECLARE_EXTENSION_FUNCTION_NAME("windows.get") 35 DECLARE_EXTENSION_FUNCTION_NAME("windows.get")
32 }; 36 };
33 class GetCurrentWindowFunction : public SyncExtensionFunction { 37 class GetCurrentWindowFunction : public SyncExtensionFunction {
34 virtual ~GetCurrentWindowFunction() {} 38 virtual ~GetCurrentWindowFunction() {}
35 virtual bool RunImpl() OVERRIDE; 39 virtual bool RunImpl() OVERRIDE;
36 DECLARE_EXTENSION_FUNCTION_NAME("windows.getCurrent") 40 DECLARE_EXTENSION_FUNCTION_NAME("windows.getCurrent")
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 }; 107 };
104 class HighlightTabsFunction : public SyncExtensionFunction { 108 class HighlightTabsFunction : public SyncExtensionFunction {
105 virtual ~HighlightTabsFunction() {} 109 virtual ~HighlightTabsFunction() {}
106 virtual bool RunImpl() OVERRIDE; 110 virtual bool RunImpl() OVERRIDE;
107 DECLARE_EXTENSION_FUNCTION_NAME("tabs.highlight") 111 DECLARE_EXTENSION_FUNCTION_NAME("tabs.highlight")
108 }; 112 };
109 class UpdateTabFunction : public AsyncExtensionFunction, 113 class UpdateTabFunction : public AsyncExtensionFunction,
110 public content::WebContentsObserver { 114 public content::WebContentsObserver {
111 public: 115 public:
112 UpdateTabFunction(); 116 UpdateTabFunction();
117
118 protected:
119 virtual ~UpdateTabFunction() {}
120 virtual bool UpdateURLIfPresent(base::DictionaryValue* update_props,
121 bool* is_async);
122 virtual void PopulateResult();
123
124 content::WebContents* web_contents_;
125
113 private: 126 private:
114 virtual ~UpdateTabFunction() {}
115 virtual bool RunImpl() OVERRIDE; 127 virtual bool RunImpl() OVERRIDE;
116 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; 128 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE;
117 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 129 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
118 void OnExecuteCodeFinished(int request_id, 130 void OnExecuteCodeFinished(int request_id,
119 bool success, 131 bool success,
120 const std::string& error); 132 const std::string& error);
121 void PopulateResult();
122 133
123 content::WebContents* web_contents_;
124 DECLARE_EXTENSION_FUNCTION_NAME("tabs.update") 134 DECLARE_EXTENSION_FUNCTION_NAME("tabs.update")
125 }; 135 };
126 class MoveTabsFunction : public SyncExtensionFunction { 136 class MoveTabsFunction : public SyncExtensionFunction {
127 virtual ~MoveTabsFunction() {} 137 virtual ~MoveTabsFunction() {}
128 virtual bool RunImpl() OVERRIDE; 138 virtual bool RunImpl() OVERRIDE;
129 DECLARE_EXTENSION_FUNCTION_NAME("tabs.move") 139 DECLARE_EXTENSION_FUNCTION_NAME("tabs.move")
130 }; 140 };
131 class ReloadTabFunction : public SyncExtensionFunction { 141 class ReloadTabFunction : public SyncExtensionFunction {
132 virtual ~ReloadTabFunction() {} 142 virtual ~ReloadTabFunction() {}
133 virtual bool RunImpl() OVERRIDE; 143 virtual bool RunImpl() OVERRIDE;
(...skipping 12 matching lines...) Expand all
146 156
147 virtual void Observe(int type, 157 virtual void Observe(int type,
148 const content::NotificationSource& source, 158 const content::NotificationSource& source,
149 const content::NotificationDetails& details) OVERRIDE; 159 const content::NotificationDetails& details) OVERRIDE;
150 void GotLanguage(const std::string& language); 160 void GotLanguage(const std::string& language);
151 content::NotificationRegistrar registrar_; 161 content::NotificationRegistrar registrar_;
152 DECLARE_EXTENSION_FUNCTION_NAME("tabs.detectLanguage") 162 DECLARE_EXTENSION_FUNCTION_NAME("tabs.detectLanguage")
153 }; 163 };
154 class CaptureVisibleTabFunction : public AsyncExtensionFunction, 164 class CaptureVisibleTabFunction : public AsyncExtensionFunction,
155 public content::NotificationObserver { 165 public content::NotificationObserver {
156 private: 166 protected:
157 enum ImageFormat { 167 enum ImageFormat {
158 FORMAT_JPEG, 168 FORMAT_JPEG,
159 FORMAT_PNG 169 FORMAT_PNG
160 }; 170 };
161 171
162 // The default quality setting used when encoding jpegs. 172 // The default quality setting used when encoding jpegs.
163 static const int kDefaultQuality; 173 static const int kDefaultQuality;
164 174
165 virtual ~CaptureVisibleTabFunction() {} 175 virtual ~CaptureVisibleTabFunction() {}
166 virtual bool RunImpl() OVERRIDE; 176 virtual bool RunImpl() OVERRIDE;
177 virtual bool GetTabToCapture(content::WebContents** web_contents,
178 TabContentsWrapper** wrapper);
167 virtual void Observe(int type, 179 virtual void Observe(int type,
168 const content::NotificationSource& source, 180 const content::NotificationSource& source,
169 const content::NotificationDetails& details) OVERRIDE; 181 const content::NotificationDetails& details) OVERRIDE;
170 bool CaptureSnapshotFromBackingStore(BackingStore* backing_store);
171 void SendResultFromBitmap(const SkBitmap& screen_capture); 182 void SendResultFromBitmap(const SkBitmap& screen_capture);
172 183
173 content::NotificationRegistrar registrar_; 184 content::NotificationRegistrar registrar_;
174 185
175 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). 186 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl().
176 ImageFormat image_format_; 187 ImageFormat image_format_;
177 188
178 // Quality setting to use when encoding jpegs. Set in RunImpl(). 189 // Quality setting to use when encoding jpegs. Set in RunImpl().
179 int image_quality_; 190 int image_quality_;
180 191
181 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab") 192 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab")
182 }; 193 };
183 194
184 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__ 195 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tab_util.cc ('k') | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698