| 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 "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #include "app/gfx/color_utils.h" | 10 #include "app/gfx/color_utils.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 BookmarkManagerView::Show(profile); | 140 BookmarkManagerView::Show(profile); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace browser | 143 } // namespace browser |
| 144 | 144 |
| 145 BookmarkManagerView::BookmarkManagerView(Profile* profile) | 145 BookmarkManagerView::BookmarkManagerView(Profile* profile) |
| 146 : profile_(profile->GetOriginalProfile()), | 146 : profile_(profile->GetOriginalProfile()), |
| 147 table_view_(NULL), | 147 table_view_(NULL), |
| 148 tree_view_(NULL), | 148 tree_view_(NULL), |
| 149 ALLOW_THIS_IN_INITIALIZER_LIST(search_factory_(this)) { | 149 ALLOW_THIS_IN_INITIALIZER_LIST(search_factory_(this)) { |
| 150 search_tf_ = new views::TextField(); | 150 search_tf_ = new views::Textfield(); |
| 151 search_tf_->set_default_width_in_chars(30); | 151 search_tf_->set_default_width_in_chars(30); |
| 152 | 152 |
| 153 table_view_ = new BookmarkTableView(profile_, NULL); | 153 table_view_ = new BookmarkTableView(profile_, NULL); |
| 154 table_view_->SetObserver(this); | 154 table_view_->SetObserver(this); |
| 155 table_view_->SetContextMenuController(this); | 155 table_view_->SetContextMenuController(this); |
| 156 | 156 |
| 157 tree_view_ = new BookmarkFolderTreeView(profile_, NULL); | 157 tree_view_ = new BookmarkFolderTreeView(profile_, NULL); |
| 158 tree_view_->SetController(this); | 158 tree_view_->SetController(this); |
| 159 tree_view_->SetContextMenuController(this); | 159 tree_view_->SetContextMenuController(this); |
| 160 | 160 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 OnCutCopyPaste(KeyCodeToCutCopyPaste(virtual_keycode), false); | 473 OnCutCopyPaste(KeyCodeToCutCopyPaste(virtual_keycode), false); |
| 474 break; | 474 break; |
| 475 } | 475 } |
| 476 } | 476 } |
| 477 | 477 |
| 478 void BookmarkManagerView::Loaded(BookmarkModel* model) { | 478 void BookmarkManagerView::Loaded(BookmarkModel* model) { |
| 479 model->RemoveObserver(this); | 479 model->RemoveObserver(this); |
| 480 LoadedImpl(); | 480 LoadedImpl(); |
| 481 } | 481 } |
| 482 | 482 |
| 483 void BookmarkManagerView::ContentsChanged(views::TextField* sender, | 483 void BookmarkManagerView::ContentsChanged(views::Textfield* sender, |
| 484 const std::wstring& new_contents) { | 484 const std::wstring& new_contents) { |
| 485 search_factory_.RevokeAll(); | 485 search_factory_.RevokeAll(); |
| 486 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 486 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 487 search_factory_.NewRunnableMethod(&BookmarkManagerView::PerformSearch), | 487 search_factory_.NewRunnableMethod(&BookmarkManagerView::PerformSearch), |
| 488 kSearchDelayMS); | 488 kSearchDelayMS); |
| 489 } | 489 } |
| 490 | 490 |
| 491 bool BookmarkManagerView::HandleKeystroke( | 491 bool BookmarkManagerView::HandleKeystroke( |
| 492 views::TextField* sender, | 492 views::Textfield* sender, |
| 493 const views::TextField::Keystroke& key) { | 493 const views::Textfield::Keystroke& key) { |
| 494 if (views::TextField::IsKeystrokeEnter(key)) { | 494 if (views::Textfield::IsKeystrokeEnter(key)) { |
| 495 PerformSearch(); | 495 PerformSearch(); |
| 496 search_tf_->SelectAll(); | 496 search_tf_->SelectAll(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 return false; | 499 return false; |
| 500 } | 500 } |
| 501 | 501 |
| 502 void BookmarkManagerView::ShowContextMenu(views::View* source, | 502 void BookmarkManagerView::ShowContextMenu(views::View* source, |
| 503 int x, | 503 int x, |
| 504 int y, | 504 int y, |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 file_type_info.extensions.resize(1); | 768 file_type_info.extensions.resize(1); |
| 769 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); | 769 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); |
| 770 file_type_info.include_all_files = true; | 770 file_type_info.include_all_files = true; |
| 771 select_file_dialog_ = SelectFileDialog::Create(this); | 771 select_file_dialog_ = SelectFileDialog::Create(this); |
| 772 select_file_dialog_->SelectFile( | 772 select_file_dialog_->SelectFile( |
| 773 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), | 773 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), |
| 774 FilePath(FILE_PATH_LITERAL("bookmarks.html")), &file_type_info, 0, | 774 FilePath(FILE_PATH_LITERAL("bookmarks.html")), &file_type_info, 0, |
| 775 L"html", GetWidget()->GetNativeView(), | 775 L"html", GetWidget()->GetNativeView(), |
| 776 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); | 776 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); |
| 777 } | 777 } |
| OLD | NEW |