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

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

Issue 7112011: Change DownloadProcessHandle to be more of an encapsulated class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unneeded include file. Created 9 years, 6 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
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 CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ 17 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_
18 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ 18 #define CHROME_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 "chrome/browser/download/download_process_handle.h" 28 #include "chrome/browser/download/download_request_handle.h"
29 #include "chrome/browser/download/download_state_info.h" 29 #include "chrome/browser/download/download_state_info.h"
30 #include "googleurl/src/gurl.h" 30 #include "googleurl/src/gurl.h"
31 31
32 class DownloadFileManager; 32 class DownloadFileManager;
33 class DownloadManager; 33 class DownloadManager;
34 struct DownloadCreateInfo; 34 struct DownloadCreateInfo;
35 struct DownloadHistoryInfo; 35 struct DownloadHistoryInfo;
36 36
37 // One DownloadItem per download. This is the model class that stores all the 37 // 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 38 // state for a download. Multiple views, such as a tab's download shelf and the
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 bool is_extension_install() const { 287 bool is_extension_install() const {
288 return state_info_.is_extension_install; 288 return state_info_.is_extension_install;
289 } 289 }
290 FilePath suggested_path() const { return state_info_.suggested_path; } 290 FilePath suggested_path() const { return state_info_.suggested_path; }
291 bool is_temporary() const { return is_temporary_; } 291 bool is_temporary() const { return is_temporary_; }
292 void set_opened(bool opened) { opened_ = opened; } 292 void set_opened(bool opened) { opened_ = opened; }
293 bool opened() const { return opened_; } 293 bool opened() const { return opened_; }
294 294
295 DownloadHistoryInfo GetHistoryInfo() const; 295 DownloadHistoryInfo GetHistoryInfo() const;
296 DownloadStateInfo state_info() const { return state_info_; } 296 DownloadStateInfo state_info() const { return state_info_; }
297 const DownloadProcessHandle& process_handle() const { 297 const DownloadRequestHandle& request_handle() const {
298 return process_handle_; 298 return request_handle_;
299 } 299 }
300 300
301 // Returns the final target file path for the download. 301 // Returns the final target file path for the download.
302 FilePath GetTargetFilePath() const; 302 FilePath GetTargetFilePath() const;
303 303
304 // Returns the file-name that should be reported to the user, which is 304 // Returns the file-name that should be reported to the user, which is
305 // target_name possibly with the uniquifier number. 305 // target_name possibly with the uniquifier number.
306 FilePath GetFileNameToReportUser() const; 306 FilePath GetFileNameToReportUser() const;
307 307
308 // Returns the user-verified target file path for the download. 308 // Returns the user-verified target file path for the download.
(...skipping 23 matching lines...) Expand all
332 // is completed. 332 // is completed.
333 void Completed(); 333 void Completed();
334 334
335 // Start/stop sending periodic updates to our observers 335 // Start/stop sending periodic updates to our observers
336 void StartProgressTimer(); 336 void StartProgressTimer();
337 void StopProgressTimer(); 337 void StopProgressTimer();
338 338
339 // State information used by the download manager. 339 // State information used by the download manager.
340 DownloadStateInfo state_info_; 340 DownloadStateInfo state_info_;
341 341
342 // The handle to the process information. Used for operations outside the 342 // The handle to the request information. Used for operations outside the
343 // download system. 343 // download system.
344 DownloadProcessHandle process_handle_; 344 DownloadRequestHandle request_handle_;
345 345
346 // Download ID assigned by DownloadResourceHandler. 346 // Download ID assigned by DownloadResourceHandler.
347 int32 download_id_; 347 int32 download_id_;
348 348
349 // Full path to the downloaded or downloading file. 349 // Full path to the downloaded or downloading file.
350 FilePath full_path_; 350 FilePath full_path_;
351 351
352 // A number that should be appended to the path to make it unique, or 0 if the 352 // A number that should be appended to the path to make it unique, or 0 if the
353 // path should be used as is. 353 // path should be used as is.
354 int path_uniquifier_; 354 int path_uniquifier_;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 bool opened_; 436 bool opened_;
437 437
438 // Do we actual open downloads when requested? For testing purposes 438 // Do we actual open downloads when requested? For testing purposes
439 // only. 439 // only.
440 bool open_enabled_; 440 bool open_enabled_;
441 441
442 DISALLOW_COPY_AND_ASSIGN(DownloadItem); 442 DISALLOW_COPY_AND_ASSIGN(DownloadItem);
443 }; 443 };
444 444
445 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ 445 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698