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

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

Issue 23496076: WIP - Refactor programmatic downloads Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/supports_user_data.h" 14 #include "base/supports_user_data.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/extensions/extension_install_prompt.h" 16 #include "chrome/browser/extensions/extension_install_prompt.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/download_interrupt_reasons.h"
18 #include "content/public/browser/download_item.h" 19 #include "content/public/browser/download_item.h"
19 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
21 #include "net/base/net_errors.h"
22 #include "ui/gfx/image/image_skia.h" 22 #include "ui/gfx/image/image_skia.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 class Profile; 25 class Profile;
26 26
27 namespace base { 27 namespace base {
28 class FilePath; 28 class FilePath;
29 } 29 }
30 30
31 namespace content { 31 namespace content {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 friend struct content::BrowserThread::DeleteOnThread< 169 friend struct content::BrowserThread::DeleteOnThread<
170 content::BrowserThread::UI>; 170 content::BrowserThread::UI>;
171 friend class base::DeleteHelper<WebstoreInstaller>; 171 friend class base::DeleteHelper<WebstoreInstaller>;
172 virtual ~WebstoreInstaller(); 172 virtual ~WebstoreInstaller();
173 173
174 // Helper to get install URL. 174 // Helper to get install URL.
175 static GURL GetWebstoreInstallURL(const std::string& extension_id, 175 static GURL GetWebstoreInstallURL(const std::string& extension_id,
176 const std::string& install_source); 176 const std::string& install_source);
177 177
178 // DownloadManager::DownloadUrl callback. 178 // DownloadManager::DownloadUrl callback.
179 void OnDownloadStarted(content::DownloadItem* item, net::Error error); 179 void OnDownloadStarted(content::DownloadItem* item,
180 content::DownloadInterruptReason interrupt_reason);
180 181
181 // DownloadItem::Observer implementation: 182 // DownloadItem::Observer implementation:
182 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; 183 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE;
183 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE; 184 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE;
184 185
185 // Starts downloading the extension to |file_path|. 186 // Starts downloading the extension to |file_path|.
186 void StartDownload(const base::FilePath& file_path); 187 void StartDownload(const base::FilePath& file_path);
187 188
188 // Reports an install |error| to the delegate for the given extension if this 189 // Reports an install |error| to the delegate for the given extension if this
189 // managed its installation. This also removes the associated PendingInstall. 190 // managed its installation. This also removes the associated PendingInstall.
(...skipping 12 matching lines...) Expand all
202 // The DownloadItem is owned by the DownloadManager and is valid from when 203 // The DownloadItem is owned by the DownloadManager and is valid from when
203 // OnDownloadStarted is called (with no error) until OnDownloadDestroyed(). 204 // OnDownloadStarted is called (with no error) until OnDownloadDestroyed().
204 content::DownloadItem* download_item_; 205 content::DownloadItem* download_item_;
205 scoped_ptr<Approval> approval_; 206 scoped_ptr<Approval> approval_;
206 GURL download_url_; 207 GURL download_url_;
207 }; 208 };
208 209
209 } // namespace extensions 210 } // namespace extensions
210 211
211 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ 212 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698