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/ui/views/select_file_dialog_extension.h" | 5 #include "chrome/browser/ui/views/select_file_dialog_extension.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // possible. If there is no tab contents use a tab_id of 0. A dialog without | 306 // possible. If there is no tab contents use a tab_id of 0. A dialog without |
307 // an associated tab contents will be shown fully screen; only one at a time | 307 // an associated tab contents will be shown fully screen; only one at a time |
308 // is allowed in this state. | 308 // is allowed in this state. |
309 int32 tab_id = tab ? tab->restore_tab_helper()->session_id().id() : 0; | 309 int32 tab_id = tab ? tab->restore_tab_helper()->session_id().id() : 0; |
310 if (PendingExists(tab_id)) { | 310 if (PendingExists(tab_id)) { |
311 DLOG(WARNING) << "Pending dialog exists with id " << tab_id; | 311 DLOG(WARNING) << "Pending dialog exists with id " << tab_id; |
312 return; | 312 return; |
313 } | 313 } |
314 | 314 |
315 FilePath virtual_path; | 315 FilePath virtual_path; |
316 if (!file_manager_util::ConvertFileToRelativeFileSystemPath( | 316 if (file_manager_util::ConvertFileToRelativeFileSystemPath( |
317 profile_, default_path, &virtual_path)) { | 317 profile_, default_path, &virtual_path)) { |
| 318 virtual_path = FilePath("/").Append(virtual_path); |
| 319 } else { |
318 virtual_path = default_path.BaseName(); | 320 virtual_path = default_path.BaseName(); |
319 } | 321 } |
320 | 322 |
321 has_multiple_file_type_choices_ = | 323 has_multiple_file_type_choices_ = |
322 file_types ? file_types->extensions.size() > 1 : true; | 324 file_types ? file_types->extensions.size() > 1 : true; |
323 | 325 |
324 GURL file_browser_url = file_manager_util::GetFileBrowserUrlWithParams( | 326 GURL file_browser_url = file_manager_util::GetFileBrowserUrlWithParams( |
325 type, title, virtual_path, file_types, file_type_index, | 327 type, title, virtual_path, file_types, file_type_index, |
326 default_extension); | 328 default_extension); |
327 | 329 |
(...skipping 13 matching lines...) Expand all Loading... |
341 } | 343 } |
342 | 344 |
343 // Connect our listener to FileDialogFunction's per-tab callbacks. | 345 // Connect our listener to FileDialogFunction's per-tab callbacks. |
344 AddPending(tab_id); | 346 AddPending(tab_id); |
345 | 347 |
346 extension_dialog_ = dialog; | 348 extension_dialog_ = dialog; |
347 params_ = params; | 349 params_ = params; |
348 tab_id_ = tab_id; | 350 tab_id_ = tab_id; |
349 owner_window_ = owner_window; | 351 owner_window_ = owner_window; |
350 } | 352 } |
OLD | NEW |