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 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 RemoveMountFunction::~RemoveMountFunction() { | 1205 RemoveMountFunction::~RemoveMountFunction() { |
1206 } | 1206 } |
1207 | 1207 |
1208 bool RemoveMountFunction::RunImpl() { | 1208 bool RemoveMountFunction::RunImpl() { |
1209 if (args_->GetSize() != 1) { | 1209 if (args_->GetSize() != 1) { |
1210 return false; | 1210 return false; |
1211 } | 1211 } |
1212 | 1212 |
1213 std::string mount_path; | 1213 std::string mount_path; |
1214 if (!args_->GetString(0, &mount_path)) { | 1214 if (!args_->GetString(0, &mount_path)) { |
1215 return false; | 1215 return false; |
1216 } | 1216 } |
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)) { |
| 1272 NOTREACHED(); |
| 1273 return false; |
| 1274 } |
| 1275 |
| 1276 #ifdef OS_CHROMEOS |
| 1277 chromeos::CrosLibrary::Get()->GetMountLibrary()->FormatMountedDevice( |
| 1278 volume_mount_path.c_str()); |
| 1279 #endif |
| 1280 |
| 1281 SendResponse(true); |
| 1282 return true; |
| 1283 } |
1256 | 1284 |
1257 GetVolumeMetadataFunction::GetVolumeMetadataFunction() { | 1285 GetVolumeMetadataFunction::GetVolumeMetadataFunction() { |
1258 } | 1286 } |
1259 | 1287 |
1260 GetVolumeMetadataFunction::~GetVolumeMetadataFunction() { | 1288 GetVolumeMetadataFunction::~GetVolumeMetadataFunction() { |
1261 } | 1289 } |
1262 | 1290 |
1263 bool GetVolumeMetadataFunction::RunImpl() { | 1291 bool GetVolumeMetadataFunction::RunImpl() { |
1264 if (args_->GetSize() != 1) { | 1292 if (args_->GetSize() != 1) { |
1265 error_ = "Invalid argument count"; | 1293 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); | 1426 SET_STRING(IDS_FILE_BROWSER, OPEN_LABEL); |
1399 SET_STRING(IDS_FILE_BROWSER, SAVE_LABEL); | 1427 SET_STRING(IDS_FILE_BROWSER, SAVE_LABEL); |
1400 SET_STRING(IDS_FILE_BROWSER, OK_LABEL); | 1428 SET_STRING(IDS_FILE_BROWSER, OK_LABEL); |
1401 | 1429 |
1402 SET_STRING(IDS_FILE_BROWSER, DEFAULT_NEW_FOLDER_NAME); | 1430 SET_STRING(IDS_FILE_BROWSER, DEFAULT_NEW_FOLDER_NAME); |
1403 SET_STRING(IDS_FILE_BROWSER, MORE_FILES); | 1431 SET_STRING(IDS_FILE_BROWSER, MORE_FILES); |
1404 | 1432 |
1405 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_ONE); | 1433 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_ONE); |
1406 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_SOME); | 1434 SET_STRING(IDS_FILE_BROWSER, CONFIRM_DELETE_SOME); |
1407 | 1435 |
| 1436 SET_STRING(IDS_FILE_BROWSER, FORMATTING_WARNING); |
| 1437 |
1408 SET_STRING(IDS_FILE_BROWSER, SELECT_FOLDER_TITLE); | 1438 SET_STRING(IDS_FILE_BROWSER, SELECT_FOLDER_TITLE); |
1409 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_FILE_TITLE); | 1439 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_FILE_TITLE); |
1410 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_MULTI_FILE_TITLE); | 1440 SET_STRING(IDS_FILE_BROWSER, SELECT_OPEN_MULTI_FILE_TITLE); |
1411 SET_STRING(IDS_FILE_BROWSER, SELECT_SAVEAS_FILE_TITLE); | 1441 SET_STRING(IDS_FILE_BROWSER, SELECT_SAVEAS_FILE_TITLE); |
1412 | 1442 |
1413 SET_STRING(IDS_FILE_BROWSER, COMPUTING_SELECTION); | 1443 SET_STRING(IDS_FILE_BROWSER, COMPUTING_SELECTION); |
1414 SET_STRING(IDS_FILE_BROWSER, NOTHING_SELECTED); | 1444 SET_STRING(IDS_FILE_BROWSER, NOTHING_SELECTED); |
1415 SET_STRING(IDS_FILE_BROWSER, ONE_FILE_SELECTED); | 1445 SET_STRING(IDS_FILE_BROWSER, ONE_FILE_SELECTED); |
1416 SET_STRING(IDS_FILE_BROWSER, ONE_DIRECTORY_SELECTED); | 1446 SET_STRING(IDS_FILE_BROWSER, ONE_DIRECTORY_SELECTED); |
1417 SET_STRING(IDS_FILE_BROWSER, MANY_FILES_SELECTED); | 1447 SET_STRING(IDS_FILE_BROWSER, MANY_FILES_SELECTED); |
1418 SET_STRING(IDS_FILE_BROWSER, MANY_DIRECTORIES_SELECTED); | 1448 SET_STRING(IDS_FILE_BROWSER, MANY_DIRECTORIES_SELECTED); |
1419 SET_STRING(IDS_FILE_BROWSER, MANY_ENTRIES_SELECTED); | 1449 SET_STRING(IDS_FILE_BROWSER, MANY_ENTRIES_SELECTED); |
1420 | 1450 |
1421 SET_STRING(IDS_FILE_BROWSER, PLAYBACK_ERROR); | 1451 SET_STRING(IDS_FILE_BROWSER, PLAYBACK_ERROR); |
1422 | 1452 |
1423 SET_STRING(IDS_FILEBROWSER, ENQUEUE); | 1453 SET_STRING(IDS_FILEBROWSER, ENQUEUE); |
1424 #undef SET_STRING | 1454 #undef SET_STRING |
1425 | 1455 |
1426 // TODO(serya): Create a new string in .grd file for this one in M13. | 1456 // TODO(serya): Create a new string in .grd file for this one in M13. |
1427 dict->SetString("PREVIEW_IMAGE", | 1457 dict->SetString("PREVIEW_IMAGE", |
1428 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON)); | 1458 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_VIEW_CERT_BUTTON)); |
1429 dict->SetString("PLAY_MEDIA", | 1459 dict->SetString("PLAY_MEDIA", |
1430 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); | 1460 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); |
1431 | 1461 |
1432 return true; | 1462 return true; |
1433 } | 1463 } |
OLD | NEW |