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

Side by Side Diff: chrome/browser/extensions/api/recovery_private/write_from_url_operation.h

Issue 23496076: WIP - Refactor programmatic downloads Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_API_RECOVERY_PRIVATE_WRITE_FROM_URL_OPERATION_ H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_RECOVERY_PRIVATE_WRITE_FROM_URL_OPERATION_ H_
6 #define CHROME_BROWSER_EXTENSIONS_API_RECOVERY_PRIVATE_WRITE_FROM_URL_OPERATION_ H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_RECOVERY_PRIVATE_WRITE_FROM_URL_OPERATION_ H_
7 7
8 #include "base/scoped_observer.h" 8 #include "base/scoped_observer.h"
9 #include "chrome/browser/extensions/api/recovery_private/recovery_operation.h" 9 #include "chrome/browser/extensions/api/recovery_private/recovery_operation.h"
10 #include "content/public/browser/download_interrupt_reasons.h"
10 #include "content/public/browser/download_item.h" 11 #include "content/public/browser/download_item.h"
11 #include "net/base/net_errors.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 class RenderViewHost; 16 class RenderViewHost;
17 17
18 } // namespace content 18 } // namespace content
19 19
20 namespace extensions { 20 namespace extensions {
21 namespace recovery { 21 namespace recovery {
(...skipping 11 matching lines...) Expand all
33 const std::string& hash, 33 const std::string& hash,
34 bool saveImageAsDownload, 34 bool saveImageAsDownload,
35 const std::string& storage_unit_id); 35 const std::string& storage_unit_id);
36 virtual void Cancel() OVERRIDE; 36 virtual void Cancel() OVERRIDE;
37 virtual void Start() OVERRIDE; 37 virtual void Start() OVERRIDE;
38 private: 38 private:
39 virtual ~WriteFromUrlOperation(); 39 virtual ~WriteFromUrlOperation();
40 void CreateTempFile(); 40 void CreateTempFile();
41 41
42 void DownloadStart(); 42 void DownloadStart();
43 void OnDownloadStarted(content::DownloadItem*, net::Error); 43 void OnDownloadStarted(content::DownloadItem*,
44 content::DownloadInterruptReason interrupt_reason);
44 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; 45 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE;
45 void DownloadComplete(); 46 void DownloadComplete();
46 47
47 void VerifyDownloadStart(); 48 void VerifyDownloadStart();
48 void VerifyDownloadRun(); 49 void VerifyDownloadRun();
49 void VerifyDownloadCompare(scoped_ptr<std::string> download_hash); 50 void VerifyDownloadCompare(scoped_ptr<std::string> download_hash);
50 void VerifyDownloadComplete(); 51 void VerifyDownloadComplete();
51 52
52 content::RenderViewHost* rvh_; 53 content::RenderViewHost* rvh_;
53 GURL url_; 54 GURL url_;
54 const std::string hash_; 55 const std::string hash_;
55 const bool saveImageAsDownload_; 56 const bool saveImageAsDownload_;
56 scoped_ptr<base::FilePath> tmp_file_; 57 scoped_ptr<base::FilePath> tmp_file_;
57 content::DownloadItem* download_; 58 content::DownloadItem* download_;
58 59
59 base::FilePath download_path_; 60 base::FilePath download_path_;
60 }; 61 };
61 62
62 } // namespace recovery 63 } // namespace recovery
63 } // namespace extensions 64 } // namespace extensions
64 65
65 #endif // CHROME_BROWSER_EXTENSIONS_API_RECOVERY_PRIVATE_WRITE_FROM_URL_OPERATI ON_H_ 66 #endif // CHROME_BROWSER_EXTENSIONS_API_RECOVERY_PRIVATE_WRITE_FROM_URL_OPERATI ON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698