| 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" |
| 11 #include "chrome/browser/extensions/bundle_installer.h" |
| 11 #include "chrome/browser/extensions/chrome_extension_function_details.h" | 12 #include "chrome/browser/extensions/chrome_extension_function_details.h" |
| 12 #include "chrome/browser/extensions/extension_install_prompt.h" | 13 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 13 #include "chrome/browser/extensions/webstore_install_helper.h" | 14 #include "chrome/browser/extensions/webstore_install_helper.h" |
| 14 #include "chrome/browser/extensions/webstore_installer.h" | 15 #include "chrome/browser/extensions/webstore_installer.h" |
| 15 #include "chrome/common/extensions/api/webstore_private.h" | 16 #include "chrome/common/extensions/api/webstore_private.h" |
| 16 #include "chrome/common/extensions/webstore_install_result.h" | 17 #include "chrome/common/extensions/webstore_install_result.h" |
| 17 #include "extensions/browser/extension_function.h" | 18 #include "extensions/browser/extension_function.h" |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 | 20 |
| 20 class GPUFeatureChecker; | 21 class GPUFeatureChecker; |
| 22 class SafeImageFetcher; |
| 21 | 23 |
| 22 namespace extensions { | 24 namespace extensions { |
| 23 | 25 |
| 24 class WebstorePrivateApi { | 26 class WebstorePrivateApi { |
| 25 public: | 27 public: |
| 26 // Allows you to override the WebstoreInstaller delegate for testing. | 28 // Allows you to override the WebstoreInstaller delegate for testing. |
| 27 static void SetWebstoreInstallerDelegateForTesting( | 29 static void SetWebstoreInstallerDelegateForTesting( |
| 28 WebstoreInstaller::Delegate* delegate); | 30 WebstoreInstaller::Delegate* delegate); |
| 29 | 31 |
| 30 // Gets the pending approval for the |extension_id| in |profile|. Pending | 32 // Gets the pending approval for the |extension_id| in |profile|. Pending |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 WebstorePrivateShowPermissionPromptForDelegatedInstallFunction(); | 177 WebstorePrivateShowPermissionPromptForDelegatedInstallFunction(); |
| 176 | 178 |
| 177 private: | 179 private: |
| 178 ~WebstorePrivateShowPermissionPromptForDelegatedInstallFunction() override; | 180 ~WebstorePrivateShowPermissionPromptForDelegatedInstallFunction() override; |
| 179 | 181 |
| 180 void ShowPrompt(ExtensionInstallPrompt* install_prompt) override; | 182 void ShowPrompt(ExtensionInstallPrompt* install_prompt) override; |
| 181 scoped_ptr<base::ListValue> CreateResults( | 183 scoped_ptr<base::ListValue> CreateResults( |
| 182 api::webstore_private::Result result) const override; | 184 api::webstore_private::Result result) const override; |
| 183 }; | 185 }; |
| 184 | 186 |
| 187 class WebstorePrivateInstallBundleFunction : public UIThreadExtensionFunction { |
| 188 public: |
| 189 DECLARE_EXTENSION_FUNCTION("webstorePrivate.installBundle", |
| 190 WEBSTOREPRIVATE_INSTALLBUNDLE) |
| 191 |
| 192 WebstorePrivateInstallBundleFunction(); |
| 193 |
| 194 private: |
| 195 ~WebstorePrivateInstallBundleFunction() override; |
| 196 |
| 197 // ExtensionFunction: |
| 198 ExtensionFunction::ResponseAction Run() override; |
| 199 |
| 200 void OnIconFetched(const SkBitmap& icon); |
| 201 |
| 202 void OnInstallApproval(BundleInstaller::ApprovalState state); |
| 203 void OnInstallComplete(); |
| 204 |
| 205 ChromeExtensionFunctionDetails chrome_details_; |
| 206 |
| 207 // This stores the input parameters to the function. |
| 208 scoped_ptr<api::webstore_private::InstallBundle::Params> params_; |
| 209 |
| 210 scoped_ptr<extensions::BundleInstaller> bundle_; |
| 211 |
| 212 scoped_ptr<SafeImageFetcher> icon_fetcher_; |
| 213 }; |
| 214 |
| 185 class WebstorePrivateEnableAppLauncherFunction | 215 class WebstorePrivateEnableAppLauncherFunction |
| 186 : public UIThreadExtensionFunction { | 216 : public UIThreadExtensionFunction { |
| 187 public: | 217 public: |
| 188 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher", | 218 DECLARE_EXTENSION_FUNCTION("webstorePrivate.enableAppLauncher", |
| 189 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER) | 219 WEBSTOREPRIVATE_ENABLEAPPLAUNCHER) |
| 190 | 220 |
| 191 WebstorePrivateEnableAppLauncherFunction(); | 221 WebstorePrivateEnableAppLauncherFunction(); |
| 192 | 222 |
| 193 private: | 223 private: |
| 194 ~WebstorePrivateEnableAppLauncherFunction() override; | 224 ~WebstorePrivateEnableAppLauncherFunction() override; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 private: | 368 private: |
| 339 ~WebstorePrivateGetEphemeralAppsEnabledFunction() override; | 369 ~WebstorePrivateGetEphemeralAppsEnabledFunction() override; |
| 340 | 370 |
| 341 // ExtensionFunction: | 371 // ExtensionFunction: |
| 342 ExtensionFunction::ResponseAction Run() override; | 372 ExtensionFunction::ResponseAction Run() override; |
| 343 }; | 373 }; |
| 344 | 374 |
| 345 } // namespace extensions | 375 } // namespace extensions |
| 346 | 376 |
| 347 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H
_ | 377 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H
_ |
| OLD | NEW |