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

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

Issue 9854011: Normalize download file name on chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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/download_file_picker_chromeos.h" 5 #include "chrome/browser/download/download_file_picker_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/i18n/file_util_icu.h"
9 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
10 #include "base/threading/sequenced_worker_pool.h" 11 #include "base/threading/sequenced_worker_pool.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/download_item.h"
13 #include "content/public/browser/download_manager.h"
14 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" 12 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
15 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" 13 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
16 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 14 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
17 #include "chrome/browser/chromeos/gdata/gdata_util.h" 15 #include "chrome/browser/chromeos/gdata/gdata_util.h"
16 #include "chrome/browser/download/download_util.h"
18 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/download_item.h"
20 #include "content/public/browser/download_manager.h"
asanka 2012/03/27 01:30:35 Warning: These changes might conflict with http://
19 21
20 using content::BrowserThread; 22 using content::BrowserThread;
21 using content::DownloadManager; 23 using content::DownloadManager;
22 24
23 namespace { 25 namespace {
24 26
25 // Callbacks for PostTaskAndReply. 27 // Callbacks for PostTaskAndReply.
26 28
27 // |temp_path| is set to a temporary local download path in 29 // |temp_path| is set to a temporary local download path in
28 // ~/GCache/v1/tmp/downloads/ 30 // ~/GCache/v1/tmp/downloads/
(...skipping 27 matching lines...) Expand all
56 int32 download_id) 58 int32 download_id)
57 : DownloadFilePicker(download_manager, 59 : DownloadFilePicker(download_manager,
58 web_contents, 60 web_contents,
59 suggested_path, 61 suggested_path,
60 download_id) { 62 download_id) {
61 } 63 }
62 64
63 DownloadFilePickerChromeOS::~DownloadFilePickerChromeOS() { 65 DownloadFilePickerChromeOS::~DownloadFilePickerChromeOS() {
64 } 66 }
65 67
66 void DownloadFilePickerChromeOS::FileSelected(const FilePath& path, 68 void DownloadFilePickerChromeOS::FileSelected(const FilePath& selected_path,
67 int index, 69 int index,
68 void* params) { 70 void* params) {
71 FilePath path = selected_path;
72 file_util::NormalizeFileNameEncoding(&path);
73
69 RecordFileSelected(path); 74 RecordFileSelected(path);
70 75
71 if (download_manager_) { 76 if (download_manager_) {
72 gdata::GDataSystemService* system_service = 77 gdata::GDataSystemService* system_service =
73 gdata::GDataSystemServiceFactory::GetForProfile( 78 gdata::GDataSystemServiceFactory::GetForProfile(
74 ProfileManager::GetDefaultProfile()); 79 ProfileManager::GetDefaultProfile());
75 if (system_service && gdata::util::IsUnderGDataMountPoint(path)) { 80 if (system_service && gdata::util::IsUnderGDataMountPoint(path)) {
76 // If we're trying to download a file into gdata, save path in external 81 // If we're trying to download a file into gdata, save path in external
77 // data. 82 // data.
78 content::DownloadItem* download = 83 content::DownloadItem* download =
(...skipping 17 matching lines...) Expand all
96 download_manager_, 101 download_manager_,
97 base::Owned(download_path), 102 base::Owned(download_path),
98 download_id_)); 103 download_id_));
99 } 104 }
100 } else { 105 } else {
101 download_manager_->FileSelected(path, download_id_); 106 download_manager_->FileSelected(path, download_id_);
102 } 107 }
103 } 108 }
104 delete this; 109 delete this;
105 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698