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