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