| 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 11 matching lines...) Expand all Loading... |
| 22 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
| 23 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
| 24 #include "base/strings/sys_string_conversions.h" | 24 #include "base/strings/sys_string_conversions.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 26 #include "base/value_conversions.h" | 26 #include "base/value_conversions.h" |
| 27 #include "base/values.h" | 27 #include "base/values.h" |
| 28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| 29 #include "chrome/browser/extensions/extension_service.h" | 29 #include "chrome/browser/extensions/extension_service.h" |
| 30 #include "chrome/browser/extensions/extension_util.h" | 30 #include "chrome/browser/extensions/extension_util.h" |
| 31 #include "chrome/browser/extensions/path_util.h" | 31 #include "chrome/browser/extensions/path_util.h" |
| 32 #include "chrome/browser/platform_util.h" | |
| 33 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 34 #include "chrome/browser/ui/apps/directory_access_confirmation_dialog.h" | 33 #include "chrome/browser/ui/apps/directory_access_confirmation_dialog.h" |
| 35 #include "chrome/browser/ui/chrome_select_file_policy.h" | 34 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 36 #include "chrome/common/chrome_paths.h" | 35 #include "chrome/common/chrome_paths.h" |
| 37 #include "chrome/common/extensions/api/file_system.h" | 36 #include "chrome/common/extensions/api/file_system.h" |
| 38 #include "chrome/grit/generated_resources.h" | 37 #include "chrome/grit/generated_resources.h" |
| 39 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/child_process_security_policy.h" | 39 #include "content/public/browser/child_process_security_policy.h" |
| 41 #include "content/public/browser/render_frame_host.h" | 40 #include "content/public/browser/render_frame_host.h" |
| 42 #include "content/public/browser/render_process_host.h" | 41 #include "content/public/browser/render_process_host.h" |
| 43 #include "content/public/browser/storage_partition.h" | 42 #include "content/public/browser/storage_partition.h" |
| 44 #include "content/public/browser/web_contents.h" | 43 #include "content/public/browser/web_contents.h" |
| 45 #include "extensions/browser/api/file_handlers/app_file_handler_util.h" | 44 #include "extensions/browser/api/file_handlers/app_file_handler_util.h" |
| 46 #include "extensions/browser/app_window/app_window.h" | 45 #include "extensions/browser/app_window/app_window.h" |
| 47 #include "extensions/browser/app_window/app_window_registry.h" | 46 #include "extensions/browser/app_window/app_window_registry.h" |
| 48 #include "extensions/browser/extension_prefs.h" | 47 #include "extensions/browser/extension_prefs.h" |
| 49 #include "extensions/browser/extension_system.h" | 48 #include "extensions/browser/extension_system.h" |
| 50 #include "extensions/browser/granted_file_entry.h" | 49 #include "extensions/browser/granted_file_entry.h" |
| 51 #include "extensions/common/permissions/api_permission.h" | 50 #include "extensions/common/permissions/api_permission.h" |
| 52 #include "extensions/common/permissions/permissions_data.h" | 51 #include "extensions/common/permissions/permissions_data.h" |
| 53 #include "net/base/mime_util.h" | 52 #include "net/base/mime_util.h" |
| 54 #include "storage/browser/fileapi/external_mount_points.h" | 53 #include "storage/browser/fileapi/external_mount_points.h" |
| 55 #include "storage/browser/fileapi/file_system_operation_runner.h" | 54 #include "storage/browser/fileapi/file_system_operation_runner.h" |
| 56 #include "storage/browser/fileapi/isolated_context.h" | 55 #include "storage/browser/fileapi/isolated_context.h" |
| 57 #include "storage/common/fileapi/file_system_types.h" | 56 #include "storage/common/fileapi/file_system_types.h" |
| 58 #include "storage/common/fileapi/file_system_util.h" | 57 #include "storage/common/fileapi/file_system_util.h" |
| 59 #include "ui/base/l10n/l10n_util.h" | 58 #include "ui/base/l10n/l10n_util.h" |
| 59 #include "ui/gfx/view_util.h" |
| 60 #include "ui/shell_dialogs/select_file_dialog.h" | 60 #include "ui/shell_dialogs/select_file_dialog.h" |
| 61 #include "ui/shell_dialogs/selected_file_info.h" | 61 #include "ui/shell_dialogs/selected_file_info.h" |
| 62 | 62 |
| 63 #if defined(OS_MACOSX) | 63 #if defined(OS_MACOSX) |
| 64 #include <CoreFoundation/CoreFoundation.h> | 64 #include <CoreFoundation/CoreFoundation.h> |
| 65 #include "base/mac/foundation_util.h" | 65 #include "base/mac/foundation_util.h" |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
| 69 #include "base/strings/string16.h" | 69 #include "base/strings/string16.h" |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 : public ui::SelectFileDialog::Listener { | 639 : public ui::SelectFileDialog::Listener { |
| 640 public: | 640 public: |
| 641 FilePicker(FileSystemChooseEntryFunction* function, | 641 FilePicker(FileSystemChooseEntryFunction* function, |
| 642 content::WebContents* web_contents, | 642 content::WebContents* web_contents, |
| 643 const base::FilePath& suggested_name, | 643 const base::FilePath& suggested_name, |
| 644 const ui::SelectFileDialog::FileTypeInfo& file_type_info, | 644 const ui::SelectFileDialog::FileTypeInfo& file_type_info, |
| 645 ui::SelectFileDialog::Type picker_type) | 645 ui::SelectFileDialog::Type picker_type) |
| 646 : function_(function) { | 646 : function_(function) { |
| 647 select_file_dialog_ = ui::SelectFileDialog::Create( | 647 select_file_dialog_ = ui::SelectFileDialog::Create( |
| 648 this, new ChromeSelectFilePolicy(web_contents)); | 648 this, new ChromeSelectFilePolicy(web_contents)); |
| 649 gfx::NativeWindow owning_window = web_contents ? | 649 gfx::NativeWindow owning_window = |
| 650 platform_util::GetTopLevel(web_contents->GetNativeView()) : | 650 web_contents ? gfx::GetTopLevel(web_contents->GetNativeView()) : NULL; |
| 651 NULL; | |
| 652 | 651 |
| 653 if (g_skip_picker_for_test) { | 652 if (g_skip_picker_for_test) { |
| 654 if (g_use_suggested_path_for_test) { | 653 if (g_use_suggested_path_for_test) { |
| 655 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 654 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 656 base::Bind( | 655 base::Bind( |
| 657 &FileSystemChooseEntryFunction::FilePicker::FileSelected, | 656 &FileSystemChooseEntryFunction::FilePicker::FileSelected, |
| 658 base::Unretained(this), suggested_name, 1, | 657 base::Unretained(this), suggested_name, 1, |
| 659 static_cast<void*>(NULL))); | 658 static_cast<void*>(NULL))); |
| 660 } else if (g_path_to_be_picked_for_test) { | 659 } else if (g_path_to_be_picked_for_test) { |
| 661 content::BrowserThread::PostTask( | 660 content::BrowserThread::PostTask( |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 return RespondNow(Error(kNotSupportedOnNonKioskSessionError)); | 1435 return RespondNow(Error(kNotSupportedOnNonKioskSessionError)); |
| 1437 std::vector<api::file_system::Volume> result_volume_list; | 1436 std::vector<api::file_system::Volume> result_volume_list; |
| 1438 FillVolumeList(chrome_details_.GetProfile(), &result_volume_list); | 1437 FillVolumeList(chrome_details_.GetProfile(), &result_volume_list); |
| 1439 | 1438 |
| 1440 return RespondNow(ArgumentList( | 1439 return RespondNow(ArgumentList( |
| 1441 api::file_system::GetVolumeList::Results::Create(result_volume_list))); | 1440 api::file_system::GetVolumeList::Results::Create(result_volume_list))); |
| 1442 } | 1441 } |
| 1443 #endif | 1442 #endif |
| 1444 | 1443 |
| 1445 } // namespace extensions | 1444 } // namespace extensions |
| OLD | NEW |