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" | |
12 #include "chrome/browser/extensions/chrome_extension_function.h" | 11 #include "chrome/browser/extensions/chrome_extension_function.h" |
13 #include "chrome/browser/extensions/extension_install_prompt.h" | 12 #include "chrome/browser/extensions/extension_install_prompt.h" |
14 #include "chrome/browser/extensions/webstore_install_helper.h" | 13 #include "chrome/browser/extensions/webstore_install_helper.h" |
15 #include "chrome/browser/extensions/webstore_installer.h" | 14 #include "chrome/browser/extensions/webstore_installer.h" |
16 #include "chrome/common/extensions/api/webstore_private.h" | 15 #include "chrome/common/extensions/api/webstore_private.h" |
17 #include "chrome/common/extensions/webstore_install_result.h" | 16 #include "chrome/common/extensions/webstore_install_result.h" |
18 #include "content/public/browser/gpu_data_manager_observer.h" | 17 #include "content/public/browser/gpu_data_manager_observer.h" |
19 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
21 #include "google_apis/gaia/google_service_auth_error.h" | 20 #include "google_apis/gaia/google_service_auth_error.h" |
(...skipping 15 matching lines...) Expand all Loading... |
37 static void SetWebstoreInstallerDelegateForTesting( | 36 static void SetWebstoreInstallerDelegateForTesting( |
38 WebstoreInstaller::Delegate* delegate); | 37 WebstoreInstaller::Delegate* delegate); |
39 | 38 |
40 // Gets the pending approval for the |extension_id| in |profile|. Pending | 39 // Gets the pending approval for the |extension_id| in |profile|. Pending |
41 // approvals are held between the calls to beginInstallWithManifest and | 40 // approvals are held between the calls to beginInstallWithManifest and |
42 // completeInstall. This should only be used for testing. | 41 // completeInstall. This should only be used for testing. |
43 static scoped_ptr<WebstoreInstaller::Approval> PopApprovalForTesting( | 42 static scoped_ptr<WebstoreInstaller::Approval> PopApprovalForTesting( |
44 Profile* profile, const std::string& extension_id); | 43 Profile* profile, const std::string& extension_id); |
45 }; | 44 }; |
46 | 45 |
47 class WebstorePrivateInstallBundleFunction | |
48 : public ChromeAsyncExtensionFunction, | |
49 public extensions::BundleInstaller::Delegate { | |
50 public: | |
51 DECLARE_EXTENSION_FUNCTION("webstorePrivate.installBundle", | |
52 WEBSTOREPRIVATE_INSTALLBUNDLE) | |
53 | |
54 WebstorePrivateInstallBundleFunction(); | |
55 | |
56 // BundleInstaller::Delegate: | |
57 void OnBundleInstallApproved() override; | |
58 void OnBundleInstallCanceled(bool user_initiated) override; | |
59 void OnBundleInstallCompleted() override; | |
60 | |
61 protected: | |
62 ~WebstorePrivateInstallBundleFunction() override; | |
63 | |
64 // ExtensionFunction: | |
65 bool RunAsync() override; | |
66 | |
67 // Reads the extension |details| into |items|. | |
68 bool ReadBundleInfo( | |
69 const api::webstore_private::InstallBundle::Params& details, | |
70 extensions::BundleInstaller::ItemList* items); | |
71 | |
72 private: | |
73 scoped_refptr<extensions::BundleInstaller> bundle_; | |
74 }; | |
75 | |
76 class WebstorePrivateBeginInstallWithManifest3Function | 46 class WebstorePrivateBeginInstallWithManifest3Function |
77 : public ChromeAsyncExtensionFunction, | 47 : public ChromeAsyncExtensionFunction, |
78 public ExtensionInstallPrompt::Delegate, | 48 public ExtensionInstallPrompt::Delegate, |
79 public WebstoreInstallHelper::Delegate { | 49 public WebstoreInstallHelper::Delegate { |
80 public: | 50 public: |
81 DECLARE_EXTENSION_FUNCTION("webstorePrivate.beginInstallWithManifest3", | 51 DECLARE_EXTENSION_FUNCTION("webstorePrivate.beginInstallWithManifest3", |
82 WEBSTOREPRIVATE_BEGININSTALLWITHMANIFEST3) | 52 WEBSTOREPRIVATE_BEGININSTALLWITHMANIFEST3) |
83 | 53 |
84 // Result codes for the return value. If you change this, make sure to | 54 // Result codes for the return value. If you change this, make sure to |
85 // update the description for the beginInstallWithManifest3 callback in | 55 // update the description for the beginInstallWithManifest3 callback in |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 protected: | 300 protected: |
331 ~WebstorePrivateGetEphemeralAppsEnabledFunction() override; | 301 ~WebstorePrivateGetEphemeralAppsEnabledFunction() override; |
332 | 302 |
333 // ExtensionFunction: | 303 // ExtensionFunction: |
334 bool RunSync() override; | 304 bool RunSync() override; |
335 }; | 305 }; |
336 | 306 |
337 } // namespace extensions | 307 } // namespace extensions |
338 | 308 |
339 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H
_ | 309 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_PRIVATE_WEBSTORE_PRIVATE_API_H
_ |
OLD | NEW |