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

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

Issue 7192016: chrome.experimental.downloads (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merged db_handle, id; onCreated, onErased Created 9 years, 5 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 | « chrome/browser/download/download_history.cc ('k') | chrome/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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 // Returns true if the download has been cancelled or was interrupted. 252 // Returns true if the download has been cancelled or was interrupted.
253 bool IsCancelled() const; 253 bool IsCancelled() const;
254 254
255 // Returns true if the download was interrupted. 255 // Returns true if the download was interrupted.
256 bool IsInterrupted() const; 256 bool IsInterrupted() const;
257 257
258 // Returns true if we have all the data and know the final file name. 258 // Returns true if we have all the data and know the final file name.
259 bool IsComplete() const; 259 bool IsComplete() const;
260 260
261 // Returns true if the item is in the history db.
262 bool IsInHistory() const;
263 void SetIsInHistory(bool iih) { is_in_history_ = iih; }
264
261 // Accessors 265 // Accessors
262 DownloadState state() const { return state_; } 266 DownloadState state() const { return state_; }
263 const FilePath& full_path() const { return full_path_; } 267 const FilePath& full_path() const { return full_path_; }
264 void set_path_uniquifier(int uniquifier) { 268 void set_path_uniquifier(int uniquifier) {
265 state_info_.path_uniquifier = uniquifier; 269 state_info_.path_uniquifier = uniquifier;
266 } 270 }
267 const GURL& GetURL() const; 271 const GURL& GetURL() const;
268 272
269 const std::vector<GURL>& url_chain() const { return url_chain_; } 273 const std::vector<GURL>& url_chain() const { return url_chain_; }
270 const GURL& original_url() const { return url_chain_.front(); } 274 const GURL& original_url() const { return url_chain_.front(); }
271 const GURL& referrer_url() const { return referrer_url_; } 275 const GURL& referrer_url() const { return referrer_url_; }
272 std::string content_disposition() const { return content_disposition_; } 276 std::string content_disposition() const { return content_disposition_; }
273 std::string mime_type() const { return mime_type_; } 277 std::string mime_type() const { return mime_type_; }
274 std::string original_mime_type() const { return original_mime_type_; } 278 std::string original_mime_type() const { return original_mime_type_; }
275 std::string referrer_charset() const { return referrer_charset_; } 279 std::string referrer_charset() const { return referrer_charset_; }
276 int64 total_bytes() const { return total_bytes_; } 280 int64 total_bytes() const { return total_bytes_; }
277 void set_total_bytes(int64 total_bytes) { 281 void set_total_bytes(int64 total_bytes) {
278 total_bytes_ = total_bytes; 282 total_bytes_ = total_bytes;
279 } 283 }
280 int64 received_bytes() const { return received_bytes_; } 284 int64 received_bytes() const { return received_bytes_; }
281 int32 id() const { return download_id_; } 285 int32 id() const { return download_id_; }
282 base::Time start_time() const { return start_time_; } 286 base::Time start_time() const { return start_time_; }
283 void set_db_handle(int64 handle) { db_handle_ = handle; }
284 int64 db_handle() const { return db_handle_; }
285 bool is_paused() const { return is_paused_; } 287 bool is_paused() const { return is_paused_; }
286 bool open_when_complete() const { return open_when_complete_; } 288 bool open_when_complete() const { return open_when_complete_; }
287 void set_open_when_complete(bool open) { open_when_complete_ = open; } 289 void set_open_when_complete(bool open) { open_when_complete_ = open; }
288 bool file_externally_removed() const { return file_externally_removed_; } 290 bool file_externally_removed() const { return file_externally_removed_; }
289 SafetyState safety_state() const { return safety_state_; } 291 SafetyState safety_state() const { return safety_state_; }
290 void set_safety_state(SafetyState safety_state) { 292 void set_safety_state(SafetyState safety_state) {
291 safety_state_ = safety_state; 293 safety_state_ = safety_state;
292 } 294 }
293 // Why |safety_state_| is not SAFE. 295 // Why |safety_state_| is not SAFE.
294 DangerType GetDangerType() const; 296 DangerType GetDangerType() const;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 // items which are CRXes. Use is_extension_install() to check. 367 // items which are CRXes. Use is_extension_install() to check.
366 void StartCrxInstall(); 368 void StartCrxInstall();
367 369
368 // State information used by the download manager. 370 // State information used by the download manager.
369 DownloadStateInfo state_info_; 371 DownloadStateInfo state_info_;
370 372
371 // The handle to the request information. Used for operations outside the 373 // The handle to the request information. Used for operations outside the
372 // download system. 374 // download system.
373 DownloadRequestHandle request_handle_; 375 DownloadRequestHandle request_handle_;
374 376
375 // Download ID assigned by DownloadResourceHandler. 377 // Download ID assigned by DownloadPrefs. Always unique and persistent.
376 int32 download_id_; 378 int32 download_id_;
377 379
380 bool is_in_history_;
381
378 // Full path to the downloaded or downloading file. 382 // Full path to the downloaded or downloading file.
379 FilePath full_path_; 383 FilePath full_path_;
380 384
381 // A number that should be appended to the path to make it unique, or 0 if the 385 // A number that should be appended to the path to make it unique, or 0 if the
382 // path should be used as is. 386 // path should be used as is.
383 int path_uniquifier_; 387 int path_uniquifier_;
384 388
385 // The chain of redirects that leading up to and including the final URL. 389 // The chain of redirects that leading up to and including the final URL.
386 std::vector<GURL> url_chain_; 390 std::vector<GURL> url_chain_;
387 391
(...skipping 30 matching lines...) Expand all
418 422
419 // The current state of this download 423 // The current state of this download
420 DownloadState state_; 424 DownloadState state_;
421 425
422 // The views of this item in the download shelf and download tab 426 // The views of this item in the download shelf and download tab
423 ObserverList<Observer> observers_; 427 ObserverList<Observer> observers_;
424 428
425 // Time the download was started 429 // Time the download was started
426 base::Time start_time_; 430 base::Time start_time_;
427 431
428 // Our persistent store handle
429 int64 db_handle_;
430
431 // Timer for regularly updating our observers 432 // Timer for regularly updating our observers
432 base::RepeatingTimer<DownloadItem> update_timer_; 433 base::RepeatingTimer<DownloadItem> update_timer_;
433 434
434 // Our owning object 435 // Our owning object
435 DownloadManager* download_manager_; 436 DownloadManager* download_manager_;
436 437
437 // In progress downloads may be paused by the user, we note it here 438 // In progress downloads may be paused by the user, we note it here
438 bool is_paused_; 439 bool is_paused_;
439 440
440 // A flag for indicating if the download should be opened at completion. 441 // A flag for indicating if the download should be opened at completion.
(...skipping 30 matching lines...) Expand all
471 // only. 472 // only.
472 bool open_enabled_; 473 bool open_enabled_;
473 474
474 // DownloadItem observes CRX installs it initiates. 475 // DownloadItem observes CRX installs it initiates.
475 NotificationRegistrar registrar_; 476 NotificationRegistrar registrar_;
476 477
477 DISALLOW_COPY_AND_ASSIGN(DownloadItem); 478 DISALLOW_COPY_AND_ASSIGN(DownloadItem);
478 }; 479 };
479 480
480 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ 481 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_history.cc ('k') | chrome/browser/download/download_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698