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

Side by Side Diff: chrome/browser/download/chrome_download_manager_delegate.cc

Issue 9854011: Normalize download file name on chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forgot tu upload patchset with added comment Created 8 years, 9 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) 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 "chrome/browser/download/chrome_download_manager_delegate.h" 5 #include "chrome/browser/download/chrome_download_manager_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 421
422 // Check whether this download is for an extension install or not. 422 // Check whether this download is for an extension install or not.
423 // Allow extensions to be explicitly saved. 423 // Allow extensions to be explicitly saved.
424 DownloadStateInfo state = download->GetStateInfo(); 424 DownloadStateInfo state = download->GetStateInfo();
425 425
426 if (state.force_file_name.empty()) { 426 if (state.force_file_name.empty()) {
427 FilePath generated_name; 427 FilePath generated_name;
428 download_util::GenerateFileNameFromRequest(*download, 428 download_util::GenerateFileNameFromRequest(*download,
429 &generated_name); 429 &generated_name);
430 430
431 #if defined(OS_CHROMEOS)
432 // When doing file manager operations on ChromeOS, the file paths get
433 // normalized in WebKit layer, so let's ensure downloaded files have
434 // normalized names. Otherwise, we won't be able to handle files with NFD
435 // utf8 encoded characters in name.
436 download_util::NormalizeFileNameOnChromeOS(&generated_name);
asanka 2012/03/26 20:01:08 why not do this in download_util::GenerateFileName
tbarzic 2012/03/26 20:59:50 Done.
437 #endif
438
431 // Freeze the user's preference for showing a Save As dialog. We're going 439 // Freeze the user's preference for showing a Save As dialog. We're going
432 // to bounce around a bunch of threads and we don't want to worry about race 440 // to bounce around a bunch of threads and we don't want to worry about race
433 // conditions where the user changes this pref out from under us. 441 // conditions where the user changes this pref out from under us.
434 if (download_prefs_->PromptForDownload()) { 442 if (download_prefs_->PromptForDownload()) {
435 // But ignore the user's preference for the following scenarios: 443 // But ignore the user's preference for the following scenarios:
436 // 1) Extension installation. Note that we only care here about the case 444 // 1) Extension installation. Note that we only care here about the case
437 // where an extension is installed, not when one is downloaded with 445 // where an extension is installed, not when one is downloaded with
438 // "save as...". 446 // "save as...".
439 // 2) Filetypes marked "always open." If the user just wants this file 447 // 2) Filetypes marked "always open." If the user just wants this file
440 // opened, don't bother asking where to keep it. 448 // opened, don't bother asking where to keep it.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 int32 download_id, int64 db_handle) { 642 int32 download_id, int64 db_handle) {
635 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 643 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
636 // call this function with an invalid |db_handle|. For instance, this can 644 // call this function with an invalid |db_handle|. For instance, this can
637 // happen when the history database is offline. We cannot have multiple 645 // happen when the history database is offline. We cannot have multiple
638 // DownloadItems with the same invalid db_handle, so we need to assign a 646 // DownloadItems with the same invalid db_handle, so we need to assign a
639 // unique |db_handle| here. 647 // unique |db_handle| here.
640 if (db_handle == DownloadItem::kUninitializedHandle) 648 if (db_handle == DownloadItem::kUninitializedHandle)
641 db_handle = download_history_->GetNextFakeDbHandle(); 649 db_handle = download_history_->GetNextFakeDbHandle();
642 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 650 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
643 } 651 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_file_picker_chromeos.cc » ('j') | chrome/browser/download/download_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698