| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/download/download_item.h" | 5 #include "chrome/browser/download/download_item.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/timer.h" | 8 #include "base/timer.h" |
| 9 #include "chrome/browser/download/download_history.h" |
| 9 #include "chrome/browser/download/download_manager.h" | 10 #include "chrome/browser/download/download_manager.h" |
| 10 #include "chrome/browser/download/download_util.h" | 11 #include "chrome/browser/download/download_util.h" |
| 11 #include "chrome/browser/history/download_types.h" | 12 #include "chrome/browser/history/download_types.h" |
| 12 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // Update frequency (milliseconds). | 17 // Update frequency (milliseconds). |
| 17 const int kUpdateTimeMs = 1000; | 18 const int kUpdateTimeMs = 1000; |
| 18 | 19 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 path_uniquifier_(info.path_uniquifier), | 62 path_uniquifier_(info.path_uniquifier), |
| 62 url_(info.url), | 63 url_(info.url), |
| 63 referrer_url_(info.referrer_url), | 64 referrer_url_(info.referrer_url), |
| 64 mime_type_(info.mime_type), | 65 mime_type_(info.mime_type), |
| 65 original_mime_type_(info.original_mime_type), | 66 original_mime_type_(info.original_mime_type), |
| 66 total_bytes_(info.total_bytes), | 67 total_bytes_(info.total_bytes), |
| 67 received_bytes_(0), | 68 received_bytes_(0), |
| 68 start_tick_(base::TimeTicks::Now()), | 69 start_tick_(base::TimeTicks::Now()), |
| 69 state_(IN_PROGRESS), | 70 state_(IN_PROGRESS), |
| 70 start_time_(info.start_time), | 71 start_time_(info.start_time), |
| 71 db_handle_(DownloadManager::kUninitializedHandle), | 72 db_handle_(DownloadHistory::kUninitializedHandle), |
| 72 download_manager_(download_manager), | 73 download_manager_(download_manager), |
| 73 is_paused_(false), | 74 is_paused_(false), |
| 74 open_when_complete_(false), | 75 open_when_complete_(false), |
| 75 safety_state_(info.is_dangerous ? DANGEROUS : SAFE), | 76 safety_state_(info.is_dangerous ? DANGEROUS : SAFE), |
| 76 auto_opened_(false), | 77 auto_opened_(false), |
| 77 original_name_(info.original_name), | 78 original_name_(info.original_name), |
| 78 render_process_id_(info.child_id), | 79 render_process_id_(info.child_id), |
| 79 request_id_(info.request_id), | 80 request_id_(info.request_id), |
| 80 save_as_(info.prompt_user_for_save_location), | 81 save_as_(info.prompt_user_for_save_location), |
| 81 is_otr_(is_otr), | 82 is_otr_(is_otr), |
| (...skipping 14 matching lines...) Expand all Loading... |
| 96 path_uniquifier_(0), | 97 path_uniquifier_(0), |
| 97 url_(url), | 98 url_(url), |
| 98 referrer_url_(GURL()), | 99 referrer_url_(GURL()), |
| 99 mime_type_(std::string()), | 100 mime_type_(std::string()), |
| 100 original_mime_type_(std::string()), | 101 original_mime_type_(std::string()), |
| 101 total_bytes_(0), | 102 total_bytes_(0), |
| 102 received_bytes_(0), | 103 received_bytes_(0), |
| 103 start_tick_(base::TimeTicks::Now()), | 104 start_tick_(base::TimeTicks::Now()), |
| 104 state_(IN_PROGRESS), | 105 state_(IN_PROGRESS), |
| 105 start_time_(base::Time::Now()), | 106 start_time_(base::Time::Now()), |
| 106 db_handle_(DownloadManager::kUninitializedHandle), | 107 db_handle_(DownloadHistory::kUninitializedHandle), |
| 107 download_manager_(download_manager), | 108 download_manager_(download_manager), |
| 108 is_paused_(false), | 109 is_paused_(false), |
| 109 open_when_complete_(false), | 110 open_when_complete_(false), |
| 110 safety_state_(SAFE), | 111 safety_state_(SAFE), |
| 111 auto_opened_(false), | 112 auto_opened_(false), |
| 112 original_name_(FilePath()), | 113 original_name_(FilePath()), |
| 113 render_process_id_(-1), | 114 render_process_id_(-1), |
| 114 request_id_(-1), | 115 request_id_(-1), |
| 115 save_as_(false), | 116 save_as_(false), |
| 116 is_otr_(is_otr), | 117 is_otr_(is_otr), |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 return name; | 294 return name; |
| 294 } | 295 } |
| 295 return original_name_; | 296 return original_name_; |
| 296 } | 297 } |
| 297 | 298 |
| 298 void DownloadItem::Init(bool start_timer) { | 299 void DownloadItem::Init(bool start_timer) { |
| 299 file_name_ = full_path_.BaseName(); | 300 file_name_ = full_path_.BaseName(); |
| 300 if (start_timer) | 301 if (start_timer) |
| 301 StartProgressTimer(); | 302 StartProgressTimer(); |
| 302 } | 303 } |
| OLD | NEW |