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

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

Issue 10544023: Moving the tabs_module API into a separate directory in api/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Correcting the order of includes. Created 8 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TABS_MODULE_H__
7 #pragma once
8
9 #include <string>
10 #include <vector>
11
12 #include "base/compiler_specific.h"
13 #include "chrome/browser/extensions/extension_function.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
16 #include "googleurl/src/gurl.h"
17
18 class BackingStore;
19 class GURL;
20 class SkBitmap;
21 class TabContents;
22 typedef TabContents TabContentsWrapper;
23
24 namespace base {
25 class DictionaryValue;
26 }
27
28 namespace content {
29 class WebContents;
30 }
31
32 namespace skia {
33 class PlatformCanvas;
34 }
35
36 // Windows
37 class GetWindowFunction : public SyncExtensionFunction {
38 virtual ~GetWindowFunction() {}
39 virtual bool RunImpl() OVERRIDE;
40 DECLARE_EXTENSION_FUNCTION_NAME("windows.get")
41 };
42 class GetCurrentWindowFunction : public SyncExtensionFunction {
43 virtual ~GetCurrentWindowFunction() {}
44 virtual bool RunImpl() OVERRIDE;
45 DECLARE_EXTENSION_FUNCTION_NAME("windows.getCurrent")
46 };
47 class GetLastFocusedWindowFunction : public SyncExtensionFunction {
48 virtual ~GetLastFocusedWindowFunction() {}
49 virtual bool RunImpl() OVERRIDE;
50 DECLARE_EXTENSION_FUNCTION_NAME("windows.getLastFocused")
51 };
52 class GetAllWindowsFunction : public SyncExtensionFunction {
53 virtual ~GetAllWindowsFunction() {}
54 virtual bool RunImpl() OVERRIDE;
55 DECLARE_EXTENSION_FUNCTION_NAME("windows.getAll")
56 };
57 class CreateWindowFunction : public SyncExtensionFunction {
58 virtual ~CreateWindowFunction() {}
59 virtual bool RunImpl() OVERRIDE;
60 // Returns whether the window should be created in incognito mode.
61 // |urls| is the list of urls to open. If we are creating an incognito window,
62 // the function will remove these urls which may not be opened in incognito
63 // mode. If window creation leads the browser into an erroneous state,
64 // |is_error| is set to true (also, error_ member variable is assigned
65 // the proper error message).
66 bool ShouldOpenIncognitoWindow(const base::DictionaryValue* args,
67 std::vector<GURL>* urls,
68 bool* is_error);
69 DECLARE_EXTENSION_FUNCTION_NAME("windows.create")
70 };
71 class UpdateWindowFunction : public SyncExtensionFunction {
72 virtual ~UpdateWindowFunction() {}
73 virtual bool RunImpl() OVERRIDE;
74 DECLARE_EXTENSION_FUNCTION_NAME("windows.update")
75 };
76 class RemoveWindowFunction : public SyncExtensionFunction {
77 virtual ~RemoveWindowFunction() {}
78 virtual bool RunImpl() OVERRIDE;
79 DECLARE_EXTENSION_FUNCTION_NAME("windows.remove")
80 };
81
82 // Tabs
83 class GetTabFunction : public SyncExtensionFunction {
84 virtual ~GetTabFunction() {}
85 virtual bool RunImpl() OVERRIDE;
86 DECLARE_EXTENSION_FUNCTION_NAME("tabs.get")
87 };
88 class GetCurrentTabFunction : public SyncExtensionFunction {
89 virtual ~GetCurrentTabFunction() {}
90 virtual bool RunImpl() OVERRIDE;
91 DECLARE_EXTENSION_FUNCTION_NAME("tabs.getCurrent")
92 };
93 class GetSelectedTabFunction : public SyncExtensionFunction {
94 virtual ~GetSelectedTabFunction() {}
95 virtual bool RunImpl() OVERRIDE;
96 DECLARE_EXTENSION_FUNCTION_NAME("tabs.getSelected")
97 };
98 class GetAllTabsInWindowFunction : public SyncExtensionFunction {
99 virtual ~GetAllTabsInWindowFunction() {}
100 virtual bool RunImpl() OVERRIDE;
101 DECLARE_EXTENSION_FUNCTION_NAME("tabs.getAllInWindow")
102 };
103 class QueryTabsFunction : public SyncExtensionFunction {
104 virtual ~QueryTabsFunction() {}
105 virtual bool RunImpl() OVERRIDE;
106 DECLARE_EXTENSION_FUNCTION_NAME("tabs.query")
107 };
108 class CreateTabFunction : public SyncExtensionFunction {
109 virtual ~CreateTabFunction() {}
110 virtual bool RunImpl() OVERRIDE;
111 DECLARE_EXTENSION_FUNCTION_NAME("tabs.create")
112 };
113 class HighlightTabsFunction : public SyncExtensionFunction {
114 virtual ~HighlightTabsFunction() {}
115 virtual bool RunImpl() OVERRIDE;
116 DECLARE_EXTENSION_FUNCTION_NAME("tabs.highlight")
117 };
118 class UpdateTabFunction : public AsyncExtensionFunction {
119 public:
120 UpdateTabFunction();
121
122 protected:
123 virtual ~UpdateTabFunction() {}
124 virtual bool UpdateURLIfPresent(base::DictionaryValue* update_props,
125 bool* is_async);
126 virtual void PopulateResult();
127
128 TabContentsWrapper* tab_contents_;
129
130 private:
131 virtual bool RunImpl() OVERRIDE;
132 void OnExecuteCodeFinished(bool success,
133 int32 page_id,
134 const std::string& error);
135
136 DECLARE_EXTENSION_FUNCTION_NAME("tabs.update")
137 };
138 class MoveTabsFunction : public SyncExtensionFunction {
139 virtual ~MoveTabsFunction() {}
140 virtual bool RunImpl() OVERRIDE;
141 DECLARE_EXTENSION_FUNCTION_NAME("tabs.move")
142 };
143 class ReloadTabFunction : public SyncExtensionFunction {
144 virtual ~ReloadTabFunction() {}
145 virtual bool RunImpl() OVERRIDE;
146 DECLARE_EXTENSION_FUNCTION_NAME("tabs.reload")
147 };
148 class RemoveTabsFunction : public SyncExtensionFunction {
149 virtual ~RemoveTabsFunction() {}
150 virtual bool RunImpl() OVERRIDE;
151 DECLARE_EXTENSION_FUNCTION_NAME("tabs.remove")
152 };
153 class DetectTabLanguageFunction : public AsyncExtensionFunction,
154 public content::NotificationObserver {
155 private:
156 virtual ~DetectTabLanguageFunction() {}
157 virtual bool RunImpl() OVERRIDE;
158
159 virtual void Observe(int type,
160 const content::NotificationSource& source,
161 const content::NotificationDetails& details) OVERRIDE;
162 void GotLanguage(const std::string& language);
163 content::NotificationRegistrar registrar_;
164 DECLARE_EXTENSION_FUNCTION_NAME("tabs.detectLanguage")
165 };
166 class CaptureVisibleTabFunction : public AsyncExtensionFunction,
167 public content::NotificationObserver {
168 protected:
169 enum ImageFormat {
170 FORMAT_JPEG,
171 FORMAT_PNG
172 };
173
174 // The default quality setting used when encoding jpegs.
175 static const int kDefaultQuality;
176
177 virtual ~CaptureVisibleTabFunction() {}
178 virtual bool RunImpl() OVERRIDE;
179 virtual bool GetTabToCapture(content::WebContents** web_contents,
180 TabContentsWrapper** wrapper);
181 virtual void Observe(int type,
182 const content::NotificationSource& source,
183 const content::NotificationDetails& details) OVERRIDE;
184 void SendResultFromBitmap(const SkBitmap& screen_capture);
185
186 private:
187 void CopyFromBackingStoreComplete(skia::PlatformCanvas* canvas,
188 bool succeeded);
189
190 content::NotificationRegistrar registrar_;
191
192 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl().
193 ImageFormat image_format_;
194
195 // Quality setting to use when encoding jpegs. Set in RunImpl().
196 int image_quality_;
197
198 DECLARE_EXTENSION_FUNCTION_NAME("tabs.captureVisibleTab")
199 };
200
201 #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