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/chromeos/extensions/file_browser_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 const std::string& mount_type_str, | 1145 const std::string& mount_type_str, |
1146 const SelectedFileInfoList& files) { | 1146 const SelectedFileInfoList& files) { |
1147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1148 | 1148 |
1149 if (!files.size()) { | 1149 if (!files.size()) { |
1150 SendResponse(false); | 1150 SendResponse(false); |
1151 return; | 1151 return; |
1152 } | 1152 } |
1153 | 1153 |
1154 const FilePath& source_path = files[0].local_path; | 1154 const FilePath& source_path = files[0].local_path; |
1155 const FilePath::StringType& display_name = | 1155 const FilePath::StringType& display_name = files[0].display_name; |
1156 files[0].file_path.BaseName().value(); | |
1157 // Check if the source path is under GData cache directory. | 1156 // Check if the source path is under GData cache directory. |
1158 gdata::GDataSystemService* system_service = | 1157 gdata::GDataSystemService* system_service = |
1159 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 1158 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
1160 gdata::GDataCache* cache = system_service ? system_service->cache() : NULL; | 1159 gdata::GDataCache* cache = system_service ? system_service->cache() : NULL; |
1161 if (cache && cache->IsUnderGDataCacheDirectory(source_path)) { | 1160 if (cache && cache->IsUnderGDataCacheDirectory(source_path)) { |
1162 cache->SetMountedStateOnUIThread( | 1161 cache->SetMountedStateOnUIThread( |
1163 source_path, | 1162 source_path, |
1164 true, | 1163 true, |
1165 base::Bind(&AddMountFunction::OnMountedStateSet, this, mount_type_str, | 1164 base::Bind(&AddMountFunction::OnMountedStateSet, this, mount_type_str, |
1166 display_name)); | 1165 display_name)); |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 gdata::GDataSystemService* system_service = | 2413 gdata::GDataSystemService* system_service = |
2415 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 2414 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
2416 if (!system_service || !system_service->file_system()) | 2415 if (!system_service || !system_service->file_system()) |
2417 return false; | 2416 return false; |
2418 | 2417 |
2419 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); | 2418 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); |
2420 system_service->file_system()->RequestDirectoryRefresh(directory_path); | 2419 system_service->file_system()->RequestDirectoryRefresh(directory_path); |
2421 | 2420 |
2422 return true; | 2421 return true; |
2423 } | 2422 } |
OLD | NEW |