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

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

Issue 9854011: Normalize download file name on chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
« no previous file with comments | « chrome/browser/download/download_file_picker_chromeos.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/save_package_file_picker_chromeos.h" 5 #include "chrome/browser/download/save_package_file_picker_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/i18n/file_util_icu.h"
9 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
10 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" 11 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
11 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" 12 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
12 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 13 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
13 #include "chrome/browser/chromeos/gdata/gdata_util.h" 14 #include "chrome/browser/chromeos/gdata/gdata_util.h"
14 #include "chrome/browser/platform_util.h" 15 #include "chrome/browser/platform_util.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 19
(...skipping 12 matching lines...) Expand all
31 "mhtml", 32 "mhtml",
32 web_contents, 33 web_contents,
33 platform_util::GetTopLevel( 34 platform_util::GetTopLevel(
34 web_contents->GetNativeView()), 35 web_contents->GetNativeView()),
35 NULL); 36 NULL);
36 } 37 }
37 38
38 SavePackageFilePickerChromeOS::~SavePackageFilePickerChromeOS() { 39 SavePackageFilePickerChromeOS::~SavePackageFilePickerChromeOS() {
39 } 40 }
40 41
41 void SavePackageFilePickerChromeOS::FileSelected(const FilePath& path, 42 void SavePackageFilePickerChromeOS::FileSelected(const FilePath& selected_path,
42 int index, 43 int index,
43 void* params) { 44 void* params) {
44 if (!web_contents()) { 45 if (!web_contents()) {
45 delete this; 46 delete this;
46 return; 47 return;
47 } 48 }
48 49
50 FilePath path = selected_path;
51 file_util::NormalizeFileNameEncoding(&path);
52
49 gdata::GDataFileSystem* gdata_filesystem = GetGDataFileSystem(); 53 gdata::GDataFileSystem* gdata_filesystem = GetGDataFileSystem();
50 if (gdata_filesystem && gdata::util::IsUnderGDataMountPoint(path)) { 54 if (gdata_filesystem && gdata::util::IsUnderGDataMountPoint(path)) {
51 FilePath gdata_tmp_download_dir = 55 FilePath gdata_tmp_download_dir =
52 gdata_filesystem->GetGDataTempDownloadFolderPath(); 56 gdata_filesystem->GetGDataTempDownloadFolderPath();
53 57
54 selected_path_ = path; 58 selected_path_ = path;
55 FilePath* gdata_tmp_download_path = new FilePath(); 59 FilePath* gdata_tmp_download_path = new FilePath();
56 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE, 60 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE,
57 base::Bind(&gdata::GDataDownloadObserver::GetGDataTempDownloadPath, 61 base::Bind(&gdata::GDataDownloadObserver::GetGDataTempDownloadPath,
58 gdata_tmp_download_dir, 62 gdata_tmp_download_dir,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 SavePackageFilePickerChromeOS::GetGDataFileSystem() { 119 SavePackageFilePickerChromeOS::GetGDataFileSystem() {
116 DCHECK(web_contents()); 120 DCHECK(web_contents());
117 Profile* profile = Profile::FromBrowserContext( 121 Profile* profile = Profile::FromBrowserContext(
118 web_contents()->GetBrowserContext()); 122 web_contents()->GetBrowserContext());
119 DCHECK(profile); 123 DCHECK(profile);
120 gdata::GDataSystemService* system_service = 124 gdata::GDataSystemService* system_service =
121 gdata::GDataSystemServiceFactory::GetForProfile(profile); 125 gdata::GDataSystemServiceFactory::GetForProfile(profile);
122 // system_service is NULL in incognito. 126 // system_service is NULL in incognito.
123 return system_service ? system_service->file_system() : NULL; 127 return system_service ? system_service->file_system() : NULL;
124 } 128 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_file_picker_chromeos.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698