Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: chrome/browser/extensions/webstore_installer.h

Issue 10980002: Mac Web Intents Part 1: Show extension download progress (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 28 matching lines...) Expand all
39 enum Flag { 39 enum Flag {
40 FLAG_NONE = 0, 40 FLAG_NONE = 0,
41 41
42 // Inline installs trigger slightly different behavior (install source 42 // Inline installs trigger slightly different behavior (install source
43 // is different, download referrers are the item's page in the gallery). 43 // is different, download referrers are the item's page in the gallery).
44 FLAG_INLINE_INSTALL = 1 << 0 44 FLAG_INLINE_INSTALL = 1 << 0
45 }; 45 };
46 46
47 class Delegate { 47 class Delegate {
48 public: 48 public:
49 virtual void OnExtensionDownloadStarted(const std::string& id,
50 content::DownloadItem* item) {}
51 virtual void OnExtensionDownloadProgress(const std::string& id,
52 content::DownloadItem* item) {}
49 virtual void OnExtensionInstallSuccess(const std::string& id) = 0; 53 virtual void OnExtensionInstallSuccess(const std::string& id) = 0;
50 virtual void OnExtensionInstallFailure(const std::string& id, 54 virtual void OnExtensionInstallFailure(const std::string& id,
51 const std::string& error) = 0; 55 const std::string& error,
56 bool cancelled) = 0;
52 57
53 protected: 58 protected:
54 virtual ~Delegate() {} 59 virtual ~Delegate() {}
55 }; 60 };
56 61
57 // Contains information about what parts of the extension install process can 62 // Contains information about what parts of the extension install process can
58 // be skipped or modified. If one of these is present, it means that a CRX 63 // be skipped or modified. If one of these is present, it means that a CRX
59 // download was initiated by WebstoreInstaller. The Approval instance should 64 // download was initiated by WebstoreInstaller. The Approval instance should
60 // be checked further for additional details. 65 // be checked further for additional details.
61 struct Approval : public base::SupportsUserData::Data { 66 struct Approval : public base::SupportsUserData::Data {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 143
139 // DownloadItem::Observer implementation: 144 // DownloadItem::Observer implementation:
140 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; 145 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE;
141 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE; 146 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE;
142 147
143 // Starts downloading the extension to |file_path|. 148 // Starts downloading the extension to |file_path|.
144 void StartDownload(const FilePath& file_path); 149 void StartDownload(const FilePath& file_path);
145 150
146 // Reports an install |error| to the delegate for the given extension if this 151 // Reports an install |error| to the delegate for the given extension if this
147 // managed its installation. This also removes the associated PendingInstall. 152 // managed its installation. This also removes the associated PendingInstall.
148 void ReportFailure(const std::string& error); 153 void ReportFailure(const std::string& error, bool cancelled);
149 154
150 // Reports a successful install to the delegate for the given extension if 155 // Reports a successful install to the delegate for the given extension if
151 // this managed its installation. This also removes the associated 156 // this managed its installation. This also removes the associated
152 // PendingInstall. 157 // PendingInstall.
153 void ReportSuccess(); 158 void ReportSuccess();
154 159
155 content::NotificationRegistrar registrar_; 160 content::NotificationRegistrar registrar_;
156 Profile* profile_; 161 Profile* profile_;
157 Delegate* delegate_; 162 Delegate* delegate_;
158 content::NavigationController* controller_; 163 content::NavigationController* controller_;
159 std::string id_; 164 std::string id_;
160 // The DownloadItem is owned by the DownloadManager and is valid from when 165 // The DownloadItem is owned by the DownloadManager and is valid from when
161 // OnDownloadStarted is called (with no error) until OnDownloadDestroyed(). 166 // OnDownloadStarted is called (with no error) until OnDownloadDestroyed().
162 content::DownloadItem* download_item_; 167 content::DownloadItem* download_item_;
163 scoped_ptr<Approval> approval_; 168 scoped_ptr<Approval> approval_;
164 GURL download_url_; 169 GURL download_url_;
165 }; 170 };
166 171
167 } // namespace extensions 172 } // namespace extensions
168 173
169 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ 174 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698