OLD | NEW |
1 // Copyright (c) 2011 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" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } else { | 169 } else { |
170 SavePackageMap::iterator it = packages_.find(save_id); | 170 SavePackageMap::iterator it = packages_.find(save_id); |
171 if (it != packages_.end()) | 171 if (it != packages_.end()) |
172 packages_.erase(it); | 172 packages_.erase(it); |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 // Static | 176 // Static |
177 SavePackage* SaveFileManager::GetSavePackageFromRenderIds( | 177 SavePackage* SaveFileManager::GetSavePackageFromRenderIds( |
178 int render_process_id, int render_view_id) { | 178 int render_process_id, int render_view_id) { |
179 RenderViewHost* render_view_host = | 179 RenderViewHostImpl* render_view_host = |
180 RenderViewHost::FromID(render_process_id, render_view_id); | 180 RenderViewHostImpl::FromID(render_process_id, render_view_id); |
181 if (!render_view_host) | 181 if (!render_view_host) |
182 return NULL; | 182 return NULL; |
183 | 183 |
184 TabContents* tab = static_cast<TabContents*>( | 184 TabContents* tab = static_cast<TabContents*>( |
185 render_view_host->delegate()->GetAsWebContents()); | 185 render_view_host->GetDelegate()->GetAsWebContents()); |
186 if (!tab) | 186 if (!tab) |
187 return NULL; | 187 return NULL; |
188 | 188 |
189 return tab->save_package(); | 189 return tab->save_package(); |
190 } | 190 } |
191 | 191 |
192 void SaveFileManager::DeleteDirectoryOrFile(const FilePath& full_path, | 192 void SaveFileManager::DeleteDirectoryOrFile(const FilePath& full_path, |
193 bool is_dir) { | 193 bool is_dir) { |
194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
195 BrowserThread::PostTask( | 195 BrowserThread::PostTask( |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 SaveFileMap::iterator it = save_file_map_.find(*i); | 515 SaveFileMap::iterator it = save_file_map_.find(*i); |
516 if (it != save_file_map_.end()) { | 516 if (it != save_file_map_.end()) { |
517 SaveFile* save_file = it->second; | 517 SaveFile* save_file = it->second; |
518 DCHECK(!save_file->InProgress()); | 518 DCHECK(!save_file->InProgress()); |
519 file_util::Delete(save_file->FullPath(), false); | 519 file_util::Delete(save_file->FullPath(), false); |
520 delete save_file; | 520 delete save_file; |
521 save_file_map_.erase(it); | 521 save_file_map_.erase(it); |
522 } | 522 } |
523 } | 523 } |
524 } | 524 } |
OLD | NEW |