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

Side by Side Diff: content/public/browser/download_item.h

Issue 10837125: Revert 149794 - DownloadItem::Observer::OnDownloadDestroyed() replaces DownloadItem::REMOVING (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1228/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « content/browser/download/save_package.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Each download is represented by a DownloadItem, and all DownloadItems 5 // Each download is represented by a DownloadItem, and all DownloadItems
6 // are owned by the DownloadManager which maintains a global list of all 6 // are owned by the DownloadManager which maintains a global list of all
7 // downloads. DownloadItems are created when a user initiates a download, 7 // downloads. DownloadItems are created when a user initiates a download,
8 // and exist for the duration of the browser life time. 8 // and exist for the duration of the browser life time.
9 // 9 //
10 // Download observers: 10 // Download observers:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 enum DownloadState { 54 enum DownloadState {
55 // Download is actively progressing. 55 // Download is actively progressing.
56 IN_PROGRESS = 0, 56 IN_PROGRESS = 0,
57 57
58 // Download is completely finished. 58 // Download is completely finished.
59 COMPLETE, 59 COMPLETE,
60 60
61 // Download has been cancelled. 61 // Download has been cancelled.
62 CANCELLED, 62 CANCELLED,
63 63
64 // This state indicates that the download item is about to be destroyed,
65 // and observers seeing this state should release all references.
66 REMOVING,
67
64 // This state indicates that the download has been interrupted. 68 // This state indicates that the download has been interrupted.
65 INTERRUPTED, 69 INTERRUPTED,
66 70
67 // Maximum value. 71 // Maximum value.
68 MAX_DOWNLOAD_STATE 72 MAX_DOWNLOAD_STATE
69 }; 73 };
70 74
71 enum SafetyState { 75 enum SafetyState {
72 SAFE = 0, 76 SAFE = 0,
73 DANGEROUS, 77 DANGEROUS,
(...skipping 17 matching lines...) Expand all
91 // A fake download table ID which represents a download that has started, 95 // A fake download table ID which represents a download that has started,
92 // but is not yet in the table. 96 // but is not yet in the table.
93 static const int kUninitializedHandle; 97 static const int kUninitializedHandle;
94 98
95 static const char kEmptyFileHash[]; 99 static const char kEmptyFileHash[];
96 100
97 // Interface that observers of a particular download must implement in order 101 // Interface that observers of a particular download must implement in order
98 // to receive updates to the download's status. 102 // to receive updates to the download's status.
99 class CONTENT_EXPORT Observer { 103 class CONTENT_EXPORT Observer {
100 public: 104 public:
101 virtual void OnDownloadUpdated(DownloadItem* download) {} 105 virtual void OnDownloadUpdated(DownloadItem* download) = 0;
102 106
103 // Called when a downloaded file has been opened. 107 // Called when a downloaded file has been opened.
104 virtual void OnDownloadOpened(DownloadItem* download) {} 108 virtual void OnDownloadOpened(DownloadItem* download) = 0;
105
106 // Called when the user removes a download.
107 virtual void OnDownloadRemoved(DownloadItem* download) {}
108
109 // Called when the download is being destroyed. This happens after
110 // every OnDownloadRemoved() as well as when the DownloadManager is going
111 // down.
112 virtual void OnDownloadDestroyed(DownloadItem* download) {}
113 109
114 protected: 110 protected:
115 virtual ~Observer() {} 111 virtual ~Observer() {}
116 }; 112 };
117 113
118 // Interface for data that can be stored associated with (and owned 114 // Interface for data that can be stored associated with (and owned
119 // by) an object of this class via GetExternalData/SetExternalData. 115 // by) an object of this class via GetExternalData/SetExternalData.
120 class ExternalData { 116 class ExternalData {
121 public: 117 public:
122 virtual ~ExternalData() {}; 118 virtual ~ExternalData() {};
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 virtual void SetExternalData(const void* key, ExternalData* data) = 0; 308 virtual void SetExternalData(const void* key, ExternalData* data) = 0;
313 309
314 virtual std::string DebugString(bool verbose) const = 0; 310 virtual std::string DebugString(bool verbose) const = 0;
315 311
316 virtual void MockDownloadOpenForTesting() = 0; 312 virtual void MockDownloadOpenForTesting() = 0;
317 }; 313 };
318 314
319 } // namespace content 315 } // namespace content
320 316
321 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ 317 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_
OLDNEW
« no previous file with comments | « content/browser/download/save_package.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698