OLD | NEW |
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 "chrome/browser/chromeos/gdata/gdata_download_observer.h" | 12 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
12 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" | 13 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
13 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 14 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
14 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/download_item.h" | 18 #include "content/public/browser/download_item.h" |
18 #include "content/public/browser/download_manager.h" | 19 #include "content/public/browser/download_manager.h" |
(...skipping 19 matching lines...) Expand all Loading... |
38 int32 download_id) | 39 int32 download_id) |
39 : DownloadFilePicker(download_manager, | 40 : DownloadFilePicker(download_manager, |
40 web_contents, | 41 web_contents, |
41 suggested_path, | 42 suggested_path, |
42 download_id) { | 43 download_id) { |
43 } | 44 } |
44 | 45 |
45 DownloadFilePickerChromeOS::~DownloadFilePickerChromeOS() { | 46 DownloadFilePickerChromeOS::~DownloadFilePickerChromeOS() { |
46 } | 47 } |
47 | 48 |
48 void DownloadFilePickerChromeOS::FileSelected(const FilePath& path, | 49 void DownloadFilePickerChromeOS::FileSelected(const FilePath& selected_path, |
49 int index, | 50 int index, |
50 void* params) { | 51 void* params) { |
| 52 FilePath path = selected_path; |
| 53 file_util::NormalizeFileNameEncoding(&path); |
| 54 |
51 RecordFileSelected(path); | 55 RecordFileSelected(path); |
52 | 56 |
53 if (download_manager_) { | 57 if (download_manager_) { |
54 gdata::GDataSystemService* system_service = | 58 gdata::GDataSystemService* system_service = |
55 gdata::GDataSystemServiceFactory::GetForProfile( | 59 gdata::GDataSystemServiceFactory::GetForProfile( |
56 ProfileManager::GetDefaultProfile()); | 60 ProfileManager::GetDefaultProfile()); |
57 if (system_service && gdata::util::IsUnderGDataMountPoint(path)) { | 61 if (system_service && gdata::util::IsUnderGDataMountPoint(path)) { |
58 // If we're trying to download a file into gdata, save path in external | 62 // If we're trying to download a file into gdata, save path in external |
59 // data. | 63 // data. |
60 content::DownloadItem* download = | 64 content::DownloadItem* download = |
(...skipping 17 matching lines...) Expand all Loading... |
78 download_manager_, | 82 download_manager_, |
79 base::Owned(gdata_tmp_download_path), | 83 base::Owned(gdata_tmp_download_path), |
80 download_id_)); | 84 download_id_)); |
81 } | 85 } |
82 } else { | 86 } else { |
83 download_manager_->FileSelected(path, download_id_); | 87 download_manager_->FileSelected(path, download_id_); |
84 } | 88 } |
85 } | 89 } |
86 delete this; | 90 delete this; |
87 } | 91 } |
OLD | NEW |