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" | |
60 #include "ui/shell_dialogs/select_file_dialog.h" | 61 #include "ui/shell_dialogs/select_file_dialog.h" |
61 #include "ui/shell_dialogs/selected_file_info.h" | 62 #include "ui/shell_dialogs/selected_file_info.h" |
62 | 63 |
63 #if defined(OS_MACOSX) | 64 #if defined(OS_MACOSX) |
64 #include <CoreFoundation/CoreFoundation.h> | 65 #include <CoreFoundation/CoreFoundation.h> |
65 #include "base/mac/foundation_util.h" | 66 #include "base/mac/foundation_util.h" |
66 #endif | 67 #endif |
67 | 68 |
68 #if defined(OS_CHROMEOS) | 69 #if defined(OS_CHROMEOS) |
69 #include "base/strings/string16.h" | 70 #include "base/strings/string16.h" |
70 #include "base/threading/thread_task_runner_handle.h" | 71 #include "base/threading/thread_task_runner_handle.h" |
71 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 72 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
72 #include "chrome/browser/chromeos/file_manager/app_id.h" | 73 #include "chrome/browser/chromeos/file_manager/app_id.h" |
73 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" | 74 #include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" |
74 #include "chrome/browser/extensions/api/file_system/request_file_system_dialog_v iew.h" | 75 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
75 #include "chrome/browser/extensions/api/file_system/request_file_system_notifica tion.h" | 76 #include "chrome/browser/extensions/api/file_system/request_file_system_notifica tion.h" |
76 #include "chrome/browser/ui/simple_message_box.h" | 77 #include "chrome/browser/ui/simple_message_box.h" |
78 #include "chrome/browser/ui/views/extensions/request_file_system_dialog_view.h" | |
77 #include "components/user_manager/user_manager.h" | 79 #include "components/user_manager/user_manager.h" |
78 #include "extensions/browser/event_router.h" | 80 #include "extensions/browser/event_router.h" |
79 #include "extensions/browser/extension_registry.h" | 81 #include "extensions/browser/extension_registry.h" |
80 #include "extensions/common/constants.h" | 82 #include "extensions/common/constants.h" |
81 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" | 83 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" |
82 #include "url/url_constants.h" | 84 #include "url/url_constants.h" |
83 #endif | 85 #endif |
84 | 86 |
85 using apps::SavedFileEntry; | 87 using apps::SavedFileEntry; |
86 using apps::SavedFilesService; | 88 using apps::SavedFilesService; |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 | 432 |
431 // Short circuit the user consent dialog for tests. This is far from a pretty | 433 // Short circuit the user consent dialog for tests. This is far from a pretty |
432 // code design. | 434 // code design. |
433 if (g_auto_dialog_button_for_test != ui::DIALOG_BUTTON_NONE) { | 435 if (g_auto_dialog_button_for_test != ui::DIALOG_BUTTON_NONE) { |
434 base::ThreadTaskRunnerHandle::Get()->PostTask( | 436 base::ThreadTaskRunnerHandle::Get()->PostTask( |
435 FROM_HERE, | 437 FROM_HERE, |
436 base::Bind(callback, g_auto_dialog_button_for_test /* result */)); | 438 base::Bind(callback, g_auto_dialog_button_for_test /* result */)); |
437 return; | 439 return; |
438 } | 440 } |
439 | 441 |
440 RequestFileSystemDialogView::ShowDialog(web_contents, extension, volume, | 442 // If the volume is gone, then cancel the dialog. |
441 writable, callback); | 443 if (!volume.get()) { |
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() == false) ? volume->volume_label() | |
Peter Kasting
2017/04/27 01:50:33
Discussed this in person :)
ananta
2017/04/27 01:55:16
Done.
| |
452 : volume->volume_id()), | |
453 writable, callback); | |
442 } | 454 } |
443 | 455 |
444 void ConsentProviderDelegate::ShowNotification( | 456 void ConsentProviderDelegate::ShowNotification( |
445 const Extension& extension, | 457 const Extension& extension, |
446 const base::WeakPtr<file_manager::Volume>& volume, | 458 const base::WeakPtr<file_manager::Volume>& volume, |
447 bool writable) { | 459 bool writable) { |
448 RequestFileSystemNotification::ShowAutoGrantedNotification( | 460 RequestFileSystemNotification::ShowAutoGrantedNotification( |
449 profile_, extension, volume, writable); | 461 profile_, extension, volume, writable); |
450 } | 462 } |
451 | 463 |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1421 return RespondNow(Error(kNotSupportedOnNonKioskSessionError)); | 1433 return RespondNow(Error(kNotSupportedOnNonKioskSessionError)); |
1422 std::vector<api::file_system::Volume> result_volume_list; | 1434 std::vector<api::file_system::Volume> result_volume_list; |
1423 FillVolumeList(chrome_details_.GetProfile(), &result_volume_list); | 1435 FillVolumeList(chrome_details_.GetProfile(), &result_volume_list); |
1424 | 1436 |
1425 return RespondNow(ArgumentList( | 1437 return RespondNow(ArgumentList( |
1426 api::file_system::GetVolumeList::Results::Create(result_volume_list))); | 1438 api::file_system::GetVolumeList::Results::Create(result_volume_list))); |
1427 } | 1439 } |
1428 #endif | 1440 #endif |
1429 | 1441 |
1430 } // namespace extensions | 1442 } // namespace extensions |
OLD | NEW |