Chromium Code Reviews| 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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1217 | 1217 |
| 1218 #ifdef OS_CHROMEOS | 1218 #ifdef OS_CHROMEOS |
| 1219 chromeos::CrosLibrary::Get()->GetMountLibrary()->UnmountPath( | 1219 chromeos::CrosLibrary::Get()->GetMountLibrary()->UnmountPath( |
| 1220 mount_path.c_str()); | 1220 mount_path.c_str()); |
| 1221 #endif | 1221 #endif |
| 1222 | 1222 |
| 1223 SendResponse(true); | 1223 SendResponse(true); |
| 1224 return true; | 1224 return true; |
| 1225 } | 1225 } |
| 1226 | 1226 |
| 1227 | |
| 1227 GetMountPointsFunction::GetMountPointsFunction() { | 1228 GetMountPointsFunction::GetMountPointsFunction() { |
| 1228 } | 1229 } |
| 1229 | 1230 |
| 1230 GetMountPointsFunction::~GetMountPointsFunction() { | 1231 GetMountPointsFunction::~GetMountPointsFunction() { |
| 1231 } | 1232 } |
| 1232 | 1233 |
| 1233 bool GetMountPointsFunction::RunImpl() { | 1234 bool GetMountPointsFunction::RunImpl() { |
| 1234 if (args_->GetSize()) | 1235 if (args_->GetSize()) |
| 1235 return false; | 1236 return false; |
| 1236 | 1237 |
| 1237 base::ListValue *mounts = new base::ListValue(); | 1238 base::ListValue *mounts = new base::ListValue(); |
| 1238 result_.reset(mounts); | 1239 result_.reset(mounts); |
| 1239 | 1240 |
| 1240 #ifdef OS_CHROMEOS | 1241 #ifdef OS_CHROMEOS |
| 1241 chromeos::MountLibrary *mount_lib = | 1242 chromeos::MountLibrary *mount_lib = |
| 1242 chromeos::CrosLibrary::Get()->GetMountLibrary(); | 1243 chromeos::CrosLibrary::Get()->GetMountLibrary(); |
| 1243 chromeos::MountLibrary::MountPointMap mount_points = | 1244 chromeos::MountLibrary::MountPointMap mount_points = |
| 1244 mount_lib->mount_points(); | 1245 mount_lib->mount_points(); |
| 1245 | 1246 |
| 1246 for (chromeos::MountLibrary::MountPointMap::const_iterator it = | 1247 for (chromeos::MountLibrary::MountPointMap::const_iterator it = |
| 1247 mount_points.begin(); | 1248 mount_points.begin(); |
| 1248 it != mount_points.end(); | 1249 it != mount_points.end(); |
| 1249 ++it) { | 1250 ++it) { |
| 1250 mounts->Append(MountPointToValue(profile_, it->second)); | 1251 mounts->Append(MountPointToValue(profile_, it->second)); |
| 1251 } | 1252 } |
| 1252 #endif | 1253 #endif |
| 1254 | |
| 1253 SendResponse(true); | 1255 SendResponse(true); |
| 1254 return true; | 1256 return true; |
| 1255 } | 1257 } |
| 1258 | |
| 1259 FormatDeviceFunction::FormatDeviceFunction() { | |
| 1260 } | |
| 1261 | |
| 1262 FormatDeviceFunction::~FormatDeviceFunction() { | |
| 1263 } | |
| 1264 | |
| 1265 bool FormatDeviceFunction::RunImpl() { | |
| 1266 if (args_->GetSize() != 1) { | |
| 1267 return false; | |
| 1268 } | |
| 1269 | |
| 1270 std::string volume_mount_path; | |
| 1271 if (!args_->GetString(0, &volume_mount_path)) { | |
|
asargent_no_longer_on_chrome
2011/07/29 23:14:19
nit: you probably want to either CHECK(false) here
sidor.dev
2011/07/29 23:28:27
Done.
| |
| 1272 NOTREACHED(); | |
| 1273 } | |
| 1274 | |
| 1275 #ifdef OS_CHROMEOS | |
| 1276 chromeos::CrosLibrary::Get()->GetMountLibrary()->FormatMountedDevice( | |
| 1277 volume_mount_path.c_str()); | |
| 1278 #endif | |
| 1279 | |
| 1280 SendResponse(true); | |
| 1281 return true; | |
| 1282 } | |
| 1256 | 1283 |
| 1257 GetVolumeMetadataFunction::GetVolumeMetadataFunction() { | 1284 GetVolumeMetadataFunction::GetVolumeMetadataFunction() { |
| 1258 } | 1285 } |
| 1259 | 1286 |
| 1260 GetVolumeMetadataFunction::~GetVolumeMetadataFunction() { | 1287 GetVolumeMetadataFunction::~GetVolumeMetadataFunction() { |
| 1261 } | 1288 } |
| 1262 | 1289 |
| 1263 bool GetVolumeMetadataFunction::RunImpl() { | 1290 bool GetVolumeMetadataFunction::RunImpl() { |
| 1264 if (args_->GetSize() != 1) { | 1291 if (args_->GetSize() != 1) { |
| 1265 error_ = "Invalid argument count"; | 1292 error_ = "Invalid argument count"; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1398 SET_STRING(IDS_FILE_BROWSER, OPEN_LABEL); | 1425 SET_STRING(IDS_FILE_BROWSER, OPEN_LABEL); |
| 1399 SET_STRING(IDS_FILE_BROWSER, SAVE_LABEL); | 1426 SET_STRING(IDS_FILE_BROWSER, SAVE_LABEL); |
| 1400 SET_STRING(IDS_FILE_BROWSER, OK_LABEL); | 1427 SET_STRING(IDS_FILE_BROWSER, OK_LABEL); |
| 1401 | 1428 |
| 1402 SET_STRING(IDS_FILE_BROWSER, DEFAULT_NEW_FOLDER_NAME); | 1429 SET_STRING(IDS_FILE_BROWSER, DEFAULT_NEW_FOLDER_NAME); |
| 1403 SET_STRING(IDS_FILE_BROWSER, MORE_FILES); | 1430 SET_STRING(IDS_FILE_BROWSER, MORE_FILES); |
| 1404 | 1431 |
| 1405 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_ONE); | 1432 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_ONE); |
| 1406 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_SOME); | 1433 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_SOME); |
| 1407 | 1434 |
| 1435 SET_STRING(IDS_FILE_BROWSER, FORMATTING_WARNING); | |
| 1436 | |
| 1408 SET_STRING(IDS_FILE_BROWSER, SELECT_FOLDER_TITLE); | 1437 SET_STRING(IDS_FILE_BROWSER, SELECT_FOLDER_TITLE); |
| 1409 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_FILE_TITLE); | 1438 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_FILE_TITLE); |
| 1410 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_MULTI_FILE_TITLE); | 1439 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_MULTI_FILE_TITLE); |
| 1411 SET_STRING(IDS_FILE_BROWSER, SELECT_SAVEAS_FILE_TITLE); | 1440 SET_STRING(IDS_FILE_BROWSER, SELECT_SAVEAS_FILE_TITLE); |
| 1412 | 1441 |
| 1413 SET_STRING(IDS_FILE_BROWSER, COMPUTING_SELECTION); | 1442 SET_STRING(IDS_FILE_BROWSER, COMPUTING_SELECTION); |
| 1414 SET_STRING(IDS_FILE_BROWSER, NOTHING_SELECTED); | 1443 SET_STRING(IDS_FILE_BROWSER, NOTHING_SELECTED); |
| 1415 SET_STRING(IDS_FILE_BROWSER, ONE_FILE_SELECTED); | 1444 SET_STRING(IDS_FILE_BROWSER, ONE_FILE_SELECTED); |
| 1416 SET_STRING(IDS_FILE_BROWSER, ONE_DIRECTORY_SELECTED); | 1445 SET_STRING(IDS_FILE_BROWSER, ONE_DIRECTORY_SELECTED); |
| 1417 SET_STRING(IDS_FILE_BROWSER, MANY_FILES_SELECTED); | 1446 SET_STRING(IDS_FILE_BROWSER, MANY_FILES_SELECTED); |
| 1418 SET_STRING(IDS_FILE_BROWSER, MANY_DIRECTORIES_SELECTED); | 1447 SET_STRING(IDS_FILE_BROWSER, MANY_DIRECTORIES_SELECTED); |
| 1419 SET_STRING(IDS_FILE_BROWSER, MANY_ENTRIES_SELECTED); | 1448 SET_STRING(IDS_FILE_BROWSER, MANY_ENTRIES_SELECTED); |
| 1420 | 1449 |
| 1421 SET_STRING(IDS_FILE_BROWSER, PLAYBACK_ERROR); | 1450 SET_STRING(IDS_FILE_BROWSER, PLAYBACK_ERROR); |
| 1422 | 1451 |
| 1423 SET_STRING(IDS_FILEBROWSER, ENQUEUE); | 1452 SET_STRING(IDS_FILEBROWSER, ENQUEUE); |
| 1424 #undef SET_STRING | 1453 #undef SET_STRING |
| 1425 | 1454 |
| 1426 // TODO(serya): Create a new string in .grd file for this one in M13. | 1455 // TODO(serya): Create a new string in .grd file for this one in M13. |
| 1427 dict->SetString("PREVIEW_IMAGE", | 1456 dict->SetString("PREVIEW_IMAGE", |
| 1428 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON)); | 1457 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON)); |
| 1429 dict->SetString("PLAY_MEDIA", | 1458 dict->SetString("PLAY_MEDIA", |
| 1430 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); | 1459 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); |
| 1431 | 1460 |
| 1432 return true; | 1461 return true; |
| 1433 } | 1462 } |
| OLD | NEW |