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/chromeos/extensions/file_browser_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "chrome/browser/ui/browser_window.h" | 38 #include "chrome/browser/ui/browser_window.h" |
39 #include "chrome/browser/ui/views/select_file_dialog_extension.h" | 39 #include "chrome/browser/ui/views/select_file_dialog_extension.h" |
40 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 40 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
41 #include "chrome/common/extensions/extension.h" | 41 #include "chrome/common/extensions/extension.h" |
42 #include "chrome/common/extensions/extension_icon_set.h" | 42 #include "chrome/common/extensions/extension_icon_set.h" |
43 #include "chrome/common/extensions/file_browser_handler.h" | 43 #include "chrome/common/extensions/file_browser_handler.h" |
44 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
45 #include "content/public/browser/child_process_security_policy.h" | 45 #include "content/public/browser/child_process_security_policy.h" |
46 #include "content/public/browser/render_process_host.h" | 46 #include "content/public/browser/render_process_host.h" |
47 #include "content/public/browser/render_view_host.h" | 47 #include "content/public/browser/render_view_host.h" |
48 #include "content/public/common/selected_file_info.h" | |
49 #include "googleurl/src/gurl.h" | 48 #include "googleurl/src/gurl.h" |
50 #include "grit/generated_resources.h" | 49 #include "grit/generated_resources.h" |
51 #include "grit/platform_locale_settings.h" | 50 #include "grit/platform_locale_settings.h" |
52 #include "net/base/escape.h" | 51 #include "net/base/escape.h" |
| 52 #include "ui/base/dialogs/selected_file_info.h" |
53 #include "ui/base/l10n/l10n_util.h" | 53 #include "ui/base/l10n/l10n_util.h" |
54 #include "webkit/fileapi/file_system_context.h" | 54 #include "webkit/fileapi/file_system_context.h" |
55 #include "webkit/fileapi/file_system_file_util.h" | 55 #include "webkit/fileapi/file_system_file_util.h" |
56 #include "webkit/fileapi/file_system_mount_point_provider.h" | 56 #include "webkit/fileapi/file_system_mount_point_provider.h" |
57 #include "webkit/fileapi/file_system_operation_context.h" | 57 #include "webkit/fileapi/file_system_operation_context.h" |
58 #include "webkit/fileapi/file_system_types.h" | 58 #include "webkit/fileapi/file_system_types.h" |
59 #include "webkit/fileapi/file_system_util.h" | 59 #include "webkit/fileapi/file_system_util.h" |
60 | 60 |
61 using chromeos::disks::DiskMountManager; | 61 using chromeos::disks::DiskMountManager; |
62 using content::BrowserContext; | 62 using content::BrowserContext; |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 } | 802 } |
803 | 803 |
804 // GetFileSystemRootPathOnFileThread can only be called from the file thread, | 804 // GetFileSystemRootPathOnFileThread can only be called from the file thread, |
805 // so here we are. This function takes a vector of virtual paths, converts | 805 // so here we are. This function takes a vector of virtual paths, converts |
806 // them to local paths and calls |callback| with the result vector, on the UI | 806 // them to local paths and calls |callback| with the result vector, on the UI |
807 // thread. | 807 // thread. |
808 void FileBrowserFunction::GetLocalPathsOnFileThread( | 808 void FileBrowserFunction::GetLocalPathsOnFileThread( |
809 const UrlList& file_urls, | 809 const UrlList& file_urls, |
810 GetLocalPathsCallback callback) { | 810 GetLocalPathsCallback callback) { |
811 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 811 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
812 std::vector<content::SelectedFileInfo> selected_files; | 812 std::vector<ui::SelectedFileInfo> selected_files; |
813 | 813 |
814 // FilePath(virtual_path) doesn't work on win, so limit this to ChromeOS. | 814 // FilePath(virtual_path) doesn't work on win, so limit this to ChromeOS. |
815 fileapi::ExternalFileSystemMountPointProvider* provider = | 815 fileapi::ExternalFileSystemMountPointProvider* provider = |
816 BrowserContext::GetFileSystemContext(profile_)->external_provider(); | 816 BrowserContext::GetFileSystemContext(profile_)->external_provider(); |
817 if (!provider) { | 817 if (!provider) { |
818 LOG(WARNING) << "External provider is not available"; | 818 LOG(WARNING) << "External provider is not available"; |
819 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 819 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
820 base::Bind(callback, selected_files)); | 820 base::Bind(callback, selected_files)); |
821 return; | 821 return; |
822 } | 822 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 display_name = virtual_path.BaseName().value(); | 883 display_name = virtual_path.BaseName().value(); |
884 } else { | 884 } else { |
885 LOG(WARNING) << "GetLocalPathsOnFileThread failed " | 885 LOG(WARNING) << "GetLocalPathsOnFileThread failed " |
886 << file_url.spec(); | 886 << file_url.spec(); |
887 } | 887 } |
888 | 888 |
889 if (!real_path.empty()) { | 889 if (!real_path.empty()) { |
890 DVLOG(1) << "Selected: real path: " << real_path.value() | 890 DVLOG(1) << "Selected: real path: " << real_path.value() |
891 << " display name: " << display_name; | 891 << " display name: " << display_name; |
892 selected_files.push_back( | 892 selected_files.push_back( |
893 content::SelectedFileInfo(real_path, display_name)); | 893 ui::SelectedFileInfo(real_path, display_name)); |
894 } | 894 } |
895 } | 895 } |
896 | 896 |
897 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 897 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
898 base::Bind(callback, selected_files)); | 898 base::Bind(callback, selected_files)); |
899 } | 899 } |
900 | 900 |
901 bool SelectFileFunction::RunImpl() { | 901 bool SelectFileFunction::RunImpl() { |
902 if (args_->GetSize() != 2) { | 902 if (args_->GetSize() != 2) { |
903 return false; | 903 return false; |
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2345 gdata::GDataSystemService* system_service = | 2345 gdata::GDataSystemService* system_service = |
2346 gdata::GDataSystemServiceFactory::GetForProfile(profile_); | 2346 gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
2347 if (!system_service || !system_service->file_system()) | 2347 if (!system_service || !system_service->file_system()) |
2348 return false; | 2348 return false; |
2349 | 2349 |
2350 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); | 2350 FilePath directory_path = GetVirtualPathFromURL(GURL(file_url_as_string)); |
2351 system_service->file_system()->RequestDirectoryRefresh(directory_path); | 2351 system_service->file_system()->RequestDirectoryRefresh(directory_path); |
2352 | 2352 |
2353 return true; | 2353 return true; |
2354 } | 2354 } |
OLD | NEW |