OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/extension_file_browser_private_api.h" | 5 #include "chrome/browser/extensions/extension_file_browser_private_api.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 const chromeos::disks::DiskMountManager::MountPointInfo& mount_point_info) { | 268 const chromeos::disks::DiskMountManager::MountPointInfo& mount_point_info) { |
269 | 269 |
270 base::DictionaryValue *mount_info = new base::DictionaryValue(); | 270 base::DictionaryValue *mount_info = new base::DictionaryValue(); |
271 | 271 |
272 mount_info->SetString("mountType", | 272 mount_info->SetString("mountType", |
273 chromeos::disks::DiskMountManager::MountTypeToString( | 273 chromeos::disks::DiskMountManager::MountTypeToString( |
274 mount_point_info.mount_type)); | 274 mount_point_info.mount_type)); |
275 | 275 |
276 if (mount_point_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE) { | 276 if (mount_point_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE) { |
277 GURL source_url; | 277 GURL source_url; |
278 if (FileManagerUtil::ConvertFileToFileSystemUrl(profile, | 278 if (file_manager_util::ConvertFileToFileSystemUrl(profile, |
279 FilePath(mount_point_info.source_path), | 279 FilePath(mount_point_info.source_path), |
280 FileManagerUtil::GetFileBrowserExtensionUrl().GetOrigin(), | 280 file_manager_util::GetFileBrowserExtensionUrl().GetOrigin(), |
281 &source_url)) { | 281 &source_url)) { |
282 mount_info->SetString("sourceUrl", source_url.spec()); | 282 mount_info->SetString("sourceUrl", source_url.spec()); |
283 } | 283 } |
284 } else { | 284 } else { |
285 mount_info->SetString("sourceUrl", mount_point_info.source_path); | 285 mount_info->SetString("sourceUrl", mount_point_info.source_path); |
286 } | 286 } |
287 | 287 |
288 FilePath relative_mount_path; | 288 FilePath relative_mount_path; |
289 // Convert mount point path to relative path with the external file system | 289 // Convert mount point path to relative path with the external file system |
290 // exposed within File API. | 290 // exposed within File API. |
291 if (FileManagerUtil::ConvertFileToRelativeFileSystemPath(profile, | 291 if (file_manager_util::ConvertFileToRelativeFileSystemPath(profile, |
292 FilePath(mount_point_info.mount_path), | 292 FilePath(mount_point_info.mount_path), |
293 &relative_mount_path)) { | 293 &relative_mount_path)) { |
294 mount_info->SetString("mountPath", relative_mount_path.value()); | 294 mount_info->SetString("mountPath", relative_mount_path.value()); |
295 } | 295 } |
296 | 296 |
297 mount_info->SetString("mountCondition", | 297 mount_info->SetString("mountCondition", |
298 chromeos::disks::DiskMountManager::MountConditionToString( | 298 chromeos::disks::DiskMountManager::MountConditionToString( |
299 mount_point_info.mount_condition)); | 299 mount_point_info.mount_condition)); |
300 | 300 |
301 return mount_info; | 301 return mount_info; |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 return true; | 1117 return true; |
1118 } | 1118 } |
1119 | 1119 |
1120 void ViewFilesFunction::GetLocalPathsResponseOnUIThread( | 1120 void ViewFilesFunction::GetLocalPathsResponseOnUIThread( |
1121 const std::string& internal_task_id, | 1121 const std::string& internal_task_id, |
1122 const FilePathList& files) { | 1122 const FilePathList& files) { |
1123 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1123 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1124 for (FilePathList::const_iterator iter = files.begin(); | 1124 for (FilePathList::const_iterator iter = files.begin(); |
1125 iter != files.end(); | 1125 iter != files.end(); |
1126 ++iter) { | 1126 ++iter) { |
1127 FileManagerUtil::ViewItem(*iter, | 1127 file_manager_util::ViewItem(*iter, |
1128 internal_task_id == kEnqueueTaskId || | 1128 internal_task_id == kEnqueueTaskId || |
1129 // Start the first one, enqueue others. | 1129 // Start the first one, enqueue others. |
1130 iter != files.begin()); | 1130 iter != files.begin()); |
1131 } | 1131 } |
1132 SendResponse(true); | 1132 SendResponse(true); |
1133 } | 1133 } |
1134 | 1134 |
1135 SelectFilesFunction::SelectFilesFunction() { | 1135 SelectFilesFunction::SelectFilesFunction() { |
1136 } | 1136 } |
1137 | 1137 |
1138 SelectFilesFunction::~SelectFilesFunction() { | 1138 SelectFilesFunction::~SelectFilesFunction() { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 | 1458 |
1459 if (volume_it != disk_mount_manager->disks().end() && | 1459 if (volume_it != disk_mount_manager->disks().end() && |
1460 !volume_it->second->is_hidden()) { | 1460 !volume_it->second->is_hidden()) { |
1461 chromeos::disks::DiskMountManager::Disk* volume = volume_it->second; | 1461 chromeos::disks::DiskMountManager::Disk* volume = volume_it->second; |
1462 DictionaryValue* volume_info = new DictionaryValue(); | 1462 DictionaryValue* volume_info = new DictionaryValue(); |
1463 result_.reset(volume_info); | 1463 result_.reset(volume_info); |
1464 // Localising mount path. | 1464 // Localising mount path. |
1465 std::string mount_path; | 1465 std::string mount_path; |
1466 if (!volume->mount_path().empty()) { | 1466 if (!volume->mount_path().empty()) { |
1467 FilePath relative_mount_path; | 1467 FilePath relative_mount_path; |
1468 FileManagerUtil::ConvertFileToRelativeFileSystemPath(profile_, | 1468 file_manager_util::ConvertFileToRelativeFileSystemPath(profile_, |
1469 FilePath(volume->mount_path()), &relative_mount_path); | 1469 FilePath(volume->mount_path()), &relative_mount_path); |
1470 mount_path = relative_mount_path.value(); | 1470 mount_path = relative_mount_path.value(); |
1471 } | 1471 } |
1472 volume_info->SetString("devicePath", volume->device_path()); | 1472 volume_info->SetString("devicePath", volume->device_path()); |
1473 volume_info->SetString("mountPath", mount_path); | 1473 volume_info->SetString("mountPath", mount_path); |
1474 volume_info->SetString("systemPath", volume->system_path()); | 1474 volume_info->SetString("systemPath", volume->system_path()); |
1475 volume_info->SetString("filePath", volume->file_path()); | 1475 volume_info->SetString("filePath", volume->file_path()); |
1476 volume_info->SetString("deviceLabel", volume->device_label()); | 1476 volume_info->SetString("deviceLabel", volume->device_label()); |
1477 volume_info->SetString("driveLabel", volume->drive_label()); | 1477 volume_info->SetString("driveLabel", volume->drive_label()); |
1478 volume_info->SetString("deviceType", | 1478 volume_info->SetString("deviceType", |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON)); | 1675 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON)); |
1676 dict->SetString("PLAY_MEDIA", | 1676 dict->SetString("PLAY_MEDIA", |
1677 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); | 1677 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); |
1678 #if defined(OS_CHROMEOS) | 1678 #if defined(OS_CHROMEOS) |
1679 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePhotoEditor)) | 1679 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePhotoEditor)) |
1680 dict->SetString("ENABLE_PHOTO_EDITOR", "true"); | 1680 dict->SetString("ENABLE_PHOTO_EDITOR", "true"); |
1681 #endif | 1681 #endif |
1682 | 1682 |
1683 return true; | 1683 return true; |
1684 } | 1684 } |
OLD | NEW |