| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <Windows.h> | 5 #include <Windows.h> |
| 6 #include <objbase.h> | 6 #include <objbase.h> |
| 7 | 7 |
| 8 #include "chrome/browser/download/save_file_manager.h" | 8 #include "chrome/browser/download/save_file_manager.h" |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // Utility function for converting request IDs to a TabContents. Must be called | 214 // Utility function for converting request IDs to a TabContents. Must be called |
| 215 // only on the UI thread. | 215 // only on the UI thread. |
| 216 SavePackage* SaveFileManager::GetSavePackageFromRenderIds( | 216 SavePackage* SaveFileManager::GetSavePackageFromRenderIds( |
| 217 int render_process_id, int render_view_id) { | 217 int render_process_id, int render_view_id) { |
| 218 TabContents* contents = tab_util::GetTabContentsByID(render_process_id, | 218 TabContents* contents = tab_util::GetTabContentsByID(render_process_id, |
| 219 render_view_id); | 219 render_view_id); |
| 220 if (contents && contents->type() == TAB_CONTENTS_WEB) { | 220 if (contents && contents->type() == TAB_CONTENTS_WEB) { |
| 221 // Convert const pointer of WebContents to pointer of WebContents. | 221 // Convert const pointer of WebContents to pointer of WebContents. |
| 222 const WebContents* web_contents = contents->AsWebContents(); | 222 const WebContents* web_contents = contents->AsWebContents(); |
| 223 if (web_contents) | 223 if (web_contents) |
| 224 return web_contents->get_save_package(); | 224 return web_contents->save_package(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 return NULL; | 227 return NULL; |
| 228 } | 228 } |
| 229 | 229 |
| 230 // Utility function for deleting specified file. | 230 // Utility function for deleting specified file. |
| 231 void SaveFileManager::DeleteDirectoryOrFile(const std::wstring& full_path, | 231 void SaveFileManager::DeleteDirectoryOrFile(const std::wstring& full_path, |
| 232 bool is_dir) { | 232 bool is_dir) { |
| 233 DCHECK(MessageLoop::current() == ui_loop_); | 233 DCHECK(MessageLoop::current() == ui_loop_); |
| 234 MessageLoop* loop = GetSaveLoop(); | 234 MessageLoop* loop = GetSaveLoop(); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 if (it != save_file_map_.end()) { | 576 if (it != save_file_map_.end()) { |
| 577 SaveFile* save_file = it->second; | 577 SaveFile* save_file = it->second; |
| 578 DCHECK(!save_file->in_progress()); | 578 DCHECK(!save_file->in_progress()); |
| 579 DeleteFile(save_file->full_path().c_str()); | 579 DeleteFile(save_file->full_path().c_str()); |
| 580 delete save_file; | 580 delete save_file; |
| 581 save_file_map_.erase(it); | 581 save_file_map_.erase(it); |
| 582 } | 582 } |
| 583 } | 583 } |
| 584 } | 584 } |
| 585 | 585 |
| OLD | NEW |