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

Side by Side Diff: chrome/browser/extensions/api/webstore_private/webstore_private_api.h

Issue 21046003: Move webstore_private API functions registrations out of ExtensionFunctionRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/webstore_private/webstore_private_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/browser/extensions/bundle_installer.h" 10 #include "chrome/browser/extensions/bundle_installer.h"
(...skipping 24 matching lines...) Expand all
35 static void SetWebstoreInstallerDelegateForTesting( 35 static void SetWebstoreInstallerDelegateForTesting(
36 WebstoreInstaller::Delegate* delegate); 36 WebstoreInstaller::Delegate* delegate);
37 37
38 // Gets the pending approval for the |extension_id| in |profile|. Pending 38 // Gets the pending approval for the |extension_id| in |profile|. Pending
39 // approvals are held between the calls to beginInstallWithManifest and 39 // approvals are held between the calls to beginInstallWithManifest and
40 // completeInstall. This should only be used for testing. 40 // completeInstall. This should only be used for testing.
41 static scoped_ptr<WebstoreInstaller::Approval> PopApprovalForTesting( 41 static scoped_ptr<WebstoreInstaller::Approval> PopApprovalForTesting(
42 Profile* profile, const std::string& extension_id); 42 Profile* profile, const std::string& extension_id);
43 }; 43 };
44 44
45 class InstallBundleFunction : public AsyncExtensionFunction, 45 class WebstorePrivateInstallBundleFunction : public AsyncExtensionFunction,
46 public extensions::BundleInstaller::Delegate { 46 public extensions::BundleInstaller::Delegate {
47 public: 47 public:
48 DECLARE_EXTENSION_FUNCTION("webstorePrivate.installBundle", 48 DECLARE_EXTENSION_FUNCTION("webstorePrivate.installBundle",
49 WEBSTOREPRIVATE_INSTALLBUNDLE) 49 WEBSTOREPRIVATE_INSTALLBUNDLE)
50 50
51 InstallBundleFunction(); 51 WebstorePrivateInstallBundleFunction();
52 52
53 // BundleInstaller::Delegate: 53 // BundleInstaller::Delegate:
54 virtual void OnBundleInstallApproved() OVERRIDE; 54 virtual void OnBundleInstallApproved() OVERRIDE;
55 virtual void OnBundleInstallCanceled(bool user_initiated) OVERRIDE; 55 virtual void OnBundleInstallCanceled(bool user_initiated) OVERRIDE;
56 virtual void OnBundleInstallCompleted() OVERRIDE; 56 virtual void OnBundleInstallCompleted() OVERRIDE;
57 57
58 protected: 58 protected:
59 virtual ~InstallBundleFunction(); 59 virtual ~WebstorePrivateInstallBundleFunction();
60 60
61 // ExtensionFunction: 61 // ExtensionFunction:
62 virtual bool RunImpl() OVERRIDE; 62 virtual bool RunImpl() OVERRIDE;
63 63
64 // Reads the extension |details| into |items|. 64 // Reads the extension |details| into |items|.
65 bool ReadBundleInfo(base::ListValue* details, 65 bool ReadBundleInfo(base::ListValue* details,
66 extensions::BundleInstaller::ItemList* items); 66 extensions::BundleInstaller::ItemList* items);
67 67
68 private: 68 private:
69 scoped_refptr<extensions::BundleInstaller> bundle_; 69 scoped_refptr<extensions::BundleInstaller> bundle_;
70 }; 70 };
71 71
72 class BeginInstallWithManifestFunction 72 class WebstorePrivateBeginInstallWithManifest3Function
73 : public AsyncExtensionFunction, 73 : public AsyncExtensionFunction,
74 public ExtensionInstallPrompt::Delegate, 74 public ExtensionInstallPrompt::Delegate,
75 public WebstoreInstallHelper::Delegate, 75 public WebstoreInstallHelper::Delegate,
76 public SigninTracker::Observer { 76 public SigninTracker::Observer {
77 public: 77 public:
78 DECLARE_EXTENSION_FUNCTION("webstorePrivate.beginInstallWithManifest3", 78 DECLARE_EXTENSION_FUNCTION("webstorePrivate.beginInstallWithManifest3",
79 WEBSTOREPRIVATE_BEGININSTALLWITHMANIFEST3) 79 WEBSTOREPRIVATE_BEGININSTALLWITHMANIFEST3)
80 80
81 // Result codes for the return value. If you change this, make sure to 81 // Result codes for the return value. If you change this, make sure to
82 // update the description for the beginInstallWithManifest3 callback in 82 // update the description for the beginInstallWithManifest3 callback in
(...skipping 22 matching lines...) Expand all
105 // Invalid icon url. 105 // Invalid icon url.
106 INVALID_ICON_URL, 106 INVALID_ICON_URL,
107 107
108 // Signin has failed. 108 // Signin has failed.
109 SIGNIN_FAILED, 109 SIGNIN_FAILED,
110 110
111 // An extension with the same extension id has already been installed. 111 // An extension with the same extension id has already been installed.
112 ALREADY_INSTALLED, 112 ALREADY_INSTALLED,
113 }; 113 };
114 114
115 BeginInstallWithManifestFunction(); 115 WebstorePrivateBeginInstallWithManifest3Function();
116 116
117 // WebstoreInstallHelper::Delegate: 117 // WebstoreInstallHelper::Delegate:
118 virtual void OnWebstoreParseSuccess( 118 virtual void OnWebstoreParseSuccess(
119 const std::string& id, 119 const std::string& id,
120 const SkBitmap& icon, 120 const SkBitmap& icon,
121 base::DictionaryValue* parsed_manifest) OVERRIDE; 121 base::DictionaryValue* parsed_manifest) OVERRIDE;
122 virtual void OnWebstoreParseFailure( 122 virtual void OnWebstoreParseFailure(
123 const std::string& id, 123 const std::string& id,
124 InstallHelperResultCode result_code, 124 InstallHelperResultCode result_code,
125 const std::string& error_message) OVERRIDE; 125 const std::string& error_message) OVERRIDE;
126 126
127 // ExtensionInstallPrompt::Delegate: 127 // ExtensionInstallPrompt::Delegate:
128 virtual void InstallUIProceed() OVERRIDE; 128 virtual void InstallUIProceed() OVERRIDE;
129 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; 129 virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
130 130
131 protected: 131 protected:
132 virtual ~BeginInstallWithManifestFunction(); 132 virtual ~WebstorePrivateBeginInstallWithManifest3Function();
133 133
134 // ExtensionFunction: 134 // ExtensionFunction:
135 virtual bool RunImpl() OVERRIDE; 135 virtual bool RunImpl() OVERRIDE;
136 136
137 // Sets the result_ as a string based on |code|. 137 // Sets the result_ as a string based on |code|.
138 void SetResultCode(ResultCode code); 138 void SetResultCode(ResultCode code);
139 139
140 private: 140 private:
141 // SigninTracker::Observer override. 141 // SigninTracker::Observer override.
142 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; 142 virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE;
(...skipping 17 matching lines...) Expand all
160 // A dummy Extension object we create for the purposes of using 160 // A dummy Extension object we create for the purposes of using
161 // ExtensionInstallPrompt to prompt for confirmation of the install. 161 // ExtensionInstallPrompt to prompt for confirmation of the install.
162 scoped_refptr<extensions::Extension> dummy_extension_; 162 scoped_refptr<extensions::Extension> dummy_extension_;
163 163
164 // The class that displays the install prompt. 164 // The class that displays the install prompt.
165 scoped_ptr<ExtensionInstallPrompt> install_prompt_; 165 scoped_ptr<ExtensionInstallPrompt> install_prompt_;
166 166
167 scoped_ptr<SigninTracker> signin_tracker_; 167 scoped_ptr<SigninTracker> signin_tracker_;
168 }; 168 };
169 169
170 class CompleteInstallFunction 170 class WebstorePrivateCompleteInstallFunction
171 : public AsyncExtensionFunction, 171 : public AsyncExtensionFunction,
172 public WebstoreInstaller::Delegate { 172 public WebstoreInstaller::Delegate {
173 public: 173 public:
174 DECLARE_EXTENSION_FUNCTION("webstorePrivate.completeInstall", 174 DECLARE_EXTENSION_FUNCTION("webstorePrivate.completeInstall",
175 WEBSTOREPRIVATE_COMPLETEINSTALL) 175 WEBSTOREPRIVATE_COMPLETEINSTALL)
176 176
177 CompleteInstallFunction(); 177 WebstorePrivateCompleteInstallFunction();
178 178
179 // WebstoreInstaller::Delegate: 179 // WebstoreInstaller::Delegate:
180 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; 180 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE;
181 virtual void OnExtensionInstallFailure( 181 virtual void OnExtensionInstallFailure(
182 const std::string& id, 182 const std::string& id,
183 const std::string& error, 183 const std::string& error,
184 WebstoreInstaller::FailureReason reason) OVERRIDE; 184 WebstoreInstaller::FailureReason reason) OVERRIDE;
185 185
186 protected: 186 protected:
187 virtual ~CompleteInstallFunction(); 187 virtual ~WebstorePrivateCompleteInstallFunction();
188 188
189 // ExtensionFunction: 189 // ExtensionFunction:
190 virtual bool RunImpl() OVERRIDE; 190 virtual bool RunImpl() OVERRIDE;
191 191
192 private: 192 private:
193 scoped_ptr<WebstoreInstaller::Approval> approval_; 193 scoped_ptr<WebstoreInstaller::Approval> approval_;
194 }; 194 };
195 195
196 class EnableAppLauncherFunction 196 class WebstorePrivateEnableAppLauncherFunction
197 : public AsyncExtensionFunction { 197 : public AsyncExtensionFunction {
198 public: 198 public:
199 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher", 199 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher",
200 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER) 200 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER)
201 201
202 EnableAppLauncherFunction(); 202 WebstorePrivateEnableAppLauncherFunction();
203 203
204 protected: 204 protected:
205 virtual ~EnableAppLauncherFunction(); 205 virtual ~WebstorePrivateEnableAppLauncherFunction();
206 206
207 // ExtensionFunction: 207 // ExtensionFunction:
208 virtual bool RunImpl() OVERRIDE; 208 virtual bool RunImpl() OVERRIDE;
209 }; 209 };
210 210
211 class GetBrowserLoginFunction : public SyncExtensionFunction { 211 class WebstorePrivateGetBrowserLoginFunction : public SyncExtensionFunction {
212 public: 212 public:
213 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getBrowserLogin", 213 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getBrowserLogin",
214 WEBSTOREPRIVATE_GETBROWSERLOGIN) 214 WEBSTOREPRIVATE_GETBROWSERLOGIN)
215 215
216 protected: 216 protected:
217 virtual ~GetBrowserLoginFunction() {} 217 virtual ~WebstorePrivateGetBrowserLoginFunction() {}
218 218
219 // ExtensionFunction: 219 // ExtensionFunction:
220 virtual bool RunImpl() OVERRIDE; 220 virtual bool RunImpl() OVERRIDE;
221 }; 221 };
222 222
223 class GetStoreLoginFunction : public SyncExtensionFunction { 223 class WebstorePrivateGetStoreLoginFunction : public SyncExtensionFunction {
224 public: 224 public:
225 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getStoreLogin", 225 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getStoreLogin",
226 WEBSTOREPRIVATE_GETSTORELOGIN) 226 WEBSTOREPRIVATE_GETSTORELOGIN)
227 227
228 protected: 228 protected:
229 virtual ~GetStoreLoginFunction() {} 229 virtual ~WebstorePrivateGetStoreLoginFunction() {}
230 230
231 // ExtensionFunction: 231 // ExtensionFunction:
232 virtual bool RunImpl() OVERRIDE; 232 virtual bool RunImpl() OVERRIDE;
233 }; 233 };
234 234
235 class SetStoreLoginFunction : public SyncExtensionFunction { 235 class WebstorePrivateSetStoreLoginFunction : public SyncExtensionFunction {
236 public: 236 public:
237 DECLARE_EXTENSION_FUNCTION("webstorePrivate.setStoreLogin", 237 DECLARE_EXTENSION_FUNCTION("webstorePrivate.setStoreLogin",
238 WEBSTOREPRIVATE_SETSTORELOGIN) 238 WEBSTOREPRIVATE_SETSTORELOGIN)
239 239
240 protected: 240 protected:
241 virtual ~SetStoreLoginFunction() {} 241 virtual ~WebstorePrivateSetStoreLoginFunction() {}
242 242
243 // ExtensionFunction: 243 // ExtensionFunction:
244 virtual bool RunImpl() OVERRIDE; 244 virtual bool RunImpl() OVERRIDE;
245 }; 245 };
246 246
247 class GetWebGLStatusFunction : public AsyncExtensionFunction { 247 class WebstorePrivateGetWebGLStatusFunction : public AsyncExtensionFunction {
248 public: 248 public:
249 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getWebGLStatus", 249 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getWebGLStatus",
250 WEBSTOREPRIVATE_GETWEBGLSTATUS) 250 WEBSTOREPRIVATE_GETWEBGLSTATUS)
251 251
252 GetWebGLStatusFunction(); 252 WebstorePrivateGetWebGLStatusFunction();
253 253
254 protected: 254 protected:
255 virtual ~GetWebGLStatusFunction(); 255 virtual ~WebstorePrivateGetWebGLStatusFunction();
256 256
257 void OnFeatureCheck(bool feature_allowed); 257 void OnFeatureCheck(bool feature_allowed);
258 258
259 // ExtensionFunction: 259 // ExtensionFunction:
260 virtual bool RunImpl() OVERRIDE; 260 virtual bool RunImpl() OVERRIDE;
261 261
262 private: 262 private:
263 void CreateResult(bool webgl_allowed); 263 void CreateResult(bool webgl_allowed);
264 264
265 scoped_refptr<GPUFeatureChecker> feature_checker_; 265 scoped_refptr<GPUFeatureChecker> feature_checker_;
266 }; 266 };
267 267
268 class GetIsLauncherEnabledFunction : public AsyncExtensionFunction { 268 class WebstorePrivateGetIsLauncherEnabledFunction
269 : public AsyncExtensionFunction {
269 public: 270 public:
270 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getIsLauncherEnabled", 271 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getIsLauncherEnabled",
271 WEBSTOREPRIVATE_GETISLAUNCHERENABLED) 272 WEBSTOREPRIVATE_GETISLAUNCHERENABLED)
272 273
273 GetIsLauncherEnabledFunction() {} 274 WebstorePrivateGetIsLauncherEnabledFunction() {}
274 275
275 protected: 276 protected:
276 virtual ~GetIsLauncherEnabledFunction() {} 277 virtual ~WebstorePrivateGetIsLauncherEnabledFunction() {}
277 278
278 // ExtensionFunction: 279 // ExtensionFunction:
279 virtual bool RunImpl() OVERRIDE; 280 virtual bool RunImpl() OVERRIDE;
280 281
281 private: 282 private:
282 void OnIsLauncherCheckCompleted(bool is_enabled); 283 void OnIsLauncherCheckCompleted(bool is_enabled);
283 }; 284 };
284 285
285 class IsInIncognitoModeFunction : public AsyncExtensionFunction { 286 class WebstorePrivateIsInIncognitoModeFunction : public AsyncExtensionFunction {
286 public: 287 public:
287 DECLARE_EXTENSION_FUNCTION("webstorePrivate.isInIncognitoMode", 288 DECLARE_EXTENSION_FUNCTION("webstorePrivate.isInIncognitoMode",
288 WEBSTOREPRIVATE_ISININCOGNITOMODEFUNCTION) 289 WEBSTOREPRIVATE_ISININCOGNITOMODEFUNCTION)
289 290
290 IsInIncognitoModeFunction() {} 291 WebstorePrivateIsInIncognitoModeFunction() {}
291 292
292 protected: 293 protected:
293 virtual ~IsInIncognitoModeFunction() {} 294 virtual ~WebstorePrivateIsInIncognitoModeFunction() {}
294 295
295 // ExtensionFunction: 296 // ExtensionFunction:
296 virtual bool RunImpl() OVERRIDE; 297 virtual bool RunImpl() OVERRIDE;
297 }; 298 };
298 299
299 } // namespace extensions 300 } // namespace extensions
300 301
301 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H _ 302 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H _
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/webstore_private/webstore_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698