| 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 // Contains information about what parts of the extension install process can | 50 // If added to the WebstoreInstaller, an Approval indicates that the user has |
| 51 // be skipped or modified. If one of these is present, it means that a CRX | 51 // already approved the installation and that the CrxInstaller can bypass its |
| 52 // download was initiated by WebstoreInstaller. The Approval instance should | 52 // install prompt. |
| 53 // be checked further for additional details. | |
| 54 struct Approval : public content::DownloadItem::ExternalData { | 53 struct Approval : public content::DownloadItem::ExternalData { |
| 55 static scoped_ptr<Approval> CreateWithInstallPrompt(Profile* profile); | 54 Approval(); |
| 56 static scoped_ptr<Approval> CreateWithNoInstallPrompt( | |
| 57 Profile* profile, | |
| 58 const std::string& extension_id, | |
| 59 scoped_ptr<base::DictionaryValue> parsed_manifest); | |
| 60 | |
| 61 virtual ~Approval(); | 55 virtual ~Approval(); |
| 62 | 56 |
| 63 // The extension id that was approved for installation. | 57 // The extension id that was approved for installation. |
| 64 std::string extension_id; | 58 std::string extension_id; |
| 65 | 59 |
| 66 // The profile the extension should be installed into. | 60 // The profile the extension should be installed into. |
| 67 Profile* profile; | 61 Profile* profile; |
| 68 | 62 |
| 69 // The expected manifest, before localization. | 63 // The expected manifest, before localization. |
| 70 scoped_ptr<base::DictionaryValue> parsed_manifest; | 64 scoped_ptr<base::DictionaryValue> parsed_manifest; |
| 71 | 65 |
| 72 // Whether to use a bubble notification when an app is installed, instead of | 66 // Whether to use a bubble notification when an app is installed, instead of |
| 73 // the default behavior of transitioning to the new tab page. | 67 // the default behavior of transitioning to the new tab page. |
| 74 bool use_app_installed_bubble; | 68 bool use_app_installed_bubble; |
| 75 | 69 |
| 76 // Whether to skip the post install UI like the extension installed bubble. | 70 // Whether to skip the post install UI like the extension installed bubble. |
| 77 bool skip_post_install_ui; | 71 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(); | |
| 87 }; | 72 }; |
| 88 | 73 |
| 89 // Gets the Approval associated with the |download|, or NULL if there's none. | 74 // Gets the Approval associated with the |download|, or NULL if there's none. |
| 90 // Note that the Approval is owned by |download|. | 75 // Note that the Approval is owned by |download|. |
| 91 static const Approval* GetAssociatedApproval( | 76 static const Approval* GetAssociatedApproval( |
| 92 const content::DownloadItem& download); | 77 const content::DownloadItem& download); |
| 93 | 78 |
| 94 // Creates a WebstoreInstaller for downloading and installing the extension | 79 // Creates a WebstoreInstaller for downloading and installing the extension |
| 95 // with the given |id| from the Chrome Web Store. If |delegate| is not NULL, | 80 // with the given |id| from the Chrome Web Store. If |delegate| is not NULL, |
| 96 // it will be notified when the install succeeds or fails. The installer will | 81 // 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... |
| 148 // The DownloadItem is owned by the DownloadManager and is valid from when | 133 // The DownloadItem is owned by the DownloadManager and is valid from when |
| 149 // OnDownloadStarted is called (with no error) until the DownloadItem | 134 // OnDownloadStarted is called (with no error) until the DownloadItem |
| 150 // transitions to state REMOVING. | 135 // transitions to state REMOVING. |
| 151 content::DownloadItem* download_item_; | 136 content::DownloadItem* download_item_; |
| 152 int flags_; | 137 int flags_; |
| 153 scoped_ptr<Approval> approval_; | 138 scoped_ptr<Approval> approval_; |
| 154 GURL download_url_; | 139 GURL download_url_; |
| 155 }; | 140 }; |
| 156 | 141 |
| 157 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ | 142 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
| OLD | NEW |