| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/download/download_item_impl.h" | 5 #include "content/browser/download/download_item_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 bound_net_log_.AddEvent( | 564 bound_net_log_.AddEvent( |
| 565 net::NetLog::TYPE_DOWNLOAD_ITEM_CANCELED, | 565 net::NetLog::TYPE_DOWNLOAD_ITEM_CANCELED, |
| 566 make_scoped_refptr( | 566 make_scoped_refptr( |
| 567 new download_net_logs::ItemCanceledParameters(received_bytes_, | 567 new download_net_logs::ItemCanceledParameters(received_bytes_, |
| 568 hash_state_))); | 568 hash_state_))); |
| 569 break; | 569 break; |
| 570 default: | 570 default: |
| 571 break; | 571 break; |
| 572 } | 572 } |
| 573 | 573 |
| 574 VLOG(20) << " " << __FUNCTION__ << "()" << " this = " << DebugString(true); |
| 575 |
| 574 UpdateObservers(); | 576 UpdateObservers(); |
| 575 | 577 |
| 576 bool is_done = (state_ != IN_PROGRESS); | 578 bool is_done = (state_ != IN_PROGRESS); |
| 577 bool was_done = (old_state != IN_PROGRESS); | 579 bool was_done = (old_state != IN_PROGRESS); |
| 578 if (is_done && !was_done) | 580 if (is_done && !was_done) |
| 579 bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_ITEM_ACTIVE, NULL); | 581 bound_net_log_.EndEvent(net::NetLog::TYPE_DOWNLOAD_ITEM_ACTIVE, NULL); |
| 580 } | 582 } |
| 581 | 583 |
| 582 void DownloadItemImpl::UpdateSafetyState() { | 584 void DownloadItemImpl::UpdateSafetyState() { |
| 583 SafetyState updated_value = state_info_.IsDangerous() ? | 585 SafetyState updated_value = state_info_.IsDangerous() ? |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 for ( ; verbose && (iter != last); ++iter) { | 984 for ( ; verbose && (iter != last); ++iter) { |
| 983 url_list += " ->\n\t"; | 985 url_list += " ->\n\t"; |
| 984 const GURL& next_url = *iter; | 986 const GURL& next_url = *iter; |
| 985 url_list += next_url.spec(); | 987 url_list += next_url.spec(); |
| 986 } | 988 } |
| 987 } | 989 } |
| 988 | 990 |
| 989 if (verbose) { | 991 if (verbose) { |
| 990 description += base::StringPrintf( | 992 description += base::StringPrintf( |
| 991 " db_handle = %" PRId64 | 993 " db_handle = %" PRId64 |
| 992 " total_bytes = %" PRId64 | 994 " total = %" PRId64 |
| 993 " received_bytes = %" PRId64 | 995 " received = %" PRId64 |
| 994 " is_paused = %c" | 996 " reason = %s" |
| 995 " is_otr = %c" | 997 " paused = %c" |
| 996 " safety_state = %s" | 998 " otr = %c" |
| 999 " safety = %s" |
| 997 " last_modified = '%s'" | 1000 " last_modified = '%s'" |
| 998 " etag = '%s'" | 1001 " etag = '%s'" |
| 999 " url_chain = \n\t\"%s\"\n\t" | 1002 " url_chain = \n\t\"%s\"\n\t" |
| 1000 " target_name = \"%" PRFilePath "\"" | 1003 " target = \"%" PRFilePath "\"" |
| 1001 " full_path = \"%" PRFilePath "\"", | 1004 " full_path = \"%" PRFilePath "\"", |
| 1002 GetDbHandle(), | 1005 GetDbHandle(), |
| 1003 GetTotalBytes(), | 1006 GetTotalBytes(), |
| 1004 GetReceivedBytes(), | 1007 GetReceivedBytes(), |
| 1008 InterruptReasonDebugString(last_reason_).c_str(), |
| 1005 IsPaused() ? 'T' : 'F', | 1009 IsPaused() ? 'T' : 'F', |
| 1006 IsOtr() ? 'T' : 'F', | 1010 IsOtr() ? 'T' : 'F', |
| 1007 DebugSafetyStateString(GetSafetyState()), | 1011 DebugSafetyStateString(GetSafetyState()), |
| 1008 GetLastModifiedTime().c_str(), | 1012 GetLastModifiedTime().c_str(), |
| 1009 GetETag().c_str(), | 1013 GetETag().c_str(), |
| 1010 url_list.c_str(), | 1014 url_list.c_str(), |
| 1011 state_info_.target_name.value().c_str(), | 1015 state_info_.target_name.value().c_str(), |
| 1012 GetFullPath().value().c_str()); | 1016 GetFullPath().value().c_str()); |
| 1013 } else { | 1017 } else { |
| 1014 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); | 1018 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 std::map<const void*, ExternalData*>::iterator it = | 1146 std::map<const void*, ExternalData*>::iterator it = |
| 1143 external_data_map_.find(key); | 1147 external_data_map_.find(key); |
| 1144 | 1148 |
| 1145 if (it == external_data_map_.end()) { | 1149 if (it == external_data_map_.end()) { |
| 1146 external_data_map_[key] = data; | 1150 external_data_map_[key] = data; |
| 1147 } else if (it->second != data) { | 1151 } else if (it->second != data) { |
| 1148 delete it->second; | 1152 delete it->second; |
| 1149 it->second = data; | 1153 it->second = data; |
| 1150 } | 1154 } |
| 1151 } | 1155 } |
| OLD | NEW |