| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "content/browser/download/save_file_manager.h" | 7 #include "content/browser/download/save_file_manager.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "content/browser/download/save_file.h" | 15 #include "content/browser/download/save_file.h" |
| 16 #include "content/browser/download/save_package.h" | 16 #include "content/browser/download/save_package.h" |
| 17 #include "content/browser/renderer_host/render_view_host_impl.h" | 17 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 18 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 18 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 19 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 22 #include "net/base/io_buffer.h" | 22 #include "net/base/io_buffer.h" |
| 23 #include "net/base/net_util.h" | 23 #include "net/base/net_util.h" |
| 24 | 24 |
| 25 using content::BrowserThread; | 25 using content::BrowserThread; |
| 26 using content::RenderViewHostImpl; |
| 26 | 27 |
| 27 SaveFileManager::SaveFileManager(ResourceDispatcherHost* rdh) | 28 SaveFileManager::SaveFileManager(ResourceDispatcherHost* rdh) |
| 28 : next_id_(0), | 29 : next_id_(0), |
| 29 resource_dispatcher_host_(rdh) { | 30 resource_dispatcher_host_(rdh) { |
| 30 DCHECK(resource_dispatcher_host_); | 31 DCHECK(resource_dispatcher_host_); |
| 31 } | 32 } |
| 32 | 33 |
| 33 SaveFileManager::~SaveFileManager() { | 34 SaveFileManager::~SaveFileManager() { |
| 34 // Check for clean shutdown. | 35 // Check for clean shutdown. |
| 35 DCHECK(save_file_map_.empty()); | 36 DCHECK(save_file_map_.empty()); |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 SaveFileMap::iterator it = save_file_map_.find(*i); | 516 SaveFileMap::iterator it = save_file_map_.find(*i); |
| 516 if (it != save_file_map_.end()) { | 517 if (it != save_file_map_.end()) { |
| 517 SaveFile* save_file = it->second; | 518 SaveFile* save_file = it->second; |
| 518 DCHECK(!save_file->InProgress()); | 519 DCHECK(!save_file->InProgress()); |
| 519 file_util::Delete(save_file->FullPath(), false); | 520 file_util::Delete(save_file->FullPath(), false); |
| 520 delete save_file; | 521 delete save_file; |
| 521 save_file_map_.erase(it); | 522 save_file_map_.erase(it); |
| 522 } | 523 } |
| 523 } | 524 } |
| 524 } | 525 } |
| OLD | NEW |