OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/file_manager_dialog.h" | 5 #include "chrome/browser/ui/views/file_manager_dialog.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "chrome/browser/extensions/extension_file_browser_private_api.h" | 9 #include "chrome/browser/extensions/extension_file_browser_private_api.h" |
10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 NOTREACHED() << "Can't find owning browser"; | 175 NOTREACHED() << "Can't find owning browser"; |
176 return; | 176 return; |
177 } | 177 } |
178 | 178 |
179 FilePath virtual_path; | 179 FilePath virtual_path; |
180 if (!FileManagerUtil::ConvertFileToRelativeFileSystemPath( | 180 if (!FileManagerUtil::ConvertFileToRelativeFileSystemPath( |
181 owner_browser->profile(), default_path, &virtual_path)) { | 181 owner_browser->profile(), default_path, &virtual_path)) { |
182 virtual_path = FilePath(); | 182 virtual_path = FilePath(); |
183 } | 183 } |
184 | 184 |
185 GURL file_browser_url = FileManagerUtil::GetFileBrowserUrlWithParams( | |
186 type, title, virtual_path, file_types, file_type_index, | |
187 default_extension); | |
188 extension_dialog_ = ExtensionDialog::Show(file_browser_url, | |
189 owner_browser, kFileManagerWidth, kFileManagerHeight, | |
190 this /* ExtensionDialog::Observer */); | |
191 | |
192 // Connect our listener to FileDialogFunction's per-tab callbacks. | 185 // Connect our listener to FileDialogFunction's per-tab callbacks. |
193 TabContentsWrapper* tab = owner_browser->GetSelectedTabContentsWrapper(); | 186 TabContentsWrapper* tab = owner_browser->GetSelectedTabContentsWrapper(); |
194 int32 tab_id = (tab ? tab->restore_tab_helper()->session_id().id() : 0); | 187 int32 tab_id = (tab ? tab->restore_tab_helper()->session_id().id() : 0); |
195 PendingDialog::Add(tab_id, this); | 188 PendingDialog::Add(tab_id, this); |
196 | 189 |
| 190 GURL file_browser_url = FileManagerUtil::GetFileBrowserUrlWithParams( |
| 191 type, title, virtual_path, file_types, file_type_index, |
| 192 default_extension); |
| 193 extension_dialog_ = ExtensionDialog::Show(file_browser_url, |
| 194 owner_browser, tab->tab_contents(), |
| 195 kFileManagerWidth, kFileManagerHeight, |
| 196 this /* ExtensionDialog::Observer */); |
| 197 |
197 params_ = params; | 198 params_ = params; |
198 tab_id_ = tab_id; | 199 tab_id_ = tab_id; |
199 owner_window_ = owner_window; | 200 owner_window_ = owner_window; |
200 } | 201 } |
OLD | NEW |