Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(900)

Side by Side Diff: content/browser/download/download_item_impl.cc

Issue 9316004: Move common file path related methods between chrome & content to file_util. I reduced the 4 meth... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: remove includes Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 content::BrowserContext* DownloadItemImpl::GetBrowserContext() const { 783 content::BrowserContext* DownloadItemImpl::GetBrowserContext() const {
784 return delegate_->GetBrowserContext(); 784 return delegate_->GetBrowserContext();
785 } 785 }
786 786
787 FilePath DownloadItemImpl::GetTargetFilePath() const { 787 FilePath DownloadItemImpl::GetTargetFilePath() const {
788 return full_path_.DirName().Append(state_info_.target_name); 788 return full_path_.DirName().Append(state_info_.target_name);
789 } 789 }
790 790
791 FilePath DownloadItemImpl::GetFileNameToReportUser() const { 791 FilePath DownloadItemImpl::GetFileNameToReportUser() const {
792 if (state_info_.path_uniquifier > 0) { 792 if (state_info_.path_uniquifier > 0) {
793 FilePath name(state_info_.target_name); 793 return state_info_.target_name.InsertBeforeExtensionASCII(
794 DownloadFile::AppendNumberToPath(&name, state_info_.path_uniquifier); 794 StringPrintf(" (%d)", state_info_.path_uniquifier));
795 return name;
796 } 795 }
797 return state_info_.target_name; 796 return state_info_.target_name;
798 } 797 }
799 798
800 FilePath DownloadItemImpl::GetUserVerifiedFilePath() const { 799 FilePath DownloadItemImpl::GetUserVerifiedFilePath() const {
801 return (safety_state_ == DownloadItem::SAFE) ? 800 return (safety_state_ == DownloadItem::SAFE) ?
802 GetTargetFilePath() : full_path_; 801 GetTargetFilePath() : full_path_;
803 } 802 }
804 803
805 void DownloadItemImpl::OffThreadCancel(DownloadFileManager* file_manager) { 804 void DownloadItemImpl::OffThreadCancel(DownloadFileManager* file_manager) {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 std::map<const void*, ExternalData*>::iterator it = 1001 std::map<const void*, ExternalData*>::iterator it =
1003 external_data_map_.find(key); 1002 external_data_map_.find(key);
1004 1003
1005 if (it == external_data_map_.end()) { 1004 if (it == external_data_map_.end()) {
1006 external_data_map_[key] = data; 1005 external_data_map_[key] = data;
1007 } else if (it->second != data) { 1006 } else if (it->second != data) {
1008 delete it->second; 1007 delete it->second;
1009 it->second = data; 1008 it->second = data;
1010 } 1009 }
1011 } 1010 }
OLDNEW
« no previous file with comments | « content/browser/download/download_file_manager_unittest.cc ('k') | content/browser/download/download_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698