| 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_WEBSTORE_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 FLAG_INLINE_INSTALL = 1 << 0 | 40 FLAG_INLINE_INSTALL = 1 << 0 |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 class Delegate { | 43 class Delegate { |
| 44 public: | 44 public: |
| 45 virtual void OnExtensionInstallSuccess(const std::string& id) = 0; | 45 virtual void OnExtensionInstallSuccess(const std::string& id) = 0; |
| 46 virtual void OnExtensionInstallFailure(const std::string& id, | 46 virtual void OnExtensionInstallFailure(const std::string& id, |
| 47 const std::string& error) = 0; | 47 const std::string& error) = 0; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // If added to the WebstoreInstaller, an Approval indicates that the user has | 50 // Contains information about what parts of the extension install process can |
| 51 // already approved the installation and that the CrxInstaller can bypass its | 51 // be skipped or modified. If one of these is present, it means that a CRX |
| 52 // install prompt. | 52 // download was initiated by WebstoreInstaller. The Approval instance should |
| 53 // be checked further for additional details. |
| 53 struct Approval : public content::DownloadItem::ExternalData { | 54 struct Approval : public content::DownloadItem::ExternalData { |
| 54 Approval(); | 55 static scoped_ptr<Approval> CreateWithInstallPrompt(Profile* profile); |
| 56 static scoped_ptr<Approval> CreateWithNoInstallPrompt( |
| 57 Profile* profile, |
| 58 const std::string& extension_id, |
| 59 scoped_ptr<base::DictionaryValue> parsed_manifest); |
| 60 |
| 55 virtual ~Approval(); | 61 virtual ~Approval(); |
| 56 | 62 |
| 57 // The extension id that was approved for installation. | 63 // The extension id that was approved for installation. |
| 58 std::string extension_id; | 64 std::string extension_id; |
| 59 | 65 |
| 60 // The profile the extension should be installed into. | 66 // The profile the extension should be installed into. |
| 61 Profile* profile; | 67 Profile* profile; |
| 62 | 68 |
| 63 // The expected manifest, before localization. | 69 // The expected manifest, before localization. |
| 64 scoped_ptr<base::DictionaryValue> parsed_manifest; | 70 scoped_ptr<base::DictionaryValue> parsed_manifest; |
| 65 | 71 |
| 66 // Whether to use a bubble notification when an app is installed, instead of | 72 // Whether to use a bubble notification when an app is installed, instead of |
| 67 // the default behavior of transitioning to the new tab page. | 73 // the default behavior of transitioning to the new tab page. |
| 68 bool use_app_installed_bubble; | 74 bool use_app_installed_bubble; |
| 69 | 75 |
| 70 // Whether to skip the post install UI like the extension installed bubble. | 76 // Whether to skip the post install UI like the extension installed bubble. |
| 71 bool skip_post_install_ui; | 77 bool skip_post_install_ui; |
| 78 |
| 79 // Whether to skip the install dialog once the extension has been downloaded |
| 80 // and unpacked. One reason this can be true is that in the normal webstore |
| 81 // installation, the dialog is shown earlier, before any download is done, |
| 82 // so there's no need to show it again. |
| 83 bool skip_install_dialog; |
| 84 |
| 85 private: |
| 86 Approval(); |
| 72 }; | 87 }; |
| 73 | 88 |
| 74 // Gets the Approval associated with the |download|, or NULL if there's none. | 89 // Gets the Approval associated with the |download|, or NULL if there's none. |
| 75 // Note that the Approval is owned by |download|. | 90 // Note that the Approval is owned by |download|. |
| 76 static const Approval* GetAssociatedApproval( | 91 static const Approval* GetAssociatedApproval( |
| 77 const content::DownloadItem& download); | 92 const content::DownloadItem& download); |
| 78 | 93 |
| 79 // Creates a WebstoreInstaller for downloading and installing the extension | 94 // Creates a WebstoreInstaller for downloading and installing the extension |
| 80 // with the given |id| from the Chrome Web Store. If |delegate| is not NULL, | 95 // with the given |id| from the Chrome Web Store. If |delegate| is not NULL, |
| 81 // it will be notified when the install succeeds or fails. The installer will | 96 // it will be notified when the install succeeds or fails. The installer will |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // The DownloadItem is owned by the DownloadManager and is valid from when | 148 // The DownloadItem is owned by the DownloadManager and is valid from when |
| 134 // OnDownloadStarted is called (with no error) until the DownloadItem | 149 // OnDownloadStarted is called (with no error) until the DownloadItem |
| 135 // transitions to state REMOVING. | 150 // transitions to state REMOVING. |
| 136 content::DownloadItem* download_item_; | 151 content::DownloadItem* download_item_; |
| 137 int flags_; | 152 int flags_; |
| 138 scoped_ptr<Approval> approval_; | 153 scoped_ptr<Approval> approval_; |
| 139 GURL download_url_; | 154 GURL download_url_; |
| 140 }; | 155 }; |
| 141 | 156 |
| 142 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ | 157 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
| OLD | NEW |