Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/gfx/skia_utils.h" | 9 #include "base/gfx/skia_utils.h" |
| 10 #include "chrome/app/locales/locale_settings.h" | 10 #include "chrome/app/locales/locale_settings.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_folder_tree_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_folder_tree_model.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_html_writer.h" | 12 #include "chrome/browser/bookmarks/bookmark_html_writer.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model.h" | 13 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_table_model.h" | 14 #include "chrome/browser/bookmarks/bookmark_table_model.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_utils.h" | 15 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 16 #include "chrome/browser/browser_list.h" | 16 #include "chrome/browser/browser_list.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/importer/importer.h" | 18 #include "chrome/browser/importer/importer.h" |
| 19 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" |
| 20 #include "chrome/browser/user_metrics.h" | 20 #include "chrome/browser/user_metrics.h" |
| 21 #include "chrome/browser/views/bookmark_editor_view.h" | 21 #include "chrome/browser/views/bookmark_editor_view.h" |
| 22 #include "chrome/browser/views/bookmark_folder_tree_view.h" | 22 #include "chrome/browser/views/bookmark_folder_tree_view.h" |
| 23 #include "chrome/browser/views/bookmark_table_view.h" | 23 #include "chrome/browser/views/bookmark_table_view.h" |
| 24 #include "chrome/browser/views/standard_layout.h" | 24 #include "chrome/browser/views/standard_layout.h" |
| 25 #include "chrome/common/gfx/chrome_canvas.h" | 25 #include "chrome/common/gfx/chrome_canvas.h" |
| 26 #include "chrome/common/gfx/color_utils.h" | 26 #include "chrome/common/gfx/color_utils.h" |
| 27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/pref_service.h" | 28 #include "chrome/common/pref_service.h" |
| 29 #include "chrome/common/win_util.h" | |
| 29 #include "chrome/views/container_win.h" | 30 #include "chrome/views/container_win.h" |
| 30 #include "chrome/views/grid_layout.h" | 31 #include "chrome/views/grid_layout.h" |
| 31 #include "chrome/views/menu_button.h" | 32 #include "chrome/views/menu_button.h" |
| 32 #include "chrome/views/single_split_view.h" | 33 #include "chrome/views/single_split_view.h" |
| 33 #include "chrome/views/window.h" | 34 #include "chrome/views/window.h" |
| 34 | 35 |
| 35 #include "generated_resources.h" | 36 #include "generated_resources.h" |
| 36 | 37 |
| 37 // If non-null, there is an open editor and this is the window it is contained | 38 // If non-null, there is an open editor and this is the window it is contained |
| 38 // in it. | 39 // in it. |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 676 menu.AppendMenuItemWithLabel( | 677 menu.AppendMenuItemWithLabel( |
| 677 IDS_BOOKMARK_MANAGER_IMPORT_MENU, | 678 IDS_BOOKMARK_MANAGER_IMPORT_MENU, |
| 678 l10n_util::GetString(IDS_BOOKMARK_MANAGER_IMPORT_MENU)); | 679 l10n_util::GetString(IDS_BOOKMARK_MANAGER_IMPORT_MENU)); |
| 679 menu.AppendMenuItemWithLabel( | 680 menu.AppendMenuItemWithLabel( |
| 680 IDS_BOOKMARK_MANAGER_EXPORT_MENU, | 681 IDS_BOOKMARK_MANAGER_EXPORT_MENU, |
| 681 l10n_util::GetString(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); | 682 l10n_util::GetString(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); |
| 682 menu.RunMenuAt(GetContainer()->GetHWND(), gfx::Rect(x, y, 0, 0), | 683 menu.RunMenuAt(GetContainer()->GetHWND(), gfx::Rect(x, y, 0, 0), |
| 683 views::MenuItemView::TOPLEFT, true); | 684 views::MenuItemView::TOPLEFT, true); |
| 684 } | 685 } |
| 685 | 686 |
| 687 // The filter used when opening a file. | |
| 688 // TODO(sky): need a textual description here once we can add new | |
| 689 // strings. | |
| 690 static const wchar_t filter_c_str[] = L"*.html\0*.html\0"; | |
|
M-A Ruel
2008/11/12 17:28:02
Can you just name it kFilterStr so it's clear it's
| |
| 691 | |
| 686 void BookmarkManagerView::ShowImportBookmarksFileChooser() { | 692 void BookmarkManagerView::ShowImportBookmarksFileChooser() { |
| 687 if (select_file_dialog_.get()) | 693 if (select_file_dialog_.get()) |
| 688 select_file_dialog_->ListenerDestroyed(); | 694 select_file_dialog_->ListenerDestroyed(); |
| 689 | 695 |
| 690 // TODO(sky): need a textual description here once we can add new | |
| 691 // strings. | |
| 692 const wchar_t filter_c_str[] = L"*.html\0*.html\0\0\0"; | |
| 693 std::wstring filter_string(filter_c_str, arraysize(filter_c_str)); | 696 std::wstring filter_string(filter_c_str, arraysize(filter_c_str)); |
| 694 select_file_dialog_ = SelectFileDialog::Create(this); | 697 select_file_dialog_ = SelectFileDialog::Create(this); |
| 695 select_file_dialog_->SelectFile( | 698 select_file_dialog_->SelectFile( |
| 696 SelectFileDialog::SELECT_OPEN_FILE, std::wstring(), std::wstring(), | 699 SelectFileDialog::SELECT_OPEN_FILE, std::wstring(), L"bookmarks.html", |
| 697 filter_string, GetContainer()->GetHWND(), | 700 filter_string, std::wstring(), GetContainer()->GetHWND(), |
| 698 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_IMPORT_MENU)); | 701 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_IMPORT_MENU)); |
| 699 } | 702 } |
| 700 | 703 |
| 701 void BookmarkManagerView::ShowExportBookmarksFileChooser() { | 704 void BookmarkManagerView::ShowExportBookmarksFileChooser() { |
| 702 if (select_file_dialog_.get()) | 705 if (select_file_dialog_.get()) |
| 703 select_file_dialog_->ListenerDestroyed(); | 706 select_file_dialog_->ListenerDestroyed(); |
| 704 | 707 |
| 705 select_file_dialog_ = SelectFileDialog::Create(this); | 708 select_file_dialog_ = SelectFileDialog::Create(this); |
| 706 select_file_dialog_->SelectFile( | 709 select_file_dialog_->SelectFile( |
| 707 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), std::wstring(), | 710 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), L"bookmarks.html", |
| 708 std::wstring(), GetContainer()->GetHWND(), | 711 win_util::GetFileFilterFromPath(L"bookmarks.html"), L"html", |
| 712 GetContainer()->GetHWND(), | |
| 709 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); | 713 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); |
| 710 } | 714 } |
| OLD | NEW |