| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/api/file_system/file_system_api.h" | 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "extensions/browser/granted_file_entry.h" | 50 #include "extensions/browser/granted_file_entry.h" |
| 51 #include "extensions/common/permissions/api_permission.h" | 51 #include "extensions/common/permissions/api_permission.h" |
| 52 #include "extensions/common/permissions/permissions_data.h" | 52 #include "extensions/common/permissions/permissions_data.h" |
| 53 #include "net/base/mime_util.h" | 53 #include "net/base/mime_util.h" |
| 54 #include "storage/browser/fileapi/external_mount_points.h" | 54 #include "storage/browser/fileapi/external_mount_points.h" |
| 55 #include "storage/browser/fileapi/file_system_operation_runner.h" | 55 #include "storage/browser/fileapi/file_system_operation_runner.h" |
| 56 #include "storage/browser/fileapi/isolated_context.h" | 56 #include "storage/browser/fileapi/isolated_context.h" |
| 57 #include "storage/common/fileapi/file_system_types.h" | 57 #include "storage/common/fileapi/file_system_types.h" |
| 58 #include "storage/common/fileapi/file_system_util.h" | 58 #include "storage/common/fileapi/file_system_util.h" |
| 59 #include "ui/base/l10n/l10n_util.h" | 59 #include "ui/base/l10n/l10n_util.h" |
| 60 #include "ui/base/ui_base_types.h" | |
| 61 #include "ui/shell_dialogs/select_file_dialog.h" | 60 #include "ui/shell_dialogs/select_file_dialog.h" |
| 62 #include "ui/shell_dialogs/selected_file_info.h" | 61 #include "ui/shell_dialogs/selected_file_info.h" |
| 63 | 62 |
| 64 #if defined(OS_MACOSX) | 63 #if defined(OS_MACOSX) |
| 65 #include <CoreFoundation/CoreFoundation.h> | 64 #include <CoreFoundation/CoreFoundation.h> |
| 66 #include "base/mac/foundation_util.h" | 65 #include "base/mac/foundation_util.h" |
| 67 #endif | 66 #endif |
| 68 | 67 |
| 69 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
| 70 #include "base/strings/string16.h" | 69 #include "base/strings/string16.h" |
| 71 #include "base/threading/thread_task_runner_handle.h" | 70 #include "base/threading/thread_task_runner_handle.h" |
| 72 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 71 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 73 #include "chrome/browser/chromeos/file_manager/app_id.h" | 72 #include "chrome/browser/chromeos/file_manager/app_id.h" |
| 74 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" | 73 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" |
| 75 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | 74 #include "chrome/browser/extensions/api/file_system/request_file_system_dialog_v
iew.h" |
| 76 #include "chrome/browser/extensions/api/file_system/request_file_system_notifica
tion.h" | 75 #include "chrome/browser/extensions/api/file_system/request_file_system_notifica
tion.h" |
| 77 #include "chrome/browser/ui/simple_message_box.h" | 76 #include "chrome/browser/ui/simple_message_box.h" |
| 78 #include "chrome/browser/ui/views/extensions/request_file_system_dialog_view.h" | |
| 79 #include "components/user_manager/user_manager.h" | 77 #include "components/user_manager/user_manager.h" |
| 80 #include "extensions/browser/event_router.h" | 78 #include "extensions/browser/event_router.h" |
| 81 #include "extensions/browser/extension_registry.h" | 79 #include "extensions/browser/extension_registry.h" |
| 82 #include "extensions/common/constants.h" | 80 #include "extensions/common/constants.h" |
| 83 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" | 81 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" |
| 84 #include "url/url_constants.h" | 82 #include "url/url_constants.h" |
| 85 #endif | 83 #endif |
| 86 | 84 |
| 87 using apps::SavedFileEntry; | 85 using apps::SavedFileEntry; |
| 88 using apps::SavedFilesService; | 86 using apps::SavedFilesService; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 430 |
| 433 // Short circuit the user consent dialog for tests. This is far from a pretty | 431 // Short circuit the user consent dialog for tests. This is far from a pretty |
| 434 // code design. | 432 // code design. |
| 435 if (g_auto_dialog_button_for_test != ui::DIALOG_BUTTON_NONE) { | 433 if (g_auto_dialog_button_for_test != ui::DIALOG_BUTTON_NONE) { |
| 436 base::ThreadTaskRunnerHandle::Get()->PostTask( | 434 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 437 FROM_HERE, | 435 FROM_HERE, |
| 438 base::Bind(callback, g_auto_dialog_button_for_test /* result */)); | 436 base::Bind(callback, g_auto_dialog_button_for_test /* result */)); |
| 439 return; | 437 return; |
| 440 } | 438 } |
| 441 | 439 |
| 442 // If the volume is gone, then cancel the dialog. | 440 RequestFileSystemDialogView::ShowDialog(web_contents, extension, volume, |
| 443 if (!volume.get()) { | 441 writable, callback); |
| 444 base::ThreadTaskRunnerHandle::Get()->PostTask( | |
| 445 FROM_HERE, base::Bind(callback, ui::DIALOG_BUTTON_CANCEL)); | |
| 446 return; | |
| 447 } | |
| 448 | |
| 449 RequestFileSystemDialogView::ShowDialog( | |
| 450 web_contents, extension.name(), | |
| 451 (volume->volume_label().empty() ? volume->volume_id() | |
| 452 : volume->volume_label()), | |
| 453 writable, callback); | |
| 454 } | 442 } |
| 455 | 443 |
| 456 void ConsentProviderDelegate::ShowNotification( | 444 void ConsentProviderDelegate::ShowNotification( |
| 457 const Extension& extension, | 445 const Extension& extension, |
| 458 const base::WeakPtr<file_manager::Volume>& volume, | 446 const base::WeakPtr<file_manager::Volume>& volume, |
| 459 bool writable) { | 447 bool writable) { |
| 460 RequestFileSystemNotification::ShowAutoGrantedNotification( | 448 RequestFileSystemNotification::ShowAutoGrantedNotification( |
| 461 profile_, extension, volume, writable); | 449 profile_, extension, volume, writable); |
| 462 } | 450 } |
| 463 | 451 |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 return RespondNow(Error(kNotSupportedOnNonKioskSessionError)); | 1421 return RespondNow(Error(kNotSupportedOnNonKioskSessionError)); |
| 1434 std::vector<api::file_system::Volume> result_volume_list; | 1422 std::vector<api::file_system::Volume> result_volume_list; |
| 1435 FillVolumeList(chrome_details_.GetProfile(), &result_volume_list); | 1423 FillVolumeList(chrome_details_.GetProfile(), &result_volume_list); |
| 1436 | 1424 |
| 1437 return RespondNow(ArgumentList( | 1425 return RespondNow(ArgumentList( |
| 1438 api::file_system::GetVolumeList::Results::Create(result_volume_list))); | 1426 api::file_system::GetVolumeList::Results::Create(result_volume_list))); |
| 1439 } | 1427 } |
| 1440 #endif | 1428 #endif |
| 1441 | 1429 |
| 1442 } // namespace extensions | 1430 } // namespace extensions |
| OLD | NEW |