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

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

Issue 7847027: DownloadId (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge Created 9 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
« no previous file with comments | « content/browser/download/download_id.cc ('k') | content/browser/download/download_item.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 14 matching lines...) Expand all
25 #include "base/observer_list.h" 25 #include "base/observer_list.h"
26 #include "base/time.h" 26 #include "base/time.h"
27 #include "base/timer.h" 27 #include "base/timer.h"
28 #include "content/browser/download/download_request_handle.h" 28 #include "content/browser/download/download_request_handle.h"
29 #include "content/browser/download/download_state_info.h" 29 #include "content/browser/download/download_state_info.h"
30 #include "content/common/content_export.h" 30 #include "content/common/content_export.h"
31 #include "googleurl/src/gurl.h" 31 #include "googleurl/src/gurl.h"
32 #include "net/base/net_errors.h" 32 #include "net/base/net_errors.h"
33 33
34 class DownloadFileManager; 34 class DownloadFileManager;
35 class DownloadId;
35 class DownloadManager; 36 class DownloadManager;
36 struct DownloadCreateInfo; 37 struct DownloadCreateInfo;
37 struct DownloadPersistentStoreInfo; 38 struct DownloadPersistentStoreInfo;
38 39
39 // One DownloadItem per download. This is the model class that stores all the 40 // One DownloadItem per download. This is the model class that stores all the
40 // state for a download. Multiple views, such as a tab's download shelf and the 41 // state for a download. Multiple views, such as a tab's download shelf and the
41 // Destination tab's download view, may refer to a given DownloadItem. 42 // Destination tab's download view, may refer to a given DownloadItem.
42 // 43 //
43 // This is intended to be used only on the UI thread. 44 // This is intended to be used only on the UI thread.
44 class CONTENT_EXPORT DownloadItem { 45 class CONTENT_EXPORT DownloadItem {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Constructing for a regular download: 118 // Constructing for a regular download:
118 DownloadItem(DownloadManager* download_manager, 119 DownloadItem(DownloadManager* download_manager,
119 const DownloadCreateInfo& info, 120 const DownloadCreateInfo& info,
120 bool is_otr); 121 bool is_otr);
121 122
122 // Constructing for the "Save Page As..." feature: 123 // Constructing for the "Save Page As..." feature:
123 DownloadItem(DownloadManager* download_manager, 124 DownloadItem(DownloadManager* download_manager,
124 const FilePath& path, 125 const FilePath& path,
125 const GURL& url, 126 const GURL& url,
126 bool is_otr, 127 bool is_otr,
127 int download_id); 128 DownloadId download_id);
128 129
129 virtual ~DownloadItem(); 130 virtual ~DownloadItem();
130 131
131 void AddObserver(Observer* observer); 132 void AddObserver(Observer* observer);
132 void RemoveObserver(Observer* observer); 133 void RemoveObserver(Observer* observer);
133 134
134 // Notifies our observers periodically. 135 // Notifies our observers periodically.
135 void UpdateObservers(); 136 void UpdateObservers();
136 137
137 // Returns true if it is OK to open a folder which this file is inside. 138 // Returns true if it is OK to open a folder which this file is inside.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 std::string content_disposition() const { return content_disposition_; } 269 std::string content_disposition() const { return content_disposition_; }
269 std::string mime_type() const { return mime_type_; } 270 std::string mime_type() const { return mime_type_; }
270 std::string original_mime_type() const { return original_mime_type_; } 271 std::string original_mime_type() const { return original_mime_type_; }
271 std::string referrer_charset() const { return referrer_charset_; } 272 std::string referrer_charset() const { return referrer_charset_; }
272 int64 total_bytes() const { return total_bytes_; } 273 int64 total_bytes() const { return total_bytes_; }
273 void set_total_bytes(int64 total_bytes) { 274 void set_total_bytes(int64 total_bytes) {
274 total_bytes_ = total_bytes; 275 total_bytes_ = total_bytes;
275 } 276 }
276 int64 received_bytes() const { return received_bytes_; } 277 int64 received_bytes() const { return received_bytes_; }
277 int32 id() const { return download_id_; } 278 int32 id() const { return download_id_; }
279 DownloadId global_id() const;
278 base::Time start_time() const { return start_time_; } 280 base::Time start_time() const { return start_time_; }
279 void set_db_handle(int64 handle) { db_handle_ = handle; } 281 void set_db_handle(int64 handle) { db_handle_ = handle; }
280 int64 db_handle() const { return db_handle_; } 282 int64 db_handle() const { return db_handle_; }
281 DownloadManager* download_manager() { return download_manager_; } 283 DownloadManager* download_manager() { return download_manager_; }
282 bool is_paused() const { return is_paused_; } 284 bool is_paused() const { return is_paused_; }
283 bool open_when_complete() const { return open_when_complete_; } 285 bool open_when_complete() const { return open_when_complete_; }
284 void set_open_when_complete(bool open) { open_when_complete_ = open; } 286 void set_open_when_complete(bool open) { open_when_complete_ = open; }
285 bool file_externally_removed() const { return file_externally_removed_; } 287 bool file_externally_removed() const { return file_externally_removed_; }
286 SafetyState safety_state() const { return safety_state_; } 288 SafetyState safety_state() const { return safety_state_; }
287 // Why |safety_state_| is not SAFE. 289 // Why |safety_state_| is not SAFE.
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 // only. 481 // only.
480 bool open_enabled_; 482 bool open_enabled_;
481 483
482 // Did the delegate delay calling Complete on this download? 484 // Did the delegate delay calling Complete on this download?
483 bool delegate_delayed_complete_; 485 bool delegate_delayed_complete_;
484 486
485 DISALLOW_COPY_AND_ASSIGN(DownloadItem); 487 DISALLOW_COPY_AND_ASSIGN(DownloadItem);
486 }; 488 };
487 489
488 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ 490 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_id.cc ('k') | content/browser/download/download_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698