| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/bookmark_manager_view.h" | 5 #include "chrome/browser/views/bookmark_manager_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/thread.h" | 9 #include "base/thread.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_folder_tree_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_folder_tree_model.h" |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 UILayoutIsRightToLeft() ? views::MenuItemView::TOPRIGHT : | 709 UILayoutIsRightToLeft() ? views::MenuItemView::TOPRIGHT : |
| 710 views::MenuItemView::TOPLEFT; | 710 views::MenuItemView::TOPLEFT; |
| 711 menu.RunMenuAt(GetWidget()->GetNativeView(), gfx::Rect(x, y, 0, 0), anchor, | 711 menu.RunMenuAt(GetWidget()->GetNativeView(), gfx::Rect(x, y, 0, 0), anchor, |
| 712 true); | 712 true); |
| 713 } | 713 } |
| 714 | 714 |
| 715 void BookmarkManagerView::ShowImportBookmarksFileChooser() { | 715 void BookmarkManagerView::ShowImportBookmarksFileChooser() { |
| 716 if (select_file_dialog_.get()) | 716 if (select_file_dialog_.get()) |
| 717 select_file_dialog_->ListenerDestroyed(); | 717 select_file_dialog_->ListenerDestroyed(); |
| 718 | 718 |
| 719 std::wstring filter_string = | 719 SelectFileDialog::FileTypeInfo file_type_info; |
| 720 win_util::GetFileFilterFromExtensions(L"*.html;*.htm", true); | 720 file_type_info.extensions.resize(1); |
| 721 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); |
| 722 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("htm")); |
| 723 file_type_info.include_all_files = true; |
| 721 select_file_dialog_ = SelectFileDialog::Create(this); | 724 select_file_dialog_ = SelectFileDialog::Create(this); |
| 722 select_file_dialog_->SelectFile( | 725 select_file_dialog_->SelectFile( |
| 723 SelectFileDialog::SELECT_OPEN_FILE, std::wstring(), | 726 SelectFileDialog::SELECT_OPEN_FILE, std::wstring(), |
| 724 FilePath(FILE_PATH_LITERAL("bookmarks.html")), filter_string, 0, | 727 FilePath(FILE_PATH_LITERAL("bookmarks.html")), &file_type_info, 0, |
| 725 std::wstring(), | 728 std::wstring(), GetWidget()->GetNativeView(), |
| 726 GetWidget()->GetNativeView(), | |
| 727 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_IMPORT_MENU)); | 729 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_IMPORT_MENU)); |
| 728 } | 730 } |
| 729 | 731 |
| 730 void BookmarkManagerView::ShowExportBookmarksFileChooser() { | 732 void BookmarkManagerView::ShowExportBookmarksFileChooser() { |
| 731 if (select_file_dialog_.get()) | 733 if (select_file_dialog_.get()) |
| 732 select_file_dialog_->ListenerDestroyed(); | 734 select_file_dialog_->ListenerDestroyed(); |
| 733 | 735 |
| 736 SelectFileDialog::FileTypeInfo file_type_info; |
| 737 file_type_info.extensions.resize(1); |
| 738 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); |
| 739 file_type_info.include_all_files = true; |
| 734 select_file_dialog_ = SelectFileDialog::Create(this); | 740 select_file_dialog_ = SelectFileDialog::Create(this); |
| 735 select_file_dialog_->SelectFile( | 741 select_file_dialog_->SelectFile( |
| 736 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), | 742 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), |
| 737 FilePath(FILE_PATH_LITERAL("bookmarks.html")), | 743 FilePath(FILE_PATH_LITERAL("bookmarks.html")), &file_type_info, 0, |
| 738 win_util::GetFileFilterFromPath(L"bookmarks.html"), 0, L"html", | 744 L"html", GetWidget()->GetNativeView(), |
| 739 GetWidget()->GetNativeView(), | |
| 740 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); | 745 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); |
| 741 } | 746 } |
| OLD | NEW |