| 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/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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 ShowExportBookmarksFileChooser(); | 511 ShowExportBookmarksFileChooser(); |
| 512 break; | 512 break; |
| 513 | 513 |
| 514 default: | 514 default: |
| 515 NOTREACHED(); | 515 NOTREACHED(); |
| 516 break; | 516 break; |
| 517 } | 517 } |
| 518 } | 518 } |
| 519 | 519 |
| 520 void BookmarkManagerView::FileSelected(const std::wstring& path, | 520 void BookmarkManagerView::FileSelected(const std::wstring& path, |
| 521 int index, |
| 521 void* params) { | 522 void* params) { |
| 522 int id = reinterpret_cast<int>(params); | 523 int id = reinterpret_cast<int>(params); |
| 523 if (id == IDS_BOOKMARK_MANAGER_IMPORT_MENU) { | 524 if (id == IDS_BOOKMARK_MANAGER_IMPORT_MENU) { |
| 524 // ImporterHost is ref counted and will delete itself when done. | 525 // ImporterHost is ref counted and will delete itself when done. |
| 525 ImporterHost* host = new ImporterHost(); | 526 ImporterHost* host = new ImporterHost(); |
| 526 ProfileInfo profile_info; | 527 ProfileInfo profile_info; |
| 527 profile_info.browser_type = BOOKMARKS_HTML; | 528 profile_info.browser_type = BOOKMARKS_HTML; |
| 528 profile_info.source_path = path; | 529 profile_info.source_path = path; |
| 529 StartImportingWithUI(GetWidget()->GetNativeView(), FAVORITES, host, | 530 StartImportingWithUI(GetWidget()->GetNativeView(), FAVORITES, host, |
| 530 profile_info, profile_, | 531 profile_info, profile_, |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 | 712 |
| 712 void BookmarkManagerView::ShowImportBookmarksFileChooser() { | 713 void BookmarkManagerView::ShowImportBookmarksFileChooser() { |
| 713 if (select_file_dialog_.get()) | 714 if (select_file_dialog_.get()) |
| 714 select_file_dialog_->ListenerDestroyed(); | 715 select_file_dialog_->ListenerDestroyed(); |
| 715 | 716 |
| 716 std::wstring filter_string = | 717 std::wstring filter_string = |
| 717 win_util::GetFileFilterFromExtensions(L"*.html;*.htm", true); | 718 win_util::GetFileFilterFromExtensions(L"*.html;*.htm", true); |
| 718 select_file_dialog_ = SelectFileDialog::Create(this); | 719 select_file_dialog_ = SelectFileDialog::Create(this); |
| 719 select_file_dialog_->SelectFile( | 720 select_file_dialog_->SelectFile( |
| 720 SelectFileDialog::SELECT_OPEN_FILE, std::wstring(), L"bookmarks.html", | 721 SelectFileDialog::SELECT_OPEN_FILE, std::wstring(), L"bookmarks.html", |
| 721 filter_string, std::wstring(), GetWidget()->GetNativeView(), | 722 filter_string, 0, std::wstring(), GetWidget()->GetNativeView(), |
| 722 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_IMPORT_MENU)); | 723 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_IMPORT_MENU)); |
| 723 } | 724 } |
| 724 | 725 |
| 725 void BookmarkManagerView::ShowExportBookmarksFileChooser() { | 726 void BookmarkManagerView::ShowExportBookmarksFileChooser() { |
| 726 if (select_file_dialog_.get()) | 727 if (select_file_dialog_.get()) |
| 727 select_file_dialog_->ListenerDestroyed(); | 728 select_file_dialog_->ListenerDestroyed(); |
| 728 | 729 |
| 729 select_file_dialog_ = SelectFileDialog::Create(this); | 730 select_file_dialog_ = SelectFileDialog::Create(this); |
| 730 select_file_dialog_->SelectFile( | 731 select_file_dialog_->SelectFile( |
| 731 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), L"bookmarks.html", | 732 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), L"bookmarks.html", |
| 732 win_util::GetFileFilterFromPath(L"bookmarks.html"), L"html", | 733 win_util::GetFileFilterFromPath(L"bookmarks.html"), 0, L"html", |
| 733 GetWidget()->GetNativeView(), | 734 GetWidget()->GetNativeView(), |
| 734 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); | 735 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); |
| 735 } | 736 } |
| OLD | NEW |