OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_manager/private_api_dialog.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_dialog.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 7 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
8 #include "chrome/browser/ui/views/select_file_dialog_extension.h" | 8 #include "chrome/browser/ui/views/select_file_dialog_extension.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "ui/shell_dialogs/selected_file_info.h" | 10 #include "ui/shell_dialogs/selected_file_info.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 bool SelectFileFunction::RunImpl() { | 35 bool SelectFileFunction::RunImpl() { |
36 if (args_->GetSize() != 4) { | 36 if (args_->GetSize() != 4) { |
37 return false; | 37 return false; |
38 } | 38 } |
39 std::string file_url; | 39 std::string file_url; |
40 args_->GetString(0, &file_url); | 40 args_->GetString(0, &file_url); |
41 std::vector<GURL> file_paths; | 41 std::vector<GURL> file_paths; |
42 file_paths.push_back(GURL(file_url)); | 42 file_paths.push_back(GURL(file_url)); |
43 bool for_opening = false; | 43 bool for_opening = false; |
44 args_->GetBoolean(2, &for_opening); | 44 args_->GetBoolean(2, &for_opening); |
| 45 bool need_local_path = false; |
| 46 args_->GetBoolean(3, &need_local_path); |
45 | 47 |
46 util::GetSelectedFileInfo( | 48 util::GetSelectedFileInfo( |
47 render_view_host(), | 49 render_view_host(), |
48 profile(), | 50 profile(), |
49 file_paths, | 51 file_paths, |
50 for_opening, | 52 for_opening, |
| 53 need_local_path, |
51 base::Bind(&SelectFileFunction::GetSelectedFileInfoResponse, this)); | 54 base::Bind(&SelectFileFunction::GetSelectedFileInfoResponse, this)); |
52 return true; | 55 return true; |
53 } | 56 } |
54 | 57 |
55 void SelectFileFunction::GetSelectedFileInfoResponse( | 58 void SelectFileFunction::GetSelectedFileInfoResponse( |
56 const std::vector<ui::SelectedFileInfo>& files) { | 59 const std::vector<ui::SelectedFileInfo>& files) { |
57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
58 if (files.size() != 1) { | 61 if (files.size() != 1) { |
59 SendResponse(false); | 62 SendResponse(false); |
60 return; | 63 return; |
(...skipping 22 matching lines...) Expand all Loading... |
83 | 86 |
84 std::string virtual_path; | 87 std::string virtual_path; |
85 size_t len = path_list->GetSize(); | 88 size_t len = path_list->GetSize(); |
86 std::vector<GURL> file_urls; | 89 std::vector<GURL> file_urls; |
87 file_urls.reserve(len); | 90 file_urls.reserve(len); |
88 for (size_t i = 0; i < len; ++i) { | 91 for (size_t i = 0; i < len; ++i) { |
89 path_list->GetString(i, &virtual_path); | 92 path_list->GetString(i, &virtual_path); |
90 file_urls.push_back(GURL(virtual_path)); | 93 file_urls.push_back(GURL(virtual_path)); |
91 } | 94 } |
92 | 95 |
| 96 bool need_local_path = false; |
| 97 args_->GetBoolean(1, &need_local_path); |
| 98 |
93 util::GetSelectedFileInfo( | 99 util::GetSelectedFileInfo( |
94 render_view_host(), | 100 render_view_host(), |
95 profile(), | 101 profile(), |
96 file_urls, | 102 file_urls, |
97 true, // for_opening | 103 true, // for_opening |
| 104 need_local_path, |
98 base::Bind(&SelectFilesFunction::GetSelectedFileInfoResponse, this)); | 105 base::Bind(&SelectFilesFunction::GetSelectedFileInfoResponse, this)); |
99 return true; | 106 return true; |
100 } | 107 } |
101 | 108 |
102 void SelectFilesFunction::GetSelectedFileInfoResponse( | 109 void SelectFilesFunction::GetSelectedFileInfoResponse( |
103 const std::vector<ui::SelectedFileInfo>& files) { | 110 const std::vector<ui::SelectedFileInfo>& files) { |
104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 111 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
105 int32 tab_id = util::GetTabId(dispatcher()); | 112 int32 tab_id = util::GetTabId(dispatcher()); |
106 SelectFileDialogExtension::OnMultiFilesSelected(tab_id, files); | 113 SelectFileDialogExtension::OnMultiFilesSelected(tab_id, files); |
107 SendResponse(true); | 114 SendResponse(true); |
108 } | 115 } |
109 | 116 |
110 } // namespace file_manager | 117 } // namespace file_manager |
OLD | NEW |