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/select_file_dialog_extension.h" | 5 #include "chrome/browser/ui/views/select_file_dialog_extension.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 "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "chrome/browser/extensions/extension_file_browser_private_api.h" | 10 #include "chrome/browser/extensions/extension_file_browser_private_api.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 TabContentsWrapper* tab = owner_browser->GetSelectedTabContentsWrapper(); | 209 TabContentsWrapper* tab = owner_browser->GetSelectedTabContentsWrapper(); |
210 | 210 |
211 // Check if we have another dialog opened in the tab. It's unlikely, but | 211 // Check if we have another dialog opened in the tab. It's unlikely, but |
212 // possible. | 212 // possible. |
213 int32 tab_id = tab ? tab->restore_tab_helper()->session_id().id() : 0; | 213 int32 tab_id = tab ? tab->restore_tab_helper()->session_id().id() : 0; |
214 if (PendingExists(tab_id)) | 214 if (PendingExists(tab_id)) |
215 return; | 215 return; |
216 | 216 |
217 FilePath virtual_path; | 217 FilePath virtual_path; |
218 if (!FileManagerUtil::ConvertFileToRelativeFileSystemPath( | 218 if (!file_manager_util::ConvertFileToRelativeFileSystemPath( |
219 owner_browser->profile(), default_path, &virtual_path)) { | 219 owner_browser->profile(), default_path, &virtual_path)) { |
220 virtual_path = default_path.BaseName(); | 220 virtual_path = default_path.BaseName(); |
221 } | 221 } |
222 | 222 |
223 hasMultipleFileTypeChoices_ = | 223 hasMultipleFileTypeChoices_ = |
224 file_types ? file_types->extensions.size() > 1 : true; | 224 file_types ? file_types->extensions.size() > 1 : true; |
225 | 225 |
226 GURL file_browser_url = FileManagerUtil::GetFileBrowserUrlWithParams( | 226 GURL file_browser_url = file_manager_util::GetFileBrowserUrlWithParams( |
227 type, title, virtual_path, file_types, file_type_index, | 227 type, title, virtual_path, file_types, file_type_index, |
228 default_extension); | 228 default_extension); |
229 | 229 |
230 ExtensionDialog* dialog = ExtensionDialog::Show(file_browser_url, | 230 ExtensionDialog* dialog = ExtensionDialog::Show(file_browser_url, |
231 owner_browser, tab->tab_contents(), | 231 owner_browser, tab->tab_contents(), |
232 kFileManagerWidth, kFileManagerHeight, | 232 kFileManagerWidth, kFileManagerHeight, |
233 this /* ExtensionDialog::Observer */); | 233 this /* ExtensionDialog::Observer */); |
234 if (!dialog) { | 234 if (!dialog) { |
235 LOG(ERROR) << "Unable to create extension dialog"; | 235 LOG(ERROR) << "Unable to create extension dialog"; |
236 return; | 236 return; |
237 } | 237 } |
238 | 238 |
239 // Connect our listener to FileDialogFunction's per-tab callbacks. | 239 // Connect our listener to FileDialogFunction's per-tab callbacks. |
240 AddPending(tab_id); | 240 AddPending(tab_id); |
241 | 241 |
242 extension_dialog_ = dialog; | 242 extension_dialog_ = dialog; |
243 params_ = params; | 243 params_ = params; |
244 tab_id_ = tab_id; | 244 tab_id_ = tab_id; |
245 owner_window_ = owner_window; | 245 owner_window_ = owner_window; |
246 } | 246 } |
OLD | NEW |