| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 FilePath relative_mount_path; | 262 FilePath relative_mount_path; |
| 263 // Convert mount point path to relative path with the external file system | 263 // Convert mount point path to relative path with the external file system |
| 264 // exposed within File API. | 264 // exposed within File API. |
| 265 if (FileManagerUtil::ConvertFileToRelativeFileSystemPath(profile, | 265 if (FileManagerUtil::ConvertFileToRelativeFileSystemPath(profile, |
| 266 FilePath(mount_point_info.mount_path), | 266 FilePath(mount_point_info.mount_path), |
| 267 &relative_mount_path)) { | 267 &relative_mount_path)) { |
| 268 mount_info->SetString("mountPath", relative_mount_path.value()); | 268 mount_info->SetString("mountPath", relative_mount_path.value()); |
| 269 } | 269 } |
| 270 | 270 |
| 271 mount_info->SetString("mountCondition", |
| 272 chromeos::MountLibrary::MountConditionToString( |
| 273 mount_point_info.mount_condition)); |
| 274 |
| 271 return mount_info; | 275 return mount_info; |
| 272 } | 276 } |
| 273 #endif | 277 #endif |
| 274 | 278 |
| 275 | 279 |
| 276 class LocalFileSystemCallbackDispatcher | 280 class LocalFileSystemCallbackDispatcher |
| 277 : public fileapi::FileSystemCallbackDispatcher { | 281 : public fileapi::FileSystemCallbackDispatcher { |
| 278 public: | 282 public: |
| 279 explicit LocalFileSystemCallbackDispatcher( | 283 explicit LocalFileSystemCallbackDispatcher( |
| 280 RequestLocalFileSystemFunction* function, | 284 RequestLocalFileSystemFunction* function, |
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 chromeos::MountLibrary* mount_lib = | 1343 chromeos::MountLibrary* mount_lib = |
| 1340 chromeos::CrosLibrary::Get()->GetMountLibrary(); | 1344 chromeos::CrosLibrary::Get()->GetMountLibrary(); |
| 1341 chromeos::MountLibrary::DiskMap::const_iterator volume_it = | 1345 chromeos::MountLibrary::DiskMap::const_iterator volume_it = |
| 1342 mount_lib->disks().find(volume_device_path); | 1346 mount_lib->disks().find(volume_device_path); |
| 1343 | 1347 |
| 1344 if (volume_it != mount_lib->disks().end()) { | 1348 if (volume_it != mount_lib->disks().end()) { |
| 1345 chromeos::MountLibrary::Disk* volume = volume_it->second; | 1349 chromeos::MountLibrary::Disk* volume = volume_it->second; |
| 1346 DictionaryValue* volume_info = new DictionaryValue(); | 1350 DictionaryValue* volume_info = new DictionaryValue(); |
| 1347 result_.reset(volume_info); | 1351 result_.reset(volume_info); |
| 1348 // Localising mount path. | 1352 // Localising mount path. |
| 1349 FilePath relative_mount_path; | 1353 std::string mount_path; |
| 1350 FileManagerUtil::ConvertFileToRelativeFileSystemPath(profile_, | 1354 if (!volume->mount_path().empty()) { |
| 1351 FilePath(volume->mount_path()), &relative_mount_path); | 1355 FilePath relative_mount_path; |
| 1352 | 1356 FileManagerUtil::ConvertFileToRelativeFileSystemPath(profile_, |
| 1357 FilePath(volume->mount_path()), &relative_mount_path); |
| 1358 mount_path = relative_mount_path.value(); |
| 1359 } |
| 1353 volume_info->SetString("devicePath", volume->device_path()); | 1360 volume_info->SetString("devicePath", volume->device_path()); |
| 1354 volume_info->SetString("mountPath", relative_mount_path.value()); | 1361 volume_info->SetString("mountPath", mount_path); |
| 1355 volume_info->SetString("systemPath", volume->system_path()); | 1362 volume_info->SetString("systemPath", volume->system_path()); |
| 1356 volume_info->SetString("filePath", volume->file_path()); | 1363 volume_info->SetString("filePath", volume->file_path()); |
| 1357 volume_info->SetString("deviceLabel", volume->device_label()); | 1364 volume_info->SetString("deviceLabel", volume->device_label()); |
| 1358 volume_info->SetString("driveLabel", volume->drive_label()); | 1365 volume_info->SetString("driveLabel", volume->drive_label()); |
| 1359 volume_info->SetString("deviceType", | 1366 volume_info->SetString("deviceType", |
| 1360 DeviceTypeToString(volume->device_type())); | 1367 DeviceTypeToString(volume->device_type())); |
| 1361 volume_info->SetInteger("totalSize", volume->total_size()); | 1368 volume_info->SetInteger("totalSize", volume->total_size()); |
| 1362 volume_info->SetBoolean("isParent", volume->is_parent()); | 1369 volume_info->SetBoolean("isParent", volume->is_parent()); |
| 1363 volume_info->SetBoolean("isReadOnly", volume->is_read_only()); | 1370 volume_info->SetBoolean("isReadOnly", volume->is_read_only()); |
| 1364 volume_info->SetBoolean("hasMedia", volume->has_media()); | 1371 volume_info->SetBoolean("hasMedia", volume->has_media()); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 SET_STRING(IDS_FILE_BROWSER, OPEN_LABEL); | 1477 SET_STRING(IDS_FILE_BROWSER, OPEN_LABEL); |
| 1471 SET_STRING(IDS_FILE_BROWSER, SAVE_LABEL); | 1478 SET_STRING(IDS_FILE_BROWSER, SAVE_LABEL); |
| 1472 SET_STRING(IDS_FILE_BROWSER, OK_LABEL); | 1479 SET_STRING(IDS_FILE_BROWSER, OK_LABEL); |
| 1473 | 1480 |
| 1474 SET_STRING(IDS_FILE_BROWSER, DEFAULT_NEW_FOLDER_NAME); | 1481 SET_STRING(IDS_FILE_BROWSER, DEFAULT_NEW_FOLDER_NAME); |
| 1475 SET_STRING(IDS_FILE_BROWSER, MORE_FILES); | 1482 SET_STRING(IDS_FILE_BROWSER, MORE_FILES); |
| 1476 | 1483 |
| 1477 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_ONE); | 1484 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_ONE); |
| 1478 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_SOME); | 1485 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_SOME); |
| 1479 | 1486 |
| 1487 SET_STRING(IDS_FILE_BROWSER, UNKNOWN_FILESYSTEM_WARNING); |
| 1488 SET_STRING(IDS_FILE_BROWSER, UNSUPPORTED_FILESYSTEM_WARNING); |
| 1480 SET_STRING(IDS_FILE_BROWSER, FORMATTING_WARNING); | 1489 SET_STRING(IDS_FILE_BROWSER, FORMATTING_WARNING); |
| 1481 | 1490 |
| 1482 SET_STRING(IDS_FILE_BROWSER, SELECT_FOLDER_TITLE); | 1491 SET_STRING(IDS_FILE_BROWSER, SELECT_FOLDER_TITLE); |
| 1483 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_FILE_TITLE); | 1492 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_FILE_TITLE); |
| 1484 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_MULTI_FILE_TITLE); | 1493 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_MULTI_FILE_TITLE); |
| 1485 SET_STRING(IDS_FILE_BROWSER, SELECT_SAVEAS_FILE_TITLE); | 1494 SET_STRING(IDS_FILE_BROWSER, SELECT_SAVEAS_FILE_TITLE); |
| 1486 | 1495 |
| 1487 SET_STRING(IDS_FILE_BROWSER, COMPUTING_SELECTION); | 1496 SET_STRING(IDS_FILE_BROWSER, COMPUTING_SELECTION); |
| 1488 SET_STRING(IDS_FILE_BROWSER, NOTHING_SELECTED); | 1497 SET_STRING(IDS_FILE_BROWSER, NOTHING_SELECTED); |
| 1489 SET_STRING(IDS_FILE_BROWSER, ONE_FILE_SELECTED); | 1498 SET_STRING(IDS_FILE_BROWSER, ONE_FILE_SELECTED); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 // TODO(serya): Create a new string in .grd file for this one in M13. | 1534 // TODO(serya): Create a new string in .grd file for this one in M13. |
| 1526 dict->SetString("PREVIEW_IMAGE", | 1535 dict->SetString("PREVIEW_IMAGE", |
| 1527 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON)); | 1536 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON)); |
| 1528 dict->SetString("PLAY_MEDIA", | 1537 dict->SetString("PLAY_MEDIA", |
| 1529 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); | 1538 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); |
| 1530 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableArchives)) | 1539 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableArchives)) |
| 1531 dict->SetString("ENABLE_ARCHIVES", "true"); | 1540 dict->SetString("ENABLE_ARCHIVES", "true"); |
| 1532 | 1541 |
| 1533 return true; | 1542 return true; |
| 1534 } | 1543 } |
| OLD | NEW |