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/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/i18n/file_util_icu.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 delete this; | 46 delete this; |
47 return; | 47 return; |
48 } | 48 } |
49 | 49 |
50 FilePath path = selected_path; | 50 FilePath path = selected_path; |
51 file_util::NormalizeFileNameEncoding(&path); | 51 file_util::NormalizeFileNameEncoding(&path); |
52 | 52 |
53 gdata::GDataFileSystem* gdata_filesystem = GetGDataFileSystem(); | 53 gdata::GDataFileSystem* gdata_filesystem = GetGDataFileSystem(); |
54 if (gdata_filesystem && gdata::util::IsUnderGDataMountPoint(path)) { | 54 if (gdata_filesystem && gdata::util::IsUnderGDataMountPoint(path)) { |
55 FilePath gdata_tmp_download_dir = | 55 FilePath gdata_tmp_download_dir = |
56 gdata_filesystem->GetGDataTempDownloadFolderPath(); | 56 gdata_filesystem->GetCacheDirectoryPath( |
| 57 gdata::GDataRootDirectory::CACHE_TYPE_TMP_DOWNLOADS); |
57 | 58 |
58 selected_path_ = path; | 59 selected_path_ = path; |
59 FilePath* gdata_tmp_download_path = new FilePath(); | 60 FilePath* gdata_tmp_download_path = new FilePath(); |
60 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE, | 61 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE, |
61 base::Bind(&gdata::GDataDownloadObserver::GetGDataTempDownloadPath, | 62 base::Bind(&gdata::GDataDownloadObserver::GetGDataTempDownloadPath, |
62 gdata_tmp_download_dir, | 63 gdata_tmp_download_dir, |
63 gdata_tmp_download_path), | 64 gdata_tmp_download_path), |
64 base::Bind(&SavePackageFilePickerChromeOS::GenerateMHTML, | 65 base::Bind(&SavePackageFilePickerChromeOS::GenerateMHTML, |
65 base::Unretained(this), | 66 base::Unretained(this), |
66 base::Owned(gdata_tmp_download_path))); | 67 base::Owned(gdata_tmp_download_path))); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 SavePackageFilePickerChromeOS::GetGDataFileSystem() { | 120 SavePackageFilePickerChromeOS::GetGDataFileSystem() { |
120 DCHECK(web_contents()); | 121 DCHECK(web_contents()); |
121 Profile* profile = Profile::FromBrowserContext( | 122 Profile* profile = Profile::FromBrowserContext( |
122 web_contents()->GetBrowserContext()); | 123 web_contents()->GetBrowserContext()); |
123 DCHECK(profile); | 124 DCHECK(profile); |
124 gdata::GDataSystemService* system_service = | 125 gdata::GDataSystemService* system_service = |
125 gdata::GDataSystemServiceFactory::GetForProfile(profile); | 126 gdata::GDataSystemServiceFactory::GetForProfile(profile); |
126 // system_service is NULL in incognito. | 127 // system_service is NULL in incognito. |
127 return system_service ? system_service->file_system() : NULL; | 128 return system_service ? system_service->file_system() : NULL; |
128 } | 129 } |
OLD | NEW |