| OLD | NEW |
| 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/active_install_data.h" | 10 #include "chrome/browser/extensions/active_install_data.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 class WebstorePrivateInstallBundleFunction | 47 class WebstorePrivateInstallBundleFunction |
| 48 : public ChromeAsyncExtensionFunction, | 48 : public ChromeAsyncExtensionFunction, |
| 49 public extensions::BundleInstaller::Delegate { | 49 public extensions::BundleInstaller::Delegate { |
| 50 public: | 50 public: |
| 51 DECLARE_EXTENSION_FUNCTION("webstorePrivate.installBundle", | 51 DECLARE_EXTENSION_FUNCTION("webstorePrivate.installBundle", |
| 52 WEBSTOREPRIVATE_INSTALLBUNDLE) | 52 WEBSTOREPRIVATE_INSTALLBUNDLE) |
| 53 | 53 |
| 54 WebstorePrivateInstallBundleFunction(); | 54 WebstorePrivateInstallBundleFunction(); |
| 55 | 55 |
| 56 // BundleInstaller::Delegate: | 56 // BundleInstaller::Delegate: |
| 57 virtual void OnBundleInstallApproved() override; | 57 void OnBundleInstallApproved() override; |
| 58 virtual void OnBundleInstallCanceled(bool user_initiated) override; | 58 void OnBundleInstallCanceled(bool user_initiated) override; |
| 59 virtual void OnBundleInstallCompleted() override; | 59 void OnBundleInstallCompleted() override; |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 virtual ~WebstorePrivateInstallBundleFunction(); | 62 ~WebstorePrivateInstallBundleFunction() override; |
| 63 | 63 |
| 64 // ExtensionFunction: | 64 // ExtensionFunction: |
| 65 virtual bool RunAsync() override; | 65 bool RunAsync() override; |
| 66 | 66 |
| 67 // Reads the extension |details| into |items|. | 67 // Reads the extension |details| into |items|. |
| 68 bool ReadBundleInfo( | 68 bool ReadBundleInfo( |
| 69 const api::webstore_private::InstallBundle::Params& details, | 69 const api::webstore_private::InstallBundle::Params& details, |
| 70 extensions::BundleInstaller::ItemList* items); | 70 extensions::BundleInstaller::ItemList* items); |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 scoped_refptr<extensions::BundleInstaller> bundle_; | 73 scoped_refptr<extensions::BundleInstaller> bundle_; |
| 74 }; | 74 }; |
| 75 | 75 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Invalid icon url. | 108 // Invalid icon url. |
| 109 INVALID_ICON_URL, | 109 INVALID_ICON_URL, |
| 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 WebstorePrivateBeginInstallWithManifest3Function(); | 115 WebstorePrivateBeginInstallWithManifest3Function(); |
| 116 | 116 |
| 117 // WebstoreInstallHelper::Delegate: | 117 // WebstoreInstallHelper::Delegate: |
| 118 virtual void OnWebstoreParseSuccess( | 118 void OnWebstoreParseSuccess(const std::string& id, |
| 119 const std::string& id, | 119 const SkBitmap& icon, |
| 120 const SkBitmap& icon, | 120 base::DictionaryValue* parsed_manifest) override; |
| 121 base::DictionaryValue* parsed_manifest) override; | 121 void OnWebstoreParseFailure(const std::string& id, |
| 122 virtual void OnWebstoreParseFailure( | 122 InstallHelperResultCode result_code, |
| 123 const std::string& id, | 123 const std::string& error_message) override; |
| 124 InstallHelperResultCode result_code, | |
| 125 const std::string& error_message) override; | |
| 126 | 124 |
| 127 // ExtensionInstallPrompt::Delegate: | 125 // ExtensionInstallPrompt::Delegate: |
| 128 virtual void InstallUIProceed() override; | 126 void InstallUIProceed() override; |
| 129 virtual void InstallUIAbort(bool user_initiated) override; | 127 void InstallUIAbort(bool user_initiated) override; |
| 130 | 128 |
| 131 protected: | 129 protected: |
| 132 virtual ~WebstorePrivateBeginInstallWithManifest3Function(); | 130 ~WebstorePrivateBeginInstallWithManifest3Function() override; |
| 133 | 131 |
| 134 // ExtensionFunction: | 132 // ExtensionFunction: |
| 135 virtual bool RunAsync() override; | 133 bool RunAsync() override; |
| 136 | 134 |
| 137 // Sets the result_ as a string based on |code|. | 135 // Sets the result_ as a string based on |code|. |
| 138 void SetResultCode(ResultCode code); | 136 void SetResultCode(ResultCode code); |
| 139 | 137 |
| 140 private: | 138 private: |
| 141 const char* ResultCodeToString(ResultCode code); | 139 const char* ResultCodeToString(ResultCode code); |
| 142 | 140 |
| 143 // These store the input parameters to the function. | 141 // These store the input parameters to the function. |
| 144 scoped_ptr<api::webstore_private::BeginInstallWithManifest3::Params> params_; | 142 scoped_ptr<api::webstore_private::BeginInstallWithManifest3::Params> params_; |
| 145 | 143 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 164 class WebstorePrivateCompleteInstallFunction | 162 class WebstorePrivateCompleteInstallFunction |
| 165 : public ChromeAsyncExtensionFunction, | 163 : public ChromeAsyncExtensionFunction, |
| 166 public WebstoreInstaller::Delegate { | 164 public WebstoreInstaller::Delegate { |
| 167 public: | 165 public: |
| 168 DECLARE_EXTENSION_FUNCTION("webstorePrivate.completeInstall", | 166 DECLARE_EXTENSION_FUNCTION("webstorePrivate.completeInstall", |
| 169 WEBSTOREPRIVATE_COMPLETEINSTALL) | 167 WEBSTOREPRIVATE_COMPLETEINSTALL) |
| 170 | 168 |
| 171 WebstorePrivateCompleteInstallFunction(); | 169 WebstorePrivateCompleteInstallFunction(); |
| 172 | 170 |
| 173 // WebstoreInstaller::Delegate: | 171 // WebstoreInstaller::Delegate: |
| 174 virtual void OnExtensionInstallSuccess(const std::string& id) override; | 172 void OnExtensionInstallSuccess(const std::string& id) override; |
| 175 virtual void OnExtensionInstallFailure( | 173 void OnExtensionInstallFailure( |
| 176 const std::string& id, | 174 const std::string& id, |
| 177 const std::string& error, | 175 const std::string& error, |
| 178 WebstoreInstaller::FailureReason reason) override; | 176 WebstoreInstaller::FailureReason reason) override; |
| 179 | 177 |
| 180 protected: | 178 protected: |
| 181 virtual ~WebstorePrivateCompleteInstallFunction(); | 179 ~WebstorePrivateCompleteInstallFunction() override; |
| 182 | 180 |
| 183 // ExtensionFunction: | 181 // ExtensionFunction: |
| 184 virtual bool RunAsync() override; | 182 bool RunAsync() override; |
| 185 | 183 |
| 186 private: | 184 private: |
| 187 scoped_ptr<WebstoreInstaller::Approval> approval_; | 185 scoped_ptr<WebstoreInstaller::Approval> approval_; |
| 188 scoped_ptr<ScopedActiveInstall> scoped_active_install_; | 186 scoped_ptr<ScopedActiveInstall> scoped_active_install_; |
| 189 | 187 |
| 190 void OnInstallSuccess(const std::string& id); | 188 void OnInstallSuccess(const std::string& id); |
| 191 }; | 189 }; |
| 192 | 190 |
| 193 class WebstorePrivateEnableAppLauncherFunction | 191 class WebstorePrivateEnableAppLauncherFunction |
| 194 : public ChromeSyncExtensionFunction { | 192 : public ChromeSyncExtensionFunction { |
| 195 public: | 193 public: |
| 196 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher", | 194 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher", |
| 197 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER) | 195 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER) |
| 198 | 196 |
| 199 WebstorePrivateEnableAppLauncherFunction(); | 197 WebstorePrivateEnableAppLauncherFunction(); |
| 200 | 198 |
| 201 protected: | 199 protected: |
| 202 virtual ~WebstorePrivateEnableAppLauncherFunction(); | 200 ~WebstorePrivateEnableAppLauncherFunction() override; |
| 203 | 201 |
| 204 // ExtensionFunction: | 202 // ExtensionFunction: |
| 205 virtual bool RunSync() override; | 203 bool RunSync() override; |
| 206 }; | 204 }; |
| 207 | 205 |
| 208 class WebstorePrivateGetBrowserLoginFunction | 206 class WebstorePrivateGetBrowserLoginFunction |
| 209 : public ChromeSyncExtensionFunction { | 207 : public ChromeSyncExtensionFunction { |
| 210 public: | 208 public: |
| 211 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getBrowserLogin", | 209 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getBrowserLogin", |
| 212 WEBSTOREPRIVATE_GETBROWSERLOGIN) | 210 WEBSTOREPRIVATE_GETBROWSERLOGIN) |
| 213 | 211 |
| 214 protected: | 212 protected: |
| 215 virtual ~WebstorePrivateGetBrowserLoginFunction() {} | 213 ~WebstorePrivateGetBrowserLoginFunction() override {} |
| 216 | 214 |
| 217 // ExtensionFunction: | 215 // ExtensionFunction: |
| 218 virtual bool RunSync() override; | 216 bool RunSync() override; |
| 219 }; | 217 }; |
| 220 | 218 |
| 221 class WebstorePrivateGetStoreLoginFunction | 219 class WebstorePrivateGetStoreLoginFunction |
| 222 : public ChromeSyncExtensionFunction { | 220 : public ChromeSyncExtensionFunction { |
| 223 public: | 221 public: |
| 224 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getStoreLogin", | 222 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getStoreLogin", |
| 225 WEBSTOREPRIVATE_GETSTORELOGIN) | 223 WEBSTOREPRIVATE_GETSTORELOGIN) |
| 226 | 224 |
| 227 protected: | 225 protected: |
| 228 virtual ~WebstorePrivateGetStoreLoginFunction() {} | 226 ~WebstorePrivateGetStoreLoginFunction() override {} |
| 229 | 227 |
| 230 // ExtensionFunction: | 228 // ExtensionFunction: |
| 231 virtual bool RunSync() override; | 229 bool RunSync() override; |
| 232 }; | 230 }; |
| 233 | 231 |
| 234 class WebstorePrivateSetStoreLoginFunction | 232 class WebstorePrivateSetStoreLoginFunction |
| 235 : public ChromeSyncExtensionFunction { | 233 : public ChromeSyncExtensionFunction { |
| 236 public: | 234 public: |
| 237 DECLARE_EXTENSION_FUNCTION("webstorePrivate.setStoreLogin", | 235 DECLARE_EXTENSION_FUNCTION("webstorePrivate.setStoreLogin", |
| 238 WEBSTOREPRIVATE_SETSTORELOGIN) | 236 WEBSTOREPRIVATE_SETSTORELOGIN) |
| 239 | 237 |
| 240 protected: | 238 protected: |
| 241 virtual ~WebstorePrivateSetStoreLoginFunction() {} | 239 ~WebstorePrivateSetStoreLoginFunction() override {} |
| 242 | 240 |
| 243 // ExtensionFunction: | 241 // ExtensionFunction: |
| 244 virtual bool RunSync() override; | 242 bool RunSync() override; |
| 245 }; | 243 }; |
| 246 | 244 |
| 247 class WebstorePrivateGetWebGLStatusFunction | 245 class WebstorePrivateGetWebGLStatusFunction |
| 248 : public ChromeAsyncExtensionFunction { | 246 : public ChromeAsyncExtensionFunction { |
| 249 public: | 247 public: |
| 250 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getWebGLStatus", | 248 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getWebGLStatus", |
| 251 WEBSTOREPRIVATE_GETWEBGLSTATUS) | 249 WEBSTOREPRIVATE_GETWEBGLSTATUS) |
| 252 | 250 |
| 253 WebstorePrivateGetWebGLStatusFunction(); | 251 WebstorePrivateGetWebGLStatusFunction(); |
| 254 | 252 |
| 255 protected: | 253 protected: |
| 256 virtual ~WebstorePrivateGetWebGLStatusFunction(); | 254 ~WebstorePrivateGetWebGLStatusFunction() override; |
| 257 | 255 |
| 258 void OnFeatureCheck(bool feature_allowed); | 256 void OnFeatureCheck(bool feature_allowed); |
| 259 | 257 |
| 260 // ExtensionFunction: | 258 // ExtensionFunction: |
| 261 virtual bool RunAsync() override; | 259 bool RunAsync() override; |
| 262 | 260 |
| 263 private: | 261 private: |
| 264 void CreateResult(bool webgl_allowed); | 262 void CreateResult(bool webgl_allowed); |
| 265 | 263 |
| 266 scoped_refptr<GPUFeatureChecker> feature_checker_; | 264 scoped_refptr<GPUFeatureChecker> feature_checker_; |
| 267 }; | 265 }; |
| 268 | 266 |
| 269 class WebstorePrivateGetIsLauncherEnabledFunction | 267 class WebstorePrivateGetIsLauncherEnabledFunction |
| 270 : public ChromeSyncExtensionFunction { | 268 : public ChromeSyncExtensionFunction { |
| 271 public: | 269 public: |
| 272 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getIsLauncherEnabled", | 270 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getIsLauncherEnabled", |
| 273 WEBSTOREPRIVATE_GETISLAUNCHERENABLED) | 271 WEBSTOREPRIVATE_GETISLAUNCHERENABLED) |
| 274 | 272 |
| 275 WebstorePrivateGetIsLauncherEnabledFunction() {} | 273 WebstorePrivateGetIsLauncherEnabledFunction() {} |
| 276 | 274 |
| 277 protected: | 275 protected: |
| 278 virtual ~WebstorePrivateGetIsLauncherEnabledFunction() {} | 276 ~WebstorePrivateGetIsLauncherEnabledFunction() override {} |
| 279 | 277 |
| 280 // ExtensionFunction: | 278 // ExtensionFunction: |
| 281 virtual bool RunSync() override; | 279 bool RunSync() override; |
| 282 | 280 |
| 283 private: | 281 private: |
| 284 void OnIsLauncherCheckCompleted(bool is_enabled); | 282 void OnIsLauncherCheckCompleted(bool is_enabled); |
| 285 }; | 283 }; |
| 286 | 284 |
| 287 class WebstorePrivateIsInIncognitoModeFunction | 285 class WebstorePrivateIsInIncognitoModeFunction |
| 288 : public ChromeSyncExtensionFunction { | 286 : public ChromeSyncExtensionFunction { |
| 289 public: | 287 public: |
| 290 DECLARE_EXTENSION_FUNCTION("webstorePrivate.isInIncognitoMode", | 288 DECLARE_EXTENSION_FUNCTION("webstorePrivate.isInIncognitoMode", |
| 291 WEBSTOREPRIVATE_ISININCOGNITOMODEFUNCTION) | 289 WEBSTOREPRIVATE_ISININCOGNITOMODEFUNCTION) |
| 292 | 290 |
| 293 WebstorePrivateIsInIncognitoModeFunction() {} | 291 WebstorePrivateIsInIncognitoModeFunction() {} |
| 294 | 292 |
| 295 protected: | 293 protected: |
| 296 virtual ~WebstorePrivateIsInIncognitoModeFunction() {} | 294 ~WebstorePrivateIsInIncognitoModeFunction() override {} |
| 297 | 295 |
| 298 // ExtensionFunction: | 296 // ExtensionFunction: |
| 299 virtual bool RunSync() override; | 297 bool RunSync() override; |
| 300 }; | 298 }; |
| 301 | 299 |
| 302 class WebstorePrivateLaunchEphemeralAppFunction | 300 class WebstorePrivateLaunchEphemeralAppFunction |
| 303 : public ChromeAsyncExtensionFunction { | 301 : public ChromeAsyncExtensionFunction { |
| 304 public: | 302 public: |
| 305 DECLARE_EXTENSION_FUNCTION("webstorePrivate.launchEphemeralApp", | 303 DECLARE_EXTENSION_FUNCTION("webstorePrivate.launchEphemeralApp", |
| 306 WEBSTOREPRIVATE_LAUNCHEPHEMERALAPP) | 304 WEBSTOREPRIVATE_LAUNCHEPHEMERALAPP) |
| 307 | 305 |
| 308 WebstorePrivateLaunchEphemeralAppFunction(); | 306 WebstorePrivateLaunchEphemeralAppFunction(); |
| 309 | 307 |
| 310 protected: | 308 protected: |
| 311 virtual ~WebstorePrivateLaunchEphemeralAppFunction(); | 309 ~WebstorePrivateLaunchEphemeralAppFunction() override; |
| 312 | 310 |
| 313 // ExtensionFunction: | 311 // ExtensionFunction: |
| 314 virtual bool RunAsync() override; | 312 bool RunAsync() override; |
| 315 | 313 |
| 316 private: | 314 private: |
| 317 void OnLaunchComplete(webstore_install::Result result, | 315 void OnLaunchComplete(webstore_install::Result result, |
| 318 const std::string& error); | 316 const std::string& error); |
| 319 void SetResult( | 317 void SetResult( |
| 320 api::webstore_private::LaunchEphemeralApp::Results::Result result, | 318 api::webstore_private::LaunchEphemeralApp::Results::Result result, |
| 321 const std::string& error); | 319 const std::string& error); |
| 322 }; | 320 }; |
| 323 | 321 |
| 324 class WebstorePrivateGetEphemeralAppsEnabledFunction | 322 class WebstorePrivateGetEphemeralAppsEnabledFunction |
| 325 : public ChromeSyncExtensionFunction { | 323 : public ChromeSyncExtensionFunction { |
| 326 public: | 324 public: |
| 327 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getEphemeralAppsEnabled", | 325 DECLARE_EXTENSION_FUNCTION("webstorePrivate.getEphemeralAppsEnabled", |
| 328 WEBSTOREPRIVATE_GETEPHEMERALAPPSENABLED) | 326 WEBSTOREPRIVATE_GETEPHEMERALAPPSENABLED) |
| 329 | 327 |
| 330 WebstorePrivateGetEphemeralAppsEnabledFunction(); | 328 WebstorePrivateGetEphemeralAppsEnabledFunction(); |
| 331 | 329 |
| 332 protected: | 330 protected: |
| 333 virtual ~WebstorePrivateGetEphemeralAppsEnabledFunction(); | 331 ~WebstorePrivateGetEphemeralAppsEnabledFunction() override; |
| 334 | 332 |
| 335 // ExtensionFunction: | 333 // ExtensionFunction: |
| 336 virtual bool RunSync() override; | 334 bool RunSync() override; |
| 337 }; | 335 }; |
| 338 | 336 |
| 339 } // namespace extensions | 337 } // namespace extensions |
| 340 | 338 |
| 341 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H
_ | 339 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H
_ |
| OLD | NEW |