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