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

Side by Side Diff: chrome/browser/extensions/extension_file_browser_private_api.cc

Issue 7706028: This is UI side unreadable device support. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: style + enum + action on hitting enter key Created 9 years, 4 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
OLDNEW
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
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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 } 1315 }
1312 1316
1313 #ifdef OS_CHROMEOS 1317 #ifdef OS_CHROMEOS
1314 chromeos::CrosLibrary::Get()->GetMountLibrary()->FormatMountedDevice( 1318 chromeos::CrosLibrary::Get()->GetMountLibrary()->FormatMountedDevice(
1315 files[0].value().c_str()); 1319 files[0].value().c_str());
1316 #endif 1320 #endif
1317 1321
1318 SendResponse(true); 1322 SendResponse(true);
1319 } 1323 }
1320 1324
1325 FormatUnmountedDeviceFunction::FormatUnmountedDeviceFunction() {
1326 }
1327
1328 FormatUnmountedDeviceFunction::~FormatUnmountedDeviceFunction() {
1329 }
1330
1331 bool FormatUnmountedDeviceFunction::RunImpl() {
1332 if (args_->GetSize() != 1) {
1333 return false;
1334 }
1335
1336 std::string volume_file;
1337 if (!args_->GetString(0, &volume_file)) {
1338 NOTREACHED();
1339 return false;
1340 }
1341
1342 #ifdef OS_CHROMEOS
1343 chromeos::CrosLibrary::Get()->GetMountLibrary()->FormatUnmountedDevice(
1344 volume_file.c_str());
1345 #endif
1346
1347 SendResponse(true);
1348 return true;
1349 }
1350
1321 GetVolumeMetadataFunction::GetVolumeMetadataFunction() { 1351 GetVolumeMetadataFunction::GetVolumeMetadataFunction() {
1322 } 1352 }
1323 1353
1324 GetVolumeMetadataFunction::~GetVolumeMetadataFunction() { 1354 GetVolumeMetadataFunction::~GetVolumeMetadataFunction() {
1325 } 1355 }
1326 1356
1327 bool GetVolumeMetadataFunction::RunImpl() { 1357 bool GetVolumeMetadataFunction::RunImpl() {
1328 if (args_->GetSize() != 1) { 1358 if (args_->GetSize() != 1) {
1329 error_ = "Invalid argument count"; 1359 error_ = "Invalid argument count";
1330 return false; 1360 return false;
1331 } 1361 }
1332 1362
1333 std::string volume_device_path; 1363 std::string volume_device_path;
1334 if (!args_->GetString(0, &volume_device_path)) { 1364 if (!args_->GetString(0, &volume_device_path)) {
1335 NOTREACHED(); 1365 NOTREACHED();
1336 } 1366 }
1337 1367
1338 #ifdef OS_CHROMEOS 1368 #ifdef OS_CHROMEOS
1339 chromeos::MountLibrary* mount_lib = 1369 chromeos::MountLibrary* mount_lib =
1340 chromeos::CrosLibrary::Get()->GetMountLibrary(); 1370 chromeos::CrosLibrary::Get()->GetMountLibrary();
1341 chromeos::MountLibrary::DiskMap::const_iterator volume_it = 1371 chromeos::MountLibrary::DiskMap::const_iterator volume_it =
1342 mount_lib->disks().find(volume_device_path); 1372 mount_lib->disks().find(volume_device_path);
1343 1373
1344 if (volume_it != mount_lib->disks().end()) { 1374 if (volume_it != mount_lib->disks().end()) {
1345 chromeos::MountLibrary::Disk* volume = volume_it->second; 1375 chromeos::MountLibrary::Disk* volume = volume_it->second;
1346 DictionaryValue* volume_info = new DictionaryValue(); 1376 DictionaryValue* volume_info = new DictionaryValue();
1347 result_.reset(volume_info); 1377 result_.reset(volume_info);
1348 // Localising mount path. 1378 // Localising mount path.
1349 FilePath relative_mount_path; 1379 std::string mount_path;
1350 FileManagerUtil::ConvertFileToRelativeFileSystemPath(profile_, 1380 if (!volume->mount_path().empty()) {
1351 FilePath(volume->mount_path()), &relative_mount_path); 1381 FilePath relative_mount_path;
1352 1382 FileManagerUtil::ConvertFileToRelativeFileSystemPath(profile_,
1383 FilePath(volume->mount_path()), &relative_mount_path);
1384 mount_path = relative_mount_path.value();
1385 } else {
1386 mount_path = "";
tbarzic 2011/08/25 02:03:44 you don't need else part... mount_path is set to "
sidor 2011/08/25 18:02:13 Yes, sorry for that. That what happens when you re
1387 }
1353 volume_info->SetString("devicePath", volume->device_path()); 1388 volume_info->SetString("devicePath", volume->device_path());
1354 volume_info->SetString("mountPath", relative_mount_path.value()); 1389 volume_info->SetString("mountPath", mount_path);
1355 volume_info->SetString("systemPath", volume->system_path()); 1390 volume_info->SetString("systemPath", volume->system_path());
1356 volume_info->SetString("filePath", volume->file_path()); 1391 volume_info->SetString("filePath", volume->file_path());
1357 volume_info->SetString("deviceLabel", volume->device_label()); 1392 volume_info->SetString("deviceLabel", volume->device_label());
1358 volume_info->SetString("driveLabel", volume->drive_label()); 1393 volume_info->SetString("driveLabel", volume->drive_label());
1359 volume_info->SetString("deviceType", 1394 volume_info->SetString("deviceType",
1360 DeviceTypeToString(volume->device_type())); 1395 DeviceTypeToString(volume->device_type()));
1361 volume_info->SetInteger("totalSize", volume->total_size()); 1396 volume_info->SetInteger("totalSize", volume->total_size());
1362 volume_info->SetBoolean("isParent", volume->is_parent()); 1397 volume_info->SetBoolean("isParent", volume->is_parent());
1363 volume_info->SetBoolean("isReadOnly", volume->is_read_only()); 1398 volume_info->SetBoolean("isReadOnly", volume->is_read_only());
1364 volume_info->SetBoolean("hasMedia", volume->has_media()); 1399 volume_info->SetBoolean("hasMedia", volume->has_media());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 SET_STRING(IDS_FILE_BROWSER, OPEN_LABEL); 1505 SET_STRING(IDS_FILE_BROWSER, OPEN_LABEL);
1471 SET_STRING(IDS_FILE_BROWSER, SAVE_LABEL); 1506 SET_STRING(IDS_FILE_BROWSER, SAVE_LABEL);
1472 SET_STRING(IDS_FILE_BROWSER, OK_LABEL); 1507 SET_STRING(IDS_FILE_BROWSER, OK_LABEL);
1473 1508
1474 SET_STRING(IDS_FILE_BROWSER, DEFAULT_NEW_FOLDER_NAME); 1509 SET_STRING(IDS_FILE_BROWSER, DEFAULT_NEW_FOLDER_NAME);
1475 SET_STRING(IDS_FILE_BROWSER, MORE_FILES); 1510 SET_STRING(IDS_FILE_BROWSER, MORE_FILES);
1476 1511
1477 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_ONE); 1512 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_ONE);
1478 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_SOME); 1513 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_SOME);
1479 1514
1515 SET_STRING(IDS_FILE_BROWSER, UNKNOWN_FILESYSTEM_WARNING);
1516 SET_STRING(IDS_FILE_BROWSER, UNSUPPORTED_FILESYSTEM_WARNING);
1480 SET_STRING(IDS_FILE_BROWSER, FORMATTING_WARNING); 1517 SET_STRING(IDS_FILE_BROWSER, FORMATTING_WARNING);
1481 1518
1482 SET_STRING(IDS_FILE_BROWSER, SELECT_FOLDER_TITLE); 1519 SET_STRING(IDS_FILE_BROWSER, SELECT_FOLDER_TITLE);
1483 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_FILE_TITLE); 1520 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_FILE_TITLE);
1484 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_MULTI_FILE_TITLE); 1521 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_MULTI_FILE_TITLE);
1485 SET_STRING(IDS_FILE_BROWSER, SELECT_SAVEAS_FILE_TITLE); 1522 SET_STRING(IDS_FILE_BROWSER, SELECT_SAVEAS_FILE_TITLE);
1486 1523
1487 SET_STRING(IDS_FILE_BROWSER, COMPUTING_SELECTION); 1524 SET_STRING(IDS_FILE_BROWSER, COMPUTING_SELECTION);
1488 SET_STRING(IDS_FILE_BROWSER, NOTHING_SELECTED); 1525 SET_STRING(IDS_FILE_BROWSER, NOTHING_SELECTED);
1489 SET_STRING(IDS_FILE_BROWSER, ONE_FILE_SELECTED); 1526 SET_STRING(IDS_FILE_BROWSER, ONE_FILE_SELECTED);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 #undef SET_STRING 1560 #undef SET_STRING
1524 1561
1525 // TODO(serya): Create a new string in .grd file for this one in M13. 1562 // TODO(serya): Create a new string in .grd file for this one in M13.
1526 dict->SetString("PREVIEW_IMAGE", 1563 dict->SetString("PREVIEW_IMAGE",
1527 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON)); 1564 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON));
1528 dict->SetString("PLAY_MEDIA", 1565 dict->SetString("PLAY_MEDIA",
1529 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); 1566 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY));
1530 1567
1531 return true; 1568 return true;
1532 } 1569 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698