summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/bookmark_manager_view.cc
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 22:10:20 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 22:10:20 +0000
commit39a248b002d0f41ad816754bb2833eea0aff9c61 (patch)
tree2b3c12b82e8ba1779f3b5cf0b6e1783bb357c8bb /chrome/browser/views/bookmark_manager_view.cc
parentfe60fbbb329988a1b4eab5fcc78faaad719cda1b (diff)
downloadchromium_src-39a248b002d0f41ad816754bb2833eea0aff9c61.zip
chromium_src-39a248b002d0f41ad816754bb2833eea0aff9c61.tar.gz
chromium_src-39a248b002d0f41ad816754bb2833eea0aff9c61.tar.bz2
Adds the ability for save dialogs to take a default extension.
BUG=4287 TEST=see bug Review URL: http://codereview.chromium.org/10621 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/bookmark_manager_view.cc')
-rw-r--r--chrome/browser/views/bookmark_manager_view.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc
index e5bd6ae..9172b28 100644
--- a/chrome/browser/views/bookmark_manager_view.cc
+++ b/chrome/browser/views/bookmark_manager_view.cc
@@ -26,6 +26,7 @@
#include "chrome/common/gfx/color_utils.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
+#include "chrome/common/win_util.h"
#include "chrome/views/container_win.h"
#include "chrome/views/grid_layout.h"
#include "chrome/views/menu_button.h"
@@ -683,18 +684,20 @@ void BookmarkManagerView::ShowToolsMenu(HWND host, int x, int y) {
views::MenuItemView::TOPLEFT, true);
}
+// The filter used when opening a file.
+// TODO(sky): need a textual description here once we can add new
+// strings.
+static const wchar_t KFilterString[] = L"*.html\0*.html\0";
+
void BookmarkManagerView::ShowImportBookmarksFileChooser() {
if (select_file_dialog_.get())
select_file_dialog_->ListenerDestroyed();
- // TODO(sky): need a textual description here once we can add new
- // strings.
- const wchar_t filter_c_str[] = L"*.html\0*.html\0\0\0";
- std::wstring filter_string(filter_c_str, arraysize(filter_c_str));
+ std::wstring filter_string(KFilterString, arraysize(KFilterString));
select_file_dialog_ = SelectFileDialog::Create(this);
select_file_dialog_->SelectFile(
- SelectFileDialog::SELECT_OPEN_FILE, std::wstring(), std::wstring(),
- filter_string, GetContainer()->GetHWND(),
+ SelectFileDialog::SELECT_OPEN_FILE, std::wstring(), L"bookmarks.html",
+ filter_string, std::wstring(), GetContainer()->GetHWND(),
reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_IMPORT_MENU));
}
@@ -704,7 +707,8 @@ void BookmarkManagerView::ShowExportBookmarksFileChooser() {
select_file_dialog_ = SelectFileDialog::Create(this);
select_file_dialog_->SelectFile(
- SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), std::wstring(),
- std::wstring(), GetContainer()->GetHWND(),
+ SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), L"bookmarks.html",
+ win_util::GetFileFilterFromPath(L"bookmarks.html"), L"html",
+ GetContainer()->GetHWND(),
reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU));
}