OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/filebrowse_ui.h" | 5 #include "chrome/browser/dom_ui/filebrowse_ui.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 if (lister_.get()) { | 816 if (lister_.get()) { |
817 lister_->Cancel(); | 817 lister_->Cancel(); |
818 lister_->set_delegate(NULL); | 818 lister_->set_delegate(NULL); |
819 lister_ = NULL; | 819 lister_ = NULL; |
820 } | 820 } |
821 | 821 |
822 is_refresh_ = is_refresh; | 822 is_refresh_ = is_refresh; |
823 | 823 |
824 #if defined(OS_CHROMEOS) | 824 #if defined(OS_CHROMEOS) |
825 // Don't allow listing files in inaccessible dirs. | 825 // Don't allow listing files in inaccessible dirs. |
826 if (URLRequestFileJob::AccessDisabled(path)) | 826 if (net::URLRequestFileJob::AccessDisabled(path)) |
827 return; | 827 return; |
828 #endif // OS_CHROMEOS | 828 #endif // OS_CHROMEOS |
829 | 829 |
830 FilePath default_download_path; | 830 FilePath default_download_path; |
831 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, | 831 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, |
832 &default_download_path)) { | 832 &default_download_path)) { |
833 NOTREACHED(); | 833 NOTREACHED(); |
834 } | 834 } |
835 if (currentpath_ == default_download_path) { | 835 if (currentpath_ == default_download_path) { |
836 lister_ = new net::DirectoryLister(currentpath_, | 836 lister_ = new net::DirectoryLister(currentpath_, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 BrowserThread::UI, FROM_HERE, | 964 BrowserThread::UI, FROM_HERE, |
965 NewRunnableMethod(current_task_, &TaskProxy::FireCopyCompleteProxy)); | 965 NewRunnableMethod(current_task_, &TaskProxy::FireCopyCompleteProxy)); |
966 } | 966 } |
967 | 967 |
968 void FilebrowseHandler::HandleDeleteFile(const ListValue* args) { | 968 void FilebrowseHandler::HandleDeleteFile(const ListValue* args) { |
969 #if defined(OS_CHROMEOS) | 969 #if defined(OS_CHROMEOS) |
970 std::string path = WideToUTF8(ExtractStringValue(args)); | 970 std::string path = WideToUTF8(ExtractStringValue(args)); |
971 FilePath currentpath(path); | 971 FilePath currentpath(path); |
972 | 972 |
973 // Don't allow file deletion in inaccessible dirs. | 973 // Don't allow file deletion in inaccessible dirs. |
974 if (URLRequestFileJob::AccessDisabled(currentpath)) | 974 if (net::URLRequestFileJob::AccessDisabled(currentpath)) |
975 return; | 975 return; |
976 | 976 |
977 for (unsigned int x = 0; x < active_download_items_.size(); x++) { | 977 for (unsigned int x = 0; x < active_download_items_.size(); x++) { |
978 FilePath item = active_download_items_[x]->full_path(); | 978 FilePath item = active_download_items_[x]->full_path(); |
979 if (item == currentpath) { | 979 if (item == currentpath) { |
980 active_download_items_[x]->Cancel(true); | 980 active_download_items_[x]->Cancel(true); |
981 active_download_items_[x]->Remove(true); | 981 active_download_items_[x]->Remove(true); |
982 FilePath dir_path = item.DirName(); | 982 FilePath dir_path = item.DirName(); |
983 GetChildrenForPath(dir_path, true); | 983 GetChildrenForPath(dir_path, true); |
984 return; | 984 return; |
(...skipping 16 matching lines...) Expand all Loading... |
1001 std::string src; | 1001 std::string src; |
1002 std::string dest; | 1002 std::string dest; |
1003 | 1003 |
1004 // Get path string. | 1004 // Get path string. |
1005 if (list_value->GetString(0, &src) && | 1005 if (list_value->GetString(0, &src) && |
1006 list_value->GetString(1, &dest)) { | 1006 list_value->GetString(1, &dest)) { |
1007 FilePath SrcPath = FilePath(src); | 1007 FilePath SrcPath = FilePath(src); |
1008 FilePath DestPath = FilePath(dest); | 1008 FilePath DestPath = FilePath(dest); |
1009 | 1009 |
1010 // Don't allow file copy to inaccessible dirs. | 1010 // Don't allow file copy to inaccessible dirs. |
1011 if (URLRequestFileJob::AccessDisabled(DestPath)) | 1011 if (net::URLRequestFileJob::AccessDisabled(DestPath)) |
1012 return; | 1012 return; |
1013 | 1013 |
1014 TaskProxy* task = new TaskProxy(AsWeakPtr(), SrcPath, DestPath); | 1014 TaskProxy* task = new TaskProxy(AsWeakPtr(), SrcPath, DestPath); |
1015 task->AddRef(); | 1015 task->AddRef(); |
1016 current_task_ = task; | 1016 current_task_ = task; |
1017 BrowserThread::PostTask( | 1017 BrowserThread::PostTask( |
1018 BrowserThread::FILE, FROM_HERE, | 1018 BrowserThread::FILE, FROM_HERE, |
1019 NewRunnableMethod( | 1019 NewRunnableMethod( |
1020 task, &TaskProxy::CopyFileProxy)); | 1020 task, &TaskProxy::CopyFileProxy)); |
1021 } else { | 1021 } else { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 } | 1204 } |
1205 } | 1205 } |
1206 | 1206 |
1207 return NULL; | 1207 return NULL; |
1208 } | 1208 } |
1209 | 1209 |
1210 const int FileBrowseUI::kPopupWidth = 250; | 1210 const int FileBrowseUI::kPopupWidth = 250; |
1211 const int FileBrowseUI::kPopupHeight = 300; | 1211 const int FileBrowseUI::kPopupHeight = 300; |
1212 const int FileBrowseUI::kSmallPopupWidth = 250; | 1212 const int FileBrowseUI::kSmallPopupWidth = 250; |
1213 const int FileBrowseUI::kSmallPopupHeight = 50; | 1213 const int FileBrowseUI::kSmallPopupHeight = 50; |
OLD | NEW |