diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-05 23:36:01 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-05 23:36:01 +0000 |
commit | 345e1b89c38bf19ebce483ae5392474bbf63ae59 (patch) | |
tree | 63f2e61cecbf1f28b876d21c3b8d6e4433220805 /chrome/browser | |
parent | 6ee68ee792e95e2460ac1f52162f6762944d5239 (diff) | |
download | chromium_src-345e1b89c38bf19ebce483ae5392474bbf63ae59.zip chromium_src-345e1b89c38bf19ebce483ae5392474bbf63ae59.tar.gz chromium_src-345e1b89c38bf19ebce483ae5392474bbf63ae59.tar.bz2 |
Unbreak unit tests. Revert r7564.
tbr=jhawkins
Review URL: http://codereview.chromium.org/16522
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7571 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 2 | ||||
-rw-r--r-- | chrome/browser/download/download_file.cc | 39 | ||||
-rw-r--r-- | chrome/browser/download/download_file.h | 21 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.cc | 171 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.h | 64 | ||||
-rw-r--r-- | chrome/browser/download/download_manager_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/download/download_util.cc | 21 | ||||
-rw-r--r-- | chrome/browser/download/save_package.cc | 5 | ||||
-rw-r--r-- | chrome/browser/history/download_database.cc | 5 | ||||
-rw-r--r-- | chrome/browser/history/download_types.h | 9 | ||||
-rw-r--r-- | chrome/browser/history/history_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/database_perftest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/download_item_view.cc | 10 | ||||
-rw-r--r-- | chrome/browser/views/download_tab_view.cc | 14 |
14 files changed, 182 insertions, 193 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 0fbf0e6..ff96f55f0 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -1909,7 +1909,7 @@ void AutomationProvider::GetDownloadDirectory(const IPC::Message& message, NavigationController* tab = tab_tracker_->GetResource(handle); DownloadManager* dlm = tab->profile()->GetDownloadManager(); DCHECK(dlm); - download_directory = dlm->download_path().ToWStringHack(); + download_directory = dlm->download_path(); } Send(new AutomationMsg_DownloadDirectoryResponse(message.routing_id(), diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc index a33d34b..b06be04 100644 --- a/chrome/browser/download/download_file.cc +++ b/chrome/browser/download/download_file.cc @@ -85,22 +85,22 @@ bool DownloadFile::AppendDataToFile(const char* data, int data_len) { void DownloadFile::Cancel() { Close(); - file_util::Delete(full_path_, false); + DeleteFile(full_path_.c_str()); } // The UI has provided us with our finalized name. -bool DownloadFile::Rename(const FilePath& new_path) { +bool DownloadFile::Rename(const std::wstring& new_path) { Close(); // We cannot rename because rename will keep the same security descriptor // on the destination file. We want to recreate the security descriptor // with the security that makes sense in the new path. - if (!file_util::RenameFileAndResetSecurityDescriptor( - full_path_.value().c_str(), new_path.value().c_str())) { + if (!file_util::RenameFileAndResetSecurityDescriptor(full_path_.c_str(), + new_path.c_str())) { return false; } - file_util::Delete(full_path_, false); + DeleteFile(full_path_.c_str()); full_path_ = new_path; path_renamed_ = true; @@ -129,7 +129,7 @@ bool DownloadFile::Open(const char* open_mode) { } // Sets the Zone to tell Windows that this file comes from the internet. // We ignore the return value because a failure is not fatal. - win_util::SetInternetZoneIdentifier(full_path_.value()); + win_util::SetInternetZoneIdentifier(full_path_); return true; } @@ -512,23 +512,22 @@ void DownloadFileManager::OnDownloadUrl(const GURL& url, // Open a download, or show it in a Windows Explorer window. We run on this // thread to avoid blocking the UI with (potentially) slow Shell operations. // TODO(paulg): File 'stat' operations. -void DownloadFileManager::OnShowDownloadInShell(const FilePath& full_path) { +void DownloadFileManager::OnShowDownloadInShell(const std::wstring full_path) { DCHECK(MessageLoop::current() == file_loop_); - win_util::ShowItemInFolder(full_path.value()); + win_util::ShowItemInFolder(full_path); } // Launches the selected download using ShellExecute 'open' verb. If there is // a valid parent window, the 'safer' version will be used which can // display a modal dialog asking for user consent on dangerous files. -void DownloadFileManager::OnOpenDownloadInShell(const FilePath& full_path, +void DownloadFileManager::OnOpenDownloadInShell(const std::wstring full_path, const std::wstring& url, HWND parent_window) { DCHECK(MessageLoop::current() == file_loop_); if (NULL != parent_window) { - win_util::SaferOpenItemViaShell(parent_window, L"", full_path.value(), - url, true); + win_util::SaferOpenItemViaShell(parent_window, L"", full_path, url, true); } else { - win_util::OpenItemViaShell(full_path.value(), true); + win_util::OpenItemViaShell(full_path, true); } } @@ -536,13 +535,15 @@ void DownloadFileManager::OnOpenDownloadInShell(const FilePath& full_path, // download specified by 'id'. Rename the in progress download, and remove it // from our table if it has been completed or cancelled already. void DownloadFileManager::OnFinalDownloadName(int id, - const FilePath& full_path) { + const std::wstring& full_path) { DCHECK(MessageLoop::current() == file_loop_); DownloadFileMap::iterator it = downloads_.find(id); if (it == downloads_.end()) return; - file_util::CreateDirectory(full_path.DirName()); + std::wstring download_dir = file_util::GetDirectoryFromPath(full_path); + if (!file_util::PathExists(download_dir)) + file_util::CreateDirectory(download_dir); DownloadFile* download = it->second; if (!download->Rename(full_path)) { @@ -575,9 +576,13 @@ void DownloadFileManager::OnFinalDownloadName(int id, this, &DownloadFileManager::StopUpdateTimer)); } -// static -void DownloadFileManager::DeleteFile(const FilePath& path) { +void DownloadFileManager::CreateDirectory(const std::wstring& directory) { + if (!file_util::PathExists(directory)) + file_util::CreateDirectory(directory); +} + +void DownloadFileManager::DeleteFile(const std::wstring& path) { // Make sure we only delete files. - if (!file_util::DirectoryExists(path)) + if (file_util::PathExists(path) && !file_util::DirectoryExists(path)) file_util::Delete(path, false); } diff --git a/chrome/browser/download/download_file.h b/chrome/browser/download/download_file.h index ea74318..cce6398 100644 --- a/chrome/browser/download/download_file.h +++ b/chrome/browser/download/download_file.h @@ -53,7 +53,6 @@ #include "chrome/browser/history/download_types.h" class DownloadManager; -class FilePath; class GURL; class MessageLoop; class ResourceDispatcherHost; @@ -94,12 +93,12 @@ class DownloadFile { void Cancel(); // Rename the download file. Returns 'true' if the rename was successful. - bool Rename(const FilePath& full_path); + bool Rename(const std::wstring& full_path); // Accessors. int64 bytes_so_far() const { return bytes_so_far_; } int id() const { return id_; } - FilePath full_path() const { return full_path_; } + std::wstring full_path() const { return full_path_; } int render_process_id() const { return render_process_id_; } int render_view_id() const { return render_view_id_; } int request_id() const { return request_id_; } @@ -133,7 +132,7 @@ class DownloadFile { int64 bytes_so_far_; // Full path to the downloaded file. - FilePath full_path_; + std::wstring full_path_; // Whether the download is still using its initial temporary path. bool path_renamed_; @@ -193,22 +192,26 @@ class DownloadFileManager void RemoveDownload(int id, DownloadManager* manager); // Handler for shell operations sent from the UI to the download thread. - void OnShowDownloadInShell(const FilePath& full_path); + void OnShowDownloadInShell(const std::wstring full_path); // Handler to open or execute a downloaded file. - void OnOpenDownloadInShell(const FilePath& full_path, + void OnOpenDownloadInShell(const std::wstring full_path, const std::wstring& url, HWND parent_window); // The download manager has provided a final name for a download. Sent from // the UI thread and run on the download thread. - void OnFinalDownloadName(int id, const FilePath& full_path); + void OnFinalDownloadName(int id, const std::wstring& full_path); // Timer notifications. void UpdateInProgressDownloads(); MessageLoop* file_loop() const { return file_loop_; } - // Called by the download manager to delete non validated dangerous downloads. - static void DeleteFile(const FilePath& path); + // Called by the download manager at initialization to ensure the default + // download directory exists. + void CreateDirectory(const std::wstring& directory); + + // Called by the donwload manager to delete non validated dangerous downloads. + void DeleteFile(const std::wstring& path); private: // Timer helpers for updating the UI about the current progress of a download. diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index a441435f..b4bdea9 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -65,23 +65,22 @@ static const int kUninitializedHandle = 0; // Appends the passed the number between parenthesis the path before the // extension. -static void AppendNumberToPath(FilePath* path, int number) { - file_util::InsertBeforeExtension(path, - StringPrintf(FILE_PATH_LITERAL(" (%d)"), number)); +static void AppendNumberToPath(std::wstring* path, int number) { + file_util::InsertBeforeExtension(path, StringPrintf(L" (%d)", number)); } // Attempts to find a number that can be appended to that path to make it // unique. If |path| does not exist, 0 is returned. If it fails to find such // a number, -1 is returned. -static int GetUniquePathNumber(const FilePath& path) { +static int GetUniquePathNumber(const std::wstring& path) { const int kMaxAttempts = 100; if (!file_util::PathExists(path)) return 0; - FilePath new_path; + std::wstring new_path; for (int count = 1; count <= kMaxAttempts; ++count) { - new_path = FilePath(path); + new_path.assign(path); AppendNumberToPath(&new_path, count); if (!file_util::PathExists(new_path)) @@ -91,8 +90,8 @@ static int GetUniquePathNumber(const FilePath& path) { return -1; } -static bool DownloadPathIsDangerous(const FilePath& download_path) { - FilePath desktop_dir; +static bool DownloadPathIsDangerous(const std::wstring& download_path) { + std::wstring desktop_dir; if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_dir)) { NOTREACHED(); return false; @@ -127,10 +126,10 @@ DownloadItem::DownloadItem(const DownloadCreateInfo& info) // Constructor for DownloadItem created via user action in the main thread. DownloadItem::DownloadItem(int32 download_id, - const FilePath& path, + const std::wstring& path, int path_uniquifier, const std::wstring& url, - const FilePath& original_name, + const std::wstring& original_name, const Time start_time, int64 download_size, int render_process_id, @@ -157,7 +156,7 @@ DownloadItem::DownloadItem(int32 download_id, } void DownloadItem::Init(bool start_timer) { - file_name_ = full_path_.BaseName(); + file_name_ = file_util::GetFilenameFromPath(full_path_); if (start_timer) StartProgressTimer(); } @@ -262,10 +261,10 @@ int DownloadItem::PercentComplete() const { return percent; } -void DownloadItem::Rename(const FilePath& full_path) { +void DownloadItem::Rename(const std::wstring& full_path) { DCHECK(!full_path.empty()); full_path_ = full_path; - file_name_ = full_path_.BaseName(); + file_name_ = file_util::GetFilenameFromPath(full_path_); } void DownloadItem::TogglePause() { @@ -275,11 +274,11 @@ void DownloadItem::TogglePause() { UpdateObservers(); } -FilePath DownloadItem::GetFileName() const { +std::wstring DownloadItem::GetFileName() const { if (safety_state_ == DownloadItem::SAFE) return file_name_; if (path_uniquifier_ > 0) { - FilePath name(original_name_); + std::wstring name(original_name_); AppendNumberToPath(&name, path_uniquifier_); return name; } @@ -295,24 +294,24 @@ void DownloadManager::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kDownloadDirUpgraded, false); // The default download path is userprofile\download. - FilePath default_download_path; + std::wstring default_download_path; if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &default_download_path)) { NOTREACHED(); } prefs->RegisterStringPref(prefs::kDownloadDefaultDirectory, - default_download_path.ToWStringHack()); + default_download_path); // If the download path is dangerous we forcefully reset it. But if we do // so we set a flag to make sure we only do it once, to avoid fighting // the user if he really wants it on an unsafe place such as the desktop. if (!prefs->GetBoolean(prefs::kDownloadDirUpgraded)) { - FilePath current_download_dir = FilePath::FromWStringHack( - prefs->GetString(prefs::kDownloadDefaultDirectory)); + std::wstring current_download_dir = + prefs->GetString(prefs::kDownloadDefaultDirectory); if (DownloadPathIsDangerous(current_download_dir)) { prefs->SetString(prefs::kDownloadDefaultDirectory, - default_download_path.ToWStringHack()); + default_download_path); } prefs->SetBoolean(prefs::kDownloadDirUpgraded, true); } @@ -480,14 +479,9 @@ bool DownloadManager::Init(Profile* profile) { download_path_.Init(prefs::kDownloadDefaultDirectory, prefs, NULL); - // This variable is needed to resolve which CreateDirectory we want to point - // to. Without it, the NewRunnableFunction cannot resolve the ambiguity. - // TODO(estade): when file_util::CreateDirectory(wstring) is removed, - // get rid of |CreateDirectoryPtr|. - bool (*CreateDirectoryPtr)(const FilePath&) = &file_util::CreateDirectory; // Ensure that the download directory specified in the preferences exists. - file_loop_->PostTask(FROM_HERE, NewRunnableFunction( - CreateDirectoryPtr, download_path())); + file_loop_->PostTask(FROM_HERE, NewRunnableMethod( + file_manager_, &DownloadFileManager::CreateDirectory, *download_path_)); // We store any file extension that should be opened automatically at // download completion in this pref. @@ -533,17 +527,19 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) { // Determine the proper path for a download, by choosing either the default // download directory, or prompting the user. - FilePath generated_name; + std::wstring generated_name; GenerateFilename(info, &generated_name); if (info->save_as && !last_download_path_.empty()) info->suggested_path = last_download_path_; else - info->suggested_path = download_path(); - info->suggested_path = info->suggested_path.Append(generated_name); + info->suggested_path = *download_path_; + file_util::AppendToPath(&info->suggested_path, generated_name); if (!info->save_as) { // Let's check if this download is dangerous, based on its name. - info->is_dangerous = IsDangerous(info->suggested_path.BaseName()); + const std::wstring filename = + file_util::GetFilenameFromPath(info->suggested_path); + info->is_dangerous = IsDangerous(filename); } // We need to move over to the download thread because we don't want to stat @@ -559,29 +555,31 @@ void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info) { // Check writability of the suggested path. If we can't write to it, default // to the user's "My Documents" directory. We'll prompt them in this case. - FilePath dir = info->suggested_path.DirName(); - FilePath filename = info->suggested_path.BaseName(); + std::wstring dir = file_util::GetDirectoryFromPath(info->suggested_path); + const std::wstring filename = + file_util::GetFilenameFromPath(info->suggested_path); if (!file_util::PathIsWritable(dir)) { info->save_as = true; PathService::Get(chrome::DIR_USER_DOCUMENTS, &info->suggested_path); - info->suggested_path = info->suggested_path.Append(filename); + file_util::AppendToPath(&info->suggested_path, filename); } info->path_uniquifier = GetUniquePathNumber(info->suggested_path); // If the download is deemed dangerous, we'll use a temporary name for it. if (info->is_dangerous) { - info->original_name = FilePath(info->suggested_path).BaseName(); + info->original_name = file_util::GetFilenameFromPath(info->suggested_path); // Create a temporary file to hold the file until the user approves its // download. - FilePath::StringType file_name; - FilePath path; + std::wstring file_name; + std::wstring path; while (path.empty()) { - SStringPrintf(&file_name, FILE_PATH_LITERAL("unconfirmed %d.download"), + SStringPrintf(&file_name, L"unconfirmed %d.download", base::RandInt(0, 100000)); - path = dir.Append(file_name); + path = dir; + file_util::AppendToPath(&path, file_name); if (file_util::PathExists(path)) - path = FilePath(); + path.clear(); } info->suggested_path = path; } else { @@ -601,7 +599,7 @@ void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info) { // Create an empty file at the suggested path so that we don't allocate the // same "non-existant" path to multiple downloads. // See: http://code.google.com/p/chromium/issues/detail?id=3662 - file_util::WriteFile(info->suggested_path.ToWStringHack(), "", 0); + file_util::WriteFile(info->suggested_path, "", 0); } // Now we return to the UI thread. @@ -622,13 +620,11 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) { WebContents* contents = tab_util::GetWebContentsByID( info->render_process_id, info->render_view_id); - std::wstring filter = - win_util::GetFileFilterFromPath(info->suggested_path.value()); + std::wstring filter = win_util::GetFileFilterFromPath(info->suggested_path); HWND owning_hwnd = contents ? GetAncestor(contents->GetContainerHWND(), GA_ROOT) : NULL; select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, - std::wstring(), - info->suggested_path.ToWStringHack(), + std::wstring(), info->suggested_path, filter, std::wstring(), owning_hwnd, info); } else { @@ -638,7 +634,7 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) { } void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info, - const FilePath& target_path) { + const std::wstring& target_path) { scoped_ptr<DownloadCreateInfo> infop(info); info->path = target_path; @@ -813,13 +809,14 @@ void DownloadManager::ContinueDownloadFinished(DownloadItem* download) { // Called on the file thread. Renames the downloaded file to its original name. void DownloadManager::ProceedWithFinishedDangerousDownload( int64 download_handle, - const FilePath& path, - const FilePath& original_name) { + const std::wstring& path, + const std::wstring& original_name) { bool success = false; - FilePath new_path; + std::wstring new_path = path; int uniquifier = 0; if (file_util::PathExists(path)) { - new_path = new_path.DirName().Append(original_name); + new_path = file_util::GetDirectoryFromPath(new_path); + file_util::AppendToPath(&new_path, original_name); // Make our name unique at this point, as if a dangerous file is downloading // and a 2nd download is started for a file with the same name, they would // have the same path. This is because we uniquify the name on download @@ -841,7 +838,7 @@ void DownloadManager::ProceedWithFinishedDangerousDownload( // Call from the file thread when the finished dangerous download was renamed. void DownloadManager::DangerousDownloadRenamed(int64 download_handle, bool success, - const FilePath& new_path, + const std::wstring& new_path, int new_path_uniquifier) { DownloadMap::iterator it = downloads_.find(download_handle); if (it == downloads_.end()) { @@ -940,13 +937,13 @@ void DownloadManager::OnPauseDownloadRequest(ResourceDispatcherHost* rdh, rdh->PauseRequest(render_process_id, request_id, pause); } -bool DownloadManager::IsDangerous(const FilePath& file_name) { +bool DownloadManager::IsDangerous(const std::wstring& file_name) { // TODO(jcampan): Improve me. return IsExecutable(file_util::GetFileExtensionFromPath(file_name)); } void DownloadManager::RenameDownload(DownloadItem* download, - const FilePath& new_path) { + const std::wstring& new_path) { download->Rename(new_path); // Update the history. @@ -958,7 +955,7 @@ void DownloadManager::RenameDownload(DownloadItem* download, // FIXME(paulg) see bug 958058. EXPLICIT_ACCESS below is wrong. HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); if (hs) - hs->UpdateDownloadPath(new_path.ToWStringHack(), download->db_handle()); + hs->UpdateDownloadPath(new_path, download->db_handle()); } void DownloadManager::RemoveDownload(int64 download_handle) { @@ -1049,8 +1046,9 @@ void DownloadManager::NotifyAboutDownloadStop() { NotificationService::NoDetails()); } -void DownloadManager::GenerateExtension(const FilePath& file_name, - const std::string& mime_type, FilePath::StringType* generated_extension) { +void DownloadManager::GenerateExtension(const std::wstring& file_name, + const std::string& mime_type, + std::wstring* generated_extension) { // We're worried about three things here: // // 1) Security. Many sites let users upload content, such as buddy icons, to @@ -1066,20 +1064,17 @@ void DownloadManager::GenerateExtension(const FilePath& file_name, // the shell. We block these extensions to prevent a malicious web site // from integrating with the user's shell. - static const FilePath::CharType default_extension[] = - FILE_PATH_LITERAL("download"); + static const wchar_t default_extension[] = L"download"; // See if our file name already contains an extension. - FilePath::StringType extension( - file_util::GetFileExtensionFromPath(file_name)); + std::wstring extension(file_util::GetFileExtensionFromPath(file_name)); // Rename shell-integrated extensions. if (win_util::IsShellIntegratedExtension(extension)) extension.assign(default_extension); std::string mime_type_from_extension; - net::GetMimeTypeFromFile(file_name.ToWStringHack(), - &mime_type_from_extension); + net::GetMimeTypeFromFile(file_name, &mime_type_from_extension); if (mime_type == mime_type_from_extension) { // The hinted extension matches the mime type. It looks like a winner. generated_extension->swap(extension); @@ -1104,13 +1099,12 @@ void DownloadManager::GenerateExtension(const FilePath& file_name, // 1. New extension is not ".txt" // 2. New extension is not the same as the already existing extension. // 3. New extension is not executable. This action mitigates the case when - // an executable is hidden in a benign file extension; + // an execuatable is hidden in a benign file extension; // E.g. my-cat.jpg becomes my-cat.jpg.js if content type is // application/x-javascript. - FilePath::StringType append_extension; + std::wstring append_extension; if (net::GetPreferredExtensionForMimeType(mime_type, &append_extension)) { - if (append_extension != FILE_PATH_LITERAL(".txt") && - append_extension != extension && + if (append_extension != L".txt" && append_extension != extension && !IsExecutable(append_extension)) extension += append_extension; } @@ -1120,23 +1114,23 @@ void DownloadManager::GenerateExtension(const FilePath& file_name, } void DownloadManager::GenerateFilename(DownloadCreateInfo* info, - FilePath* generated_name) { - FilePath file_name = FilePath::FromWStringHack( + std::wstring* generated_name) { + std::wstring file_name = net::GetSuggestedFilename(GURL(info->url), info->content_disposition, - L"download")); + L"download"); DCHECK(!file_name.empty()); // Make sure we get the right file extension. - FilePath::StringType extension; + std::wstring extension; GenerateExtension(file_name, info->mime_type, &extension); file_util::ReplaceExtension(&file_name, extension); // Prepend "_" to the file name if it's a reserved name - if (win_util::IsReservedName(file_name.ToWStringHack())) - file_name = FilePath(L"_").Append(file_name); + if (win_util::IsReservedName(file_name)) + file_name = std::wstring(L"_") + file_name; - *generated_name = FilePath(file_name); + generated_name->assign(file_name); } void DownloadManager::AddObserver(Observer* observer) { @@ -1155,7 +1149,7 @@ void DownloadManager::ShowDownloadInShell(const DownloadItem* download) { file_loop_->PostTask(FROM_HERE, NewRunnableMethod(file_manager_, &DownloadFileManager::OnShowDownloadInShell, - FilePath(download->full_path()))); + download->full_path())); } void DownloadManager::OpenDownloadInShell(const DownloadItem* download, @@ -1167,8 +1161,8 @@ void DownloadManager::OpenDownloadInShell(const DownloadItem* download, download->full_path(), download->url(), parent_window)); } -void DownloadManager::OpenFilesOfExtension( - const FilePath::StringType& extension, bool open) { +void DownloadManager::OpenFilesOfExtension(const std::wstring& extension, + bool open) { if (open && !IsExecutable(extension)) auto_open_.insert(extension); else @@ -1176,8 +1170,7 @@ void DownloadManager::OpenFilesOfExtension( SaveAutoOpens(); } -bool DownloadManager::ShouldOpenFileExtension( - const FilePath::StringType& extension) { +bool DownloadManager::ShouldOpenFileExtension(const std::wstring& extension) { if (!IsExecutable(extension) && auto_open_.find(extension) != auto_open_.end()) return true; @@ -1213,7 +1206,7 @@ bool DownloadManager::IsExecutableMimeType(const std::string& mime_type) { return net::MatchesMimeType("application/*", mime_type); } -bool DownloadManager::IsExecutable(const FilePath::StringType& extension) { +bool DownloadManager::IsExecutable(const std::wstring& extension) { return exe_types_.find(extension) != exe_types_.end(); } @@ -1229,10 +1222,10 @@ bool DownloadManager::HasAutoOpenFileTypesRegistered() const { void DownloadManager::SaveAutoOpens() { PrefService* prefs = profile_->GetPrefs(); if (prefs) { - FilePath::StringType extensions; - for (std::set<FilePath::StringType>::iterator it = auto_open_.begin(); + std::wstring extensions; + for (std::set<std::wstring>::iterator it = auto_open_.begin(); it != auto_open_.end(); ++it) { - extensions += *it + FILE_PATH_LITERAL(":"); + extensions += *it + L":"; } if (!extensions.empty()) extensions.erase(extensions.size() - 1); @@ -1240,12 +1233,10 @@ void DownloadManager::SaveAutoOpens() { } } -void DownloadManager::FileSelected(const std::wstring& path_string, - void* params) { - FilePath path = FilePath::FromWStringHack(path_string); +void DownloadManager::FileSelected(const std::wstring& path, void* params) { DownloadCreateInfo* info = reinterpret_cast<DownloadCreateInfo*>(params); if (info->save_as) - last_download_path_ = path.DirName(); + last_download_path_ = file_util::GetDirectoryFromPath(path); ContinueStartDownload(info, path); } @@ -1258,9 +1249,9 @@ void DownloadManager::FileSelectionCanceled(void* params) { info->download_id)); } -void DownloadManager::DeleteDownload(const FilePath& path) { - file_loop_->PostTask(FROM_HERE, NewRunnableFunction( - &DownloadFileManager::DeleteFile, FilePath(path))); +void DownloadManager::DeleteDownload(const std::wstring& path) { + file_loop_->PostTask(FROM_HERE, NewRunnableMethod( + file_manager_, &DownloadFileManager::DeleteFile, path)); } @@ -1371,5 +1362,5 @@ void DownloadManager::OnSearchComplete(HistoryService::Handle handle, // Clears the last download path, used to initialize "save as" dialogs. void DownloadManager::ClearLastDownloadPath() { - last_download_path_ = FilePath(); + last_download_path_.clear(); } diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h index 447b168..e2d3b5b 100644 --- a/chrome/browser/download/download_manager.h +++ b/chrome/browser/download/download_manager.h @@ -43,7 +43,6 @@ #include <vector> #include "base/basictypes.h" -#include "base/file_path.h" #include "base/hash_tables.h" #include "base/observer_list.h" #include "base/ref_counted.h" @@ -103,10 +102,10 @@ class DownloadItem { // Constructing from user action: DownloadItem(int32 download_id, - const FilePath& path, + const std::wstring& path, int path_uniquifier, const std::wstring& url, - const FilePath& original_name, + const std::wstring& original_name, const base::Time start_time, int64 download_size, int render_process_id, @@ -165,17 +164,17 @@ class DownloadItem { // Update the download's path, the actual file is renamed on the download // thread. - void Rename(const FilePath& full_path); + void Rename(const std::wstring& full_path); // Allow the user to temporarily pause a download or resume a paused download. void TogglePause(); // Accessors DownloadState state() const { return state_; } - FilePath file_name() const { return file_name_; } - void set_file_name(const FilePath& name) { file_name_ = name; } - FilePath full_path() const { return full_path_; } - void set_full_path(const FilePath& path) { full_path_ = path; } + std::wstring file_name() const { return file_name_; } + void set_file_name(const std::wstring& name) { file_name_ = name; } + std::wstring full_path() const { return full_path_; } + void set_full_path(const std::wstring& path) { full_path_ = path; } int path_uniquifier() const { return path_uniquifier_; } void set_path_uniquifier(int uniquifier) { path_uniquifier_ = uniquifier; } std::wstring url() const { return url_; } @@ -198,13 +197,13 @@ class DownloadItem { void set_safety_state(SafetyState safety_state) { safety_state_ = safety_state; } - FilePath original_name() const { return original_name_; } - void set_original_name(const FilePath& name) { original_name_ = name; } + std::wstring original_name() const { return original_name_; } + void set_original_name(const std::wstring& name) { original_name_ = name; } // Returns the file-name that should be reported to the user, which is // file_name_ for safe downloads and original_name_ for dangerous ones with // the uniquifier number. - FilePath GetFileName() const; + std::wstring GetFileName() const; private: // Internal helper for maintaining consistent received and total sizes. @@ -214,14 +213,14 @@ class DownloadItem { int32 id_; // Full path to the downloaded file - FilePath full_path_; + std::wstring full_path_; // A number that should be appended to the path to make it unique, or 0 if the // path should be used as is. int path_uniquifier_; // Short display version of the file - FilePath file_name_; + std::wstring file_name_; // The URL from whence we came, for display std::wstring url_; @@ -265,7 +264,7 @@ class DownloadItem { // Dangerous download are given temporary names until the user approves them. // This stores their original name. - FilePath original_name_; + std::wstring original_name_; // For canceling or pausing requests. int render_process_id_; @@ -372,9 +371,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, return static_cast<int>(in_progress_.size()); } - FilePath download_path() { - return FilePath::FromWStringHack(*download_path_); - } + std::wstring download_path() { return *download_path_; } // Clears the last download path, used to initialize "save as" dialogs. void ClearLastDownloadPath(); @@ -382,16 +379,16 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, // Registers this file extension for automatic opening upon download // completion if 'open' is true, or prevents the extension from automatic // opening if 'open' is false. - void OpenFilesOfExtension(const FilePath::StringType& extension, bool open); + void OpenFilesOfExtension(const std::wstring& extension, bool open); // Tests if a file type should be opened automatically. - bool ShouldOpenFileExtension(const FilePath::StringType& extension); + bool ShouldOpenFileExtension(const std::wstring& extension); // Tests if we think the server means for this mime_type to be executable. static bool IsExecutableMimeType(const std::string& mime_type); // Tests if a file type is considered executable. - bool IsExecutable(const FilePath::StringType& extension); + bool IsExecutable(const std::wstring& extension); // Resets the automatic open preference. void ResetAutoOpenFiles(); @@ -401,12 +398,11 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, bool HasAutoOpenFileTypesRegistered() const; // Overridden from SelectFileDialog::Listener: - // TODO(port): convert this to FilePath when SelectFileDialog gets converted. virtual void FileSelected(const std::wstring& path, void* params); virtual void FileSelectionCanceled(void* params); // Deletes the specified path on the file thread. - void DeleteDownload(const FilePath& path); + void DeleteDownload(const std::wstring& path); // Called when the user has validated the donwload of a dangerous file. void DangerousDownloadValidated(DownloadItem* download); @@ -428,7 +424,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, // determined, either automatically based on the suggested file name, or by // the user in a Save As dialog box. void ContinueStartDownload(DownloadCreateInfo* info, - const FilePath& target_path); + const std::wstring& target_path); // Update the history service for a particular download. void UpdateHistoryForDownload(DownloadItem* download); @@ -441,12 +437,12 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, void NotifyAboutDownloadStop(); // Create an extension based on the file name and mime type. - void GenerateExtension(const FilePath& file_name, + void GenerateExtension(const std::wstring& file_name, const std::string& mime_type, - FilePath::StringType* generated_extension); + std::wstring* generated_extension); // Create a file name based on the response from the server. - void GenerateFilename(DownloadCreateInfo* info, FilePath* generated_name); + void GenerateFilename(DownloadCreateInfo* info, std::wstring* generated_name); // Persist the automatic opening preference. void SaveAutoOpens(); @@ -473,21 +469,21 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, // real file name. // Invoked on the file thread. void ProceedWithFinishedDangerousDownload(int64 download_handle, - const FilePath& path, - const FilePath& original_name); + const std::wstring& path, + const std::wstring& original_name); // Invoked on the UI thread when a dangerous downloaded file has been renamed. void DangerousDownloadRenamed(int64 download_handle, bool success, - const FilePath& new_path, + const std::wstring& new_path, int new_path_uniquifier); // Checks whether a file represents a risk if downloaded. - bool IsDangerous(const FilePath& file_name); + bool IsDangerous(const std::wstring& file_name); // Changes the paths and file name of the specified |download|, propagating // the change to the history system. - void RenameDownload(DownloadItem* download, const FilePath& new_path); + void RenameDownload(DownloadItem* download, const std::wstring& new_path); // 'downloads_' is map of all downloads in this profile. The key is the handle // returned by the history system, which is unique across sessions. This map @@ -547,13 +543,13 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, // The user's last choice for download directory. This is only used when the // user wants us to prompt for a save location for each download. - FilePath last_download_path_; + std::wstring last_download_path_; // Set of file extensions to open at download completion. - std::set<FilePath::StringType> auto_open_; + std::set<std::wstring> auto_open_; // Set of file extensions that are executables and shouldn't be auto opened. - std::set<FilePath::StringType> exe_types_; + std::set<std::wstring> exe_types_; // Keep track of downloads that are completed before the user selects the // destination, so that observers are appropriately notified of completion diff --git a/chrome/browser/download/download_manager_unittest.cc b/chrome/browser/download/download_manager_unittest.cc index 67a2f5f..d7648b9 100644 --- a/chrome/browser/download/download_manager_unittest.cc +++ b/chrome/browser/download/download_manager_unittest.cc @@ -19,14 +19,12 @@ class DownloadManagerTest : public testing::Test { void GetGeneratedFilename(const std::string& content_disposition, const std::wstring& url, const std::string& mime_type, - std::wstring* generated_name_string) { + std::wstring* generated_name) { DownloadCreateInfo info; info.content_disposition = content_disposition; info.url = url; info.mime_type = mime_type; - FilePath generated_name; - download_manager_->GenerateFilename(&info, &generated_name); - *generated_name_string = generated_name.ToWStringHack(); + download_manager_->GenerateFilename(&info, generated_name); } protected: diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index e264987..5af7c47 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -47,7 +47,7 @@ bool BaseContextMenu::IsItemChecked(int id) const { case OPEN_WHEN_COMPLETE: return download_->open_when_complete(); case ALWAYS_OPEN_TYPE: { - const FilePath::StringType extension = + const std::wstring extension = file_util::GetFileExtensionFromPath(download_->full_path()); return download_->manager()->ShouldOpenFileExtension(extension); } @@ -115,17 +115,17 @@ void BaseContextMenu::ExecuteCommand(int id) { scw.WriteText(download_->url()); break; case COPY_PATH: - scw.WriteText(download_->full_path().ToWStringHack()); + scw.WriteText(download_->full_path()); break; case COPY_FILE: // TODO(paulg): Move to OSExchangeData when implementing drag and drop? - scw.WriteFile(download_->full_path().ToWStringHack()); + scw.WriteFile(download_->full_path()); break; case OPEN_WHEN_COMPLETE: OpenDownload(download_); break; case ALWAYS_OPEN_TYPE: { - const FilePath::StringType extension = + const std::wstring extension = file_util::GetFileExtensionFromPath(download_->full_path()); download_->manager()->OpenFilesOfExtension( extension, !IsItemChecked(ALWAYS_OPEN_TYPE)); @@ -221,11 +221,11 @@ DownloadDestinationContextMenu::~DownloadDestinationContextMenu() { // Download opening ------------------------------------------------------------ bool CanOpenDownload(DownloadItem* download) { - FilePath file_to_use = download->full_path(); - if (!download->original_name().value().empty()) + std::wstring file_to_use = download->full_path(); + if (!download->original_name().empty()) file_to_use = download->original_name(); - const FilePath::StringType extension = + const std::wstring extension = file_util::GetFileExtensionFromPath(file_to_use); return !download->manager()->IsExecutable(extension); } @@ -416,9 +416,8 @@ void DragDownload(const DownloadItem* download, SkBitmap* icon) { // Set up our OLE machinery scoped_refptr<OSExchangeData> data(new OSExchangeData); if (icon) - drag_utils::CreateDragImageForFile(download->file_name().ToWStringHack(), - icon, data); - data->SetFilename(download->full_path().ToWStringHack()); + drag_utils::CreateDragImageForFile(download->file_name(), icon, data); + data->SetFilename(download->full_path()); scoped_refptr<BaseDragSource> drag_source(new BaseDragSource); // Run the drag and drop loop @@ -427,4 +426,6 @@ void DragDownload(const DownloadItem* download, SkBitmap* icon) { &effects); } + } // namespace download_util + diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index 0bbc670..d01d2d7 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -177,9 +177,8 @@ bool SavePackage::Init() { } // Create the fake DownloadItem and display the view. - download_ = new DownloadItem(1, - FilePath::FromWStringHack(saved_main_file_path_), 0, page_url_, - FilePath(), Time::Now(), 0, -1, -1, false); + download_ = new DownloadItem(1, saved_main_file_path_, 0, page_url_, + std::wstring(), Time::Now(), 0, -1, -1, false); download_->set_manager(web_contents_->profile()->GetDownloadManager()); DownloadShelfView* shelf = web_contents_->GetDownloadShelfView(); shelf->AddDownloadView(new DownloadItemView( diff --git a/chrome/browser/history/download_database.cc b/chrome/browser/history/download_database.cc index d6f77b6..f1dcbce 100644 --- a/chrome/browser/history/download_database.cc +++ b/chrome/browser/history/download_database.cc @@ -69,8 +69,7 @@ void DownloadDatabase::QueryDownloads(std::vector<DownloadCreateInfo>* results) while (statement->step() == SQLITE_ROW) { DownloadCreateInfo info; info.db_handle = statement->column_int64(0); - std::wstring path_str = info.path.ToWStringHack(); - statement->column_string16(1, &path_str); + statement->column_string16(1, &info.path); statement->column_string16(2, &info.url); info.start_time = Time::FromTimeT(statement->column_int64(3)); info.received_bytes = statement->column_int64(4); @@ -118,7 +117,7 @@ int64 DownloadDatabase::CreateDownload(const DownloadCreateInfo& info) { if (!statement.is_valid()) return 0; - statement->bind_wstring(0, info.path.ToWStringHack()); + statement->bind_wstring(0, info.path); statement->bind_wstring(1, info.url); statement->bind_int64(2, info.start_time.ToTimeT()); statement->bind_int64(3, info.received_bytes); diff --git a/chrome/browser/history/download_types.h b/chrome/browser/history/download_types.h index e520ff6..61a6d83 100644 --- a/chrome/browser/history/download_types.h +++ b/chrome/browser/history/download_types.h @@ -11,7 +11,6 @@ #include <vector> #include "base/basictypes.h" -#include "base/file_path.h" #include "base/time.h" // Used for informing the download database of a new download, where we don't @@ -19,7 +18,7 @@ // vector of these structs for passing us the state of all downloads at // initialization time (see DownloadQueryInfo below). struct DownloadCreateInfo { - DownloadCreateInfo(const FilePath& path, + DownloadCreateInfo(const std::wstring& path, const std::wstring& url, base::Time start_time, int64 received_bytes, @@ -45,9 +44,9 @@ struct DownloadCreateInfo { DownloadCreateInfo() : download_id(-1) {} // DownloadItem fields - FilePath path; + std::wstring path; std::wstring url; - FilePath suggested_path; + std::wstring suggested_path; // A number that should be added to the suggested path to make it unique. // 0 means no number should be appended. Not actually stored in the db. int path_uniquifier; @@ -66,7 +65,7 @@ struct DownloadCreateInfo { // Whether this download is potentially dangerous (ex: exe, dll, ...). bool is_dangerous; // The original name for a dangerous download. - FilePath original_name; + std::wstring original_name; }; #endif // CHROME_BROWSER_DOWNLOAD_TYPES_H__ diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index 2f10adb..11b58b0 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -193,8 +193,8 @@ class HistoryTest : public testing::Test { } int64 AddDownload(int32 state, const Time& time) { - DownloadCreateInfo download(FilePath(FILE_PATH_LITERAL("foo-path")), - L"foo-url", time, 0, 512, state, 0); + DownloadCreateInfo download(L"foo-path", L"foo-url", time, + 0, 512, state, 0); return db_->CreateDownload(download); } diff --git a/chrome/browser/safe_browsing/database_perftest.cc b/chrome/browser/safe_browsing/database_perftest.cc index 0da2ffc..5c29512 100644 --- a/chrome/browser/safe_browsing/database_perftest.cc +++ b/chrome/browser/safe_browsing/database_perftest.cc @@ -467,7 +467,7 @@ class SafeBrowsingDatabaseTest { int64 total_ms = total_timer.Elapsed().InMilliseconds(); - DLOG(INFO) << path_.BaseName().value() << " read " << keys_to_read << + DLOG(INFO) << path_.BaseName() << " read " << keys_to_read << " entries in " << total_ms << " ms. " << keys_from_db << " keys were read from the db, with average read taking " << db_ms / keys_from_db << " ms"; @@ -486,7 +486,7 @@ class SafeBrowsingDatabaseTest { int64 total_ms = total_timer.Elapsed().InMilliseconds(); - DLOG(INFO) << path_.BaseName().value() << + DLOG(INFO) << path_.BaseName() << " built bloom filter in " << total_ms << " ms."; } diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index 6579e55..f3e4a2a 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -201,7 +201,7 @@ DownloadItemView::DownloadItemView(DownloadItem* download, discard_button_->set_enforce_dlu_min_size(false); AddChildView(save_button_); AddChildView(discard_button_); - std::wstring file_name = download->original_name().ToWStringHack(); + std::wstring file_name = download->original_name(); // Ensure the file name is not too long. @@ -457,7 +457,7 @@ void DownloadItemView::Paint(ChromeCanvas* canvas) { // Note that in dangerous mode we use a label (as the text is multi-line). if (!IsDangerousMode()) { std::wstring filename = - gfx::ElideFilename(download_->GetFileName().ToWStringHack(), + gfx::ElideFilename(download_->GetFileName(), font_, kTextWidth); @@ -487,7 +487,7 @@ void DownloadItemView::Paint(ChromeCanvas* canvas) { // Paint the icon. IconManager* im = g_browser_process->icon_manager(); SkBitmap* icon = IsDangerousMode() ? warning_icon_ : - im->LookupIcon(download_->full_path().ToWStringHack(), IconLoader::SMALL); + im->LookupIcon(download_->full_path(), IconLoader::SMALL); // We count on the fact that the icon manager will cache the icons and if one // is available, it will be cached here. We *don't* want to request the icon @@ -716,7 +716,7 @@ bool DownloadItemView::OnMouseDragged(const views::MouseEvent& event) { if (dragging_) { if (download_->state() == DownloadItem::COMPLETE) { IconManager* im = g_browser_process->icon_manager(); - SkBitmap* icon = im->LookupIcon(download_->full_path().ToWStringHack(), + SkBitmap* icon = im->LookupIcon(download_->full_path(), IconLoader::SMALL); if (icon) download_util::DragDownload(download_, icon); @@ -750,7 +750,7 @@ void DownloadItemView::OnExtractIconComplete(IconManager::Handle handle, void DownloadItemView::LoadIcon() { IconManager* im = g_browser_process->icon_manager(); - im->LoadIcon(download_->full_path().ToWStringHack(), IconLoader::SMALL, + im->LoadIcon(download_->full_path(), IconLoader::SMALL, &icon_consumer_, NewCallback(this, &DownloadItemView::OnExtractIconComplete)); } diff --git a/chrome/browser/views/download_tab_view.cc b/chrome/browser/views/download_tab_view.cc index 474f0a7..b0d7c77 100644 --- a/chrome/browser/views/download_tab_view.cc +++ b/chrome/browser/views/download_tab_view.cc @@ -285,8 +285,7 @@ void DownloadItemTabView::LayoutComplete() { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); ChromeFont font = rb.GetFont(ResourceBundle::WebFont); file_name_->SetText( - gfx::ElideFilename(model_->GetFileName().ToWStringHack(), font, - kFilenameSize)); + gfx::ElideFilename(model_->GetFileName(), font, kFilenameSize)); gfx::Size file_name_size = file_name_->GetPreferredSize(); @@ -340,7 +339,7 @@ void DownloadItemTabView::LayoutCancelled() { // File name and URL, truncated to show cancelled status ResourceBundle& rb = ResourceBundle::GetSharedInstance(); ChromeFont font = rb.GetFont(ResourceBundle::WebFont); - file_name_->SetText(gfx::ElideFilename(model_->GetFileName().ToWStringHack(), + file_name_->SetText(gfx::ElideFilename(model_->GetFileName(), font, kFilenameSize)); gfx::Size file_name_size = file_name_->GetPreferredSize(); @@ -431,7 +430,7 @@ void DownloadItemTabView::LayoutInProgress() { // File name and URL, truncated to show progress status ResourceBundle& rb = ResourceBundle::GetSharedInstance(); ChromeFont font = rb.GetFont(ResourceBundle::WebFont); - file_name_->SetText(gfx::ElideFilename(model_->GetFileName().ToWStringHack(), + file_name_->SetText(gfx::ElideFilename(model_->GetFileName(), font, kFilenameSize)); gfx::Size file_name_size = file_name_->GetPreferredSize(); @@ -591,7 +590,7 @@ void DownloadItemTabView::LayoutPromptDangerousDownload() { // Warning message and URL. std::wstring file_name; - ElideString(model_->original_name().ToWStringHack(), kFileNameMaxLength, &file_name); + ElideString(model_->original_name(), kFileNameMaxLength, &file_name); dangerous_download_warning_->SetText( l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD, file_name)); gfx::Size warning_size = dangerous_download_warning_->GetPreferredSize(); @@ -1075,8 +1074,7 @@ void DownloadTabView::SetDownloads(std::vector<DownloadItem*>& downloads) { SkBitmap* DownloadTabView::LookupIcon(DownloadItem* download) { IconManager* im = g_browser_process->icon_manager(); // Fast look up. - SkBitmap* icon = im->LookupIcon(download->full_path().ToWStringHack(), - IconLoader::NORMAL); + SkBitmap* icon = im->LookupIcon(download->full_path(), IconLoader::NORMAL); // Expensive look up. if (!icon) @@ -1091,7 +1089,7 @@ SkBitmap* DownloadTabView::LookupIcon(DownloadItem* download) { void DownloadTabView::LoadIcon(DownloadItem* download) { IconManager* im = g_browser_process->icon_manager(); IconManager::Handle h = - im->LoadIcon(download->full_path().ToWStringHack(), IconLoader::NORMAL, + im->LoadIcon(download->full_path(), IconLoader::NORMAL, &icon_consumer_, NewCallback(this, &DownloadTabView::OnExtractIconComplete)); icon_consumer_.SetClientData(im, h, download); |