| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // use the specified |controller| to download the extension. Only one | 82 // use the specified |controller| to download the extension. Only one |
| 83 // WebstoreInstaller can use a specific controller at any given time. This | 83 // WebstoreInstaller can use a specific controller at any given time. This |
| 84 // also associates the |approval| with this install. | 84 // also associates the |approval| with this install. |
| 85 // Note: the delegate should stay alive until being called back. | 85 // Note: the delegate should stay alive until being called back. |
| 86 WebstoreInstaller(Profile* profile, | 86 WebstoreInstaller(Profile* profile, |
| 87 Delegate* delegate, | 87 Delegate* delegate, |
| 88 content::NavigationController* controller, | 88 content::NavigationController* controller, |
| 89 const std::string& id, | 89 const std::string& id, |
| 90 scoped_ptr<Approval> approval, | 90 scoped_ptr<Approval> approval, |
| 91 int flags); | 91 int flags); |
| 92 virtual ~WebstoreInstaller(); | |
| 93 | 92 |
| 94 // Starts downloading and installing the extension. | 93 // Starts downloading and installing the extension. |
| 95 void Start(); | 94 void Start(); |
| 96 | 95 |
| 97 // content::NotificationObserver | 96 // content::NotificationObserver |
| 98 virtual void Observe(int type, | 97 virtual void Observe(int type, |
| 99 const content::NotificationSource& source, | 98 const content::NotificationSource& source, |
| 100 const content::NotificationDetails& details) OVERRIDE; | 99 const content::NotificationDetails& details) OVERRIDE; |
| 101 | 100 |
| 102 // Instead of using the default download directory, use |directory| instead. | 101 // Instead of using the default download directory, use |directory| instead. |
| 103 // This does *not* transfer ownership of |directory|. | 102 // This does *not* transfer ownership of |directory|. |
| 104 static void SetDownloadDirectoryForTests(FilePath* directory); | 103 static void SetDownloadDirectoryForTests(FilePath* directory); |
| 105 | 104 |
| 106 private: | 105 private: |
| 106 friend class base::RefCounted<WebstoreInstaller>; |
| 107 virtual ~WebstoreInstaller(); |
| 108 |
| 107 // DownloadManager::DownloadUrl callback. | 109 // DownloadManager::DownloadUrl callback. |
| 108 void OnDownloadStarted(content::DownloadId id, net::Error error); | 110 void OnDownloadStarted(content::DownloadId id, net::Error error); |
| 109 | 111 |
| 110 // DownloadItem::Observer implementation: | 112 // DownloadItem::Observer implementation: |
| 111 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; | 113 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; |
| 112 virtual void OnDownloadOpened(content::DownloadItem* download) OVERRIDE; | 114 virtual void OnDownloadOpened(content::DownloadItem* download) OVERRIDE; |
| 113 | 115 |
| 114 // Starts downloading the extension to |file_path|. | 116 // Starts downloading the extension to |file_path|. |
| 115 void StartDownload(const FilePath& file_path); | 117 void StartDownload(const FilePath& file_path); |
| 116 | 118 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 131 // 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 |
| 132 // OnDownloadStarted is called (with no error) until the DownloadItem | 134 // OnDownloadStarted is called (with no error) until the DownloadItem |
| 133 // transitions to state REMOVING. | 135 // transitions to state REMOVING. |
| 134 content::DownloadItem* download_item_; | 136 content::DownloadItem* download_item_; |
| 135 int flags_; | 137 int flags_; |
| 136 scoped_ptr<Approval> approval_; | 138 scoped_ptr<Approval> approval_; |
| 137 GURL download_url_; | 139 GURL download_url_; |
| 138 }; | 140 }; |
| 139 | 141 |
| 140 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ | 142 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
| OLD | NEW |