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 "ui/shell_dialogs/select_file_dialog_win.h" | 5 #include "ui/shell_dialogs/select_file_dialog_win.h" |
6 | 6 |
7 #include <shlobj.h> | 7 #include <shlobj.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 if (!get_save_file_name_impl_.Run(save_as.GetOPENFILENAME())) | 507 if (!get_save_file_name_impl_.Run(save_as.GetOPENFILENAME())) |
508 return false; | 508 return false; |
509 | 509 |
510 // Return the user's choice. | 510 // Return the user's choice. |
511 final_name->assign(save_as.GetOPENFILENAME()->lpstrFile); | 511 final_name->assign(save_as.GetOPENFILENAME()->lpstrFile); |
512 *index = save_as.GetOPENFILENAME()->nFilterIndex; | 512 *index = save_as.GetOPENFILENAME()->nFilterIndex; |
513 | 513 |
514 // Figure out what filter got selected. The filter index is 1-based. | 514 // Figure out what filter got selected. The filter index is 1-based. |
515 std::wstring filter_selected; | 515 std::wstring filter_selected; |
516 if (*index > 0) { | 516 if (*index > 0) { |
517 std::vector<Tuple<base::string16, base::string16>> filters = | 517 std::vector<base::Tuple<base::string16, base::string16>> filters = |
518 ui::win::OpenFileName::GetFilters(save_as.GetOPENFILENAME()); | 518 ui::win::OpenFileName::GetFilters(save_as.GetOPENFILENAME()); |
519 if (*index > filters.size()) | 519 if (*index > filters.size()) |
520 NOTREACHED() << "Invalid filter index."; | 520 NOTREACHED() << "Invalid filter index."; |
521 else | 521 else |
522 filter_selected = get<1>(filters[*index - 1]); | 522 filter_selected = base::get<1>(filters[*index - 1]); |
523 } | 523 } |
524 | 524 |
525 // Get the extension that was suggested to the user (when the Save As dialog | 525 // Get the extension that was suggested to the user (when the Save As dialog |
526 // was opened). For saving web pages, we skip this step since there may be | 526 // was opened). For saving web pages, we skip this step since there may be |
527 // 'extension characters' in the title of the web page. | 527 // 'extension characters' in the title of the web page. |
528 std::wstring suggested_ext; | 528 std::wstring suggested_ext; |
529 if (!ignore_suggested_ext) | 529 if (!ignore_suggested_ext) |
530 suggested_ext = GetExtensionWithoutLeadingDot(suggested_path.Extension()); | 530 suggested_ext = GetExtensionWithoutLeadingDot(suggested_path.Extension()); |
531 | 531 |
532 // If we can't get the extension from the suggested_name, we use the default | 532 // If we can't get the extension from the suggested_name, we use the default |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 SelectFileDialog* CreateDefaultWinSelectFileDialog( | 766 SelectFileDialog* CreateDefaultWinSelectFileDialog( |
767 SelectFileDialog::Listener* listener, | 767 SelectFileDialog::Listener* listener, |
768 SelectFilePolicy* policy) { | 768 SelectFilePolicy* policy) { |
769 return CreateWinSelectFileDialog(listener, | 769 return CreateWinSelectFileDialog(listener, |
770 policy, | 770 policy, |
771 base::Bind(&CallBuiltinGetOpenFileName), | 771 base::Bind(&CallBuiltinGetOpenFileName), |
772 base::Bind(&CallBuiltinGetSaveFileName)); | 772 base::Bind(&CallBuiltinGetSaveFileName)); |
773 } | 773 } |
774 | 774 |
775 } // namespace ui | 775 } // namespace ui |
OLD | NEW |