| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const std::string& error) = 0; | 48 const std::string& error) = 0; |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 virtual ~Delegate() {} | 51 virtual ~Delegate() {} |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // Contains information about what parts of the extension install process can | 54 // Contains information about what parts of the extension install process can |
| 55 // be skipped or modified. If one of these is present, it means that a CRX | 55 // be skipped or modified. If one of these is present, it means that a CRX |
| 56 // download was initiated by WebstoreInstaller. The Approval instance should | 56 // download was initiated by WebstoreInstaller. The Approval instance should |
| 57 // be checked further for additional details. | 57 // be checked further for additional details. |
| 58 struct Approval : public content::DownloadItem::ExternalData { | 58 struct Approval : public base::SupportsUserData::Data { |
| 59 static scoped_ptr<Approval> CreateWithInstallPrompt(Profile* profile); | 59 static scoped_ptr<Approval> CreateWithInstallPrompt(Profile* profile); |
| 60 static scoped_ptr<Approval> CreateWithNoInstallPrompt( | 60 static scoped_ptr<Approval> CreateWithNoInstallPrompt( |
| 61 Profile* profile, | 61 Profile* profile, |
| 62 const std::string& extension_id, | 62 const std::string& extension_id, |
| 63 scoped_ptr<base::DictionaryValue> parsed_manifest); | 63 scoped_ptr<base::DictionaryValue> parsed_manifest); |
| 64 | 64 |
| 65 virtual ~Approval(); | 65 virtual ~Approval(); |
| 66 | 66 |
| 67 // The extension id that was approved for installation. | 67 // The extension id that was approved for installation. |
| 68 std::string extension_id; | 68 std::string extension_id; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 friend class base::RefCounted<WebstoreInstaller>; | 128 friend class base::RefCounted<WebstoreInstaller>; |
| 129 virtual ~WebstoreInstaller(); | 129 virtual ~WebstoreInstaller(); |
| 130 | 130 |
| 131 // DownloadManager::DownloadUrl callback. | 131 // DownloadManager::DownloadUrl callback. |
| 132 void OnDownloadStarted(content::DownloadId id, net::Error error); | 132 void OnDownloadStarted(content::DownloadId id, net::Error error); |
| 133 | 133 |
| 134 // DownloadItem::Observer implementation: | 134 // DownloadItem::Observer implementation: |
| 135 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; | 135 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; |
| 136 virtual void OnDownloadOpened(content::DownloadItem* download) OVERRIDE; | 136 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE; |
| 137 | 137 |
| 138 // Starts downloading the extension to |file_path|. | 138 // Starts downloading the extension to |file_path|. |
| 139 void StartDownload(const FilePath& file_path); | 139 void StartDownload(const FilePath& file_path); |
| 140 | 140 |
| 141 // Reports an install |error| to the delegate for the given extension if this | 141 // Reports an install |error| to the delegate for the given extension if this |
| 142 // managed its installation. This also removes the associated PendingInstall. | 142 // managed its installation. This also removes the associated PendingInstall. |
| 143 void ReportFailure(const std::string& error); | 143 void ReportFailure(const std::string& error); |
| 144 | 144 |
| 145 // Reports a successful install to the delegate for the given extension if | 145 // Reports a successful install to the delegate for the given extension if |
| 146 // this managed its installation. This also removes the associated | 146 // this managed its installation. This also removes the associated |
| (...skipping 10 matching lines...) Expand all Loading... |
| 157 // transitions to state REMOVING. | 157 // transitions to state REMOVING. |
| 158 content::DownloadItem* download_item_; | 158 content::DownloadItem* download_item_; |
| 159 int flags_; | 159 int flags_; |
| 160 scoped_ptr<Approval> approval_; | 160 scoped_ptr<Approval> approval_; |
| 161 GURL download_url_; | 161 GURL download_url_; |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 } // namespace extensions | 164 } // namespace extensions |
| 165 | 165 |
| 166 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ | 166 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
| OLD | NEW |