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

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

Issue 8372073: Merge 8401001 r107836 into branch 912: Fix history importing by delaying DownloadManager creation. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/912/src/
Patch Set: Created 9 years, 1 month 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) 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:
11 // DownloadItem::Observer: 11 // DownloadItem::Observer:
12 // - allows observers to receive notifications about one download from start 12 // - allows observers to receive notifications about one download from start
13 // to completion 13 // to completion
14 // Use AddObserver() / RemoveObserver() on the appropriate download object to 14 // Use AddObserver() / RemoveObserver() on the appropriate download object to
15 // receive state updates. 15 // receive state updates.
16 16
17 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ 17 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_
18 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ 18 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_
19 #pragma once 19 #pragma once
20 20
21 #include <string> 21 #include <string>
22 22
23 #include "base/basictypes.h" 23 #include "base/basictypes.h"
24 #include "base/file_path.h" 24 #include "base/file_path.h"
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_id.h"
28 #include "content/browser/download/download_request_handle.h" 29 #include "content/browser/download/download_request_handle.h"
29 #include "content/browser/download/download_state_info.h" 30 #include "content/browser/download/download_state_info.h"
30 #include "content/browser/download/interrupt_reasons.h" 31 #include "content/browser/download/interrupt_reasons.h"
31 #include "content/common/content_export.h" 32 #include "content/common/content_export.h"
32 #include "googleurl/src/gurl.h" 33 #include "googleurl/src/gurl.h"
33 #include "net/base/net_errors.h" 34 #include "net/base/net_errors.h"
34 35
35 class DownloadFileManager; 36 class DownloadFileManager;
36 class DownloadId; 37 class DownloadId;
37 class DownloadManager; 38 class DownloadManager;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 std::string suggested_filename() const { return suggested_filename_; } 270 std::string suggested_filename() const { return suggested_filename_; }
270 std::string content_disposition() const { return content_disposition_; } 271 std::string content_disposition() const { return content_disposition_; }
271 std::string mime_type() const { return mime_type_; } 272 std::string mime_type() const { return mime_type_; }
272 std::string original_mime_type() const { return original_mime_type_; } 273 std::string original_mime_type() const { return original_mime_type_; }
273 std::string referrer_charset() const { return referrer_charset_; } 274 std::string referrer_charset() const { return referrer_charset_; }
274 int64 total_bytes() const { return total_bytes_; } 275 int64 total_bytes() const { return total_bytes_; }
275 void set_total_bytes(int64 total_bytes) { 276 void set_total_bytes(int64 total_bytes) {
276 total_bytes_ = total_bytes; 277 total_bytes_ = total_bytes;
277 } 278 }
278 int64 received_bytes() const { return received_bytes_; } 279 int64 received_bytes() const { return received_bytes_; }
279 int32 id() const { return download_id_; } 280 int32 id() const { return download_id_.local(); }
280 DownloadId global_id() const; 281 DownloadId global_id() const { return download_id_; }
281 base::Time start_time() const { return start_time_; } 282 base::Time start_time() const { return start_time_; }
282 base::Time end_time() const { return end_time_; } 283 base::Time end_time() const { return end_time_; }
283 void set_db_handle(int64 handle) { db_handle_ = handle; } 284 void set_db_handle(int64 handle) { db_handle_ = handle; }
284 int64 db_handle() const { return db_handle_; } 285 int64 db_handle() const { return db_handle_; }
285 DownloadManager* download_manager() { return download_manager_; } 286 DownloadManager* download_manager() { return download_manager_; }
286 bool is_paused() const { return is_paused_; } 287 bool is_paused() const { return is_paused_; }
287 bool open_when_complete() const { return open_when_complete_; } 288 bool open_when_complete() const { return open_when_complete_; }
288 void set_open_when_complete(bool open) { open_when_complete_ = open; } 289 void set_open_when_complete(bool open) { open_when_complete_ = open; }
289 bool file_externally_removed() const { return file_externally_removed_; } 290 bool file_externally_removed() const { return file_externally_removed_; }
290 SafetyState safety_state() const { return safety_state_; } 291 SafetyState safety_state() const { return safety_state_; }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 void UpdateTarget(); 372 void UpdateTarget();
372 373
373 // State information used by the download manager. 374 // State information used by the download manager.
374 DownloadStateInfo state_info_; 375 DownloadStateInfo state_info_;
375 376
376 // The handle to the request information. Used for operations outside the 377 // The handle to the request information. Used for operations outside the
377 // download system. 378 // download system.
378 DownloadRequestHandle request_handle_; 379 DownloadRequestHandle request_handle_;
379 380
380 // Download ID assigned by DownloadResourceHandler. 381 // Download ID assigned by DownloadResourceHandler.
381 int32 download_id_; 382 DownloadId download_id_;
382 383
383 // Full path to the downloaded or downloading file. 384 // Full path to the downloaded or downloading file.
384 FilePath full_path_; 385 FilePath full_path_;
385 386
386 // A number that should be appended to the path to make it unique, or 0 if the 387 // A number that should be appended to the path to make it unique, or 0 if the
387 // path should be used as is. 388 // path should be used as is.
388 int path_uniquifier_; 389 int path_uniquifier_;
389 390
390 // The chain of redirects that leading up to and including the final URL. 391 // The chain of redirects that leading up to and including the final URL.
391 std::vector<GURL> url_chain_; 392 std::vector<GURL> url_chain_;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // only. 484 // only.
484 bool open_enabled_; 485 bool open_enabled_;
485 486
486 // Did the delegate delay calling Complete on this download? 487 // Did the delegate delay calling Complete on this download?
487 bool delegate_delayed_complete_; 488 bool delegate_delayed_complete_;
488 489
489 DISALLOW_COPY_AND_ASSIGN(DownloadItem); 490 DISALLOW_COPY_AND_ASSIGN(DownloadItem);
490 }; 491 };
491 492
492 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ 493 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_id_unittest.cc ('k') | content/browser/download/download_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698