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

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

Issue 7237034: sql::MetaTable.next_download_id, DownloadManager::GetNextId() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix 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:
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 #include <iostream>
22 23
23 #include "base/basictypes.h" 24 #include "base/basictypes.h"
24 #include "base/file_path.h" 25 #include "base/file_path.h"
25 #include "base/observer_list.h" 26 #include "base/observer_list.h"
26 #include "base/time.h" 27 #include "base/time.h"
27 #include "base/timer.h" 28 #include "base/timer.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 "googleurl/src/gurl.h" 31 #include "googleurl/src/gurl.h"
31 32
32 class DownloadFileManager; 33 class DownloadFileManager;
34 class DownloadId;
33 class DownloadManager; 35 class DownloadManager;
34 struct DownloadCreateInfo; 36 struct DownloadCreateInfo;
35 struct DownloadPersistentStoreInfo; 37 struct DownloadPersistentStoreInfo;
36 38
37 // One DownloadItem per download. This is the model class that stores all the 39 // One DownloadItem per download. This is the model class that stores all the
38 // state for a download. Multiple views, such as a tab's download shelf and the 40 // state for a download. Multiple views, such as a tab's download shelf and the
39 // Destination tab's download view, may refer to a given DownloadItem. 41 // Destination tab's download view, may refer to a given DownloadItem.
40 // 42 //
41 // This is intended to be used only on the UI thread. 43 // This is intended to be used only on the UI thread.
42 class DownloadItem { 44 class DownloadItem {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // Constructing for a regular download: 117 // Constructing for a regular download:
116 DownloadItem(DownloadManager* download_manager, 118 DownloadItem(DownloadManager* download_manager,
117 const DownloadCreateInfo& info, 119 const DownloadCreateInfo& info,
118 bool is_otr); 120 bool is_otr);
119 121
120 // Constructing for the "Save Page As..." feature: 122 // Constructing for the "Save Page As..." feature:
121 DownloadItem(DownloadManager* download_manager, 123 DownloadItem(DownloadManager* download_manager,
122 const FilePath& path, 124 const FilePath& path,
123 const GURL& url, 125 const GURL& url,
124 bool is_otr, 126 bool is_otr,
125 int download_id); 127 DownloadId download_id);
126 128
127 virtual ~DownloadItem(); 129 virtual ~DownloadItem();
128 130
129 void AddObserver(Observer* observer); 131 void AddObserver(Observer* observer);
130 void RemoveObserver(Observer* observer); 132 void RemoveObserver(Observer* observer);
131 133
132 // Notifies our observers periodically. 134 // Notifies our observers periodically.
133 void UpdateObservers(); 135 void UpdateObservers();
134 136
135 // Returns true if it is OK to open a folder which this file is inside. 137 // 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
266 std::string content_disposition() const { return content_disposition_; } 268 std::string content_disposition() const { return content_disposition_; }
267 std::string mime_type() const { return mime_type_; } 269 std::string mime_type() const { return mime_type_; }
268 std::string original_mime_type() const { return original_mime_type_; } 270 std::string original_mime_type() const { return original_mime_type_; }
269 std::string referrer_charset() const { return referrer_charset_; } 271 std::string referrer_charset() const { return referrer_charset_; }
270 int64 total_bytes() const { return total_bytes_; } 272 int64 total_bytes() const { return total_bytes_; }
271 void set_total_bytes(int64 total_bytes) { 273 void set_total_bytes(int64 total_bytes) {
272 total_bytes_ = total_bytes; 274 total_bytes_ = total_bytes;
273 } 275 }
274 int64 received_bytes() const { return received_bytes_; } 276 int64 received_bytes() const { return received_bytes_; }
275 int32 id() const { return download_id_; } 277 int32 id() const { return download_id_; }
278 DownloadId global_id() const;
276 base::Time start_time() const { return start_time_; } 279 base::Time start_time() const { return start_time_; }
277 void set_db_handle(int64 handle) { db_handle_ = handle; } 280 void set_db_handle(int64 handle) { db_handle_ = handle; }
278 int64 db_handle() const { return db_handle_; } 281 int64 db_handle() const { return db_handle_; }
279 DownloadManager* download_manager() { return download_manager_; } 282 DownloadManager* download_manager() { return download_manager_; }
280 bool is_paused() const { return is_paused_; } 283 bool is_paused() const { return is_paused_; }
281 bool open_when_complete() const { return open_when_complete_; } 284 bool open_when_complete() const { return open_when_complete_; }
282 void set_open_when_complete(bool open) { open_when_complete_ = open; } 285 void set_open_when_complete(bool open) { open_when_complete_ = open; }
283 bool file_externally_removed() const { return file_externally_removed_; } 286 bool file_externally_removed() const { return file_externally_removed_; }
284 SafetyState safety_state() const { return safety_state_; } 287 SafetyState safety_state() const { return safety_state_; }
285 // Why |safety_state_| is not SAFE. 288 // Why |safety_state_| is not SAFE.
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 // only. 478 // only.
476 bool open_enabled_; 479 bool open_enabled_;
477 480
478 // Did the delegate delay calling Complete on this download? 481 // Did the delegate delay calling Complete on this download?
479 bool delegate_delayed_complete_; 482 bool delegate_delayed_complete_;
480 483
481 DISALLOW_COPY_AND_ASSIGN(DownloadItem); 484 DISALLOW_COPY_AND_ASSIGN(DownloadItem);
482 }; 485 };
483 486
484 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ 487 #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