Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: chrome/browser/views/bookmark_manager_view.cc

Issue 115309: Remove even more ATL dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/chrome_canvas.h" 9 #include "app/gfx/chrome_canvas.h"
10 #include "app/gfx/color_utils.h" 10 #include "app/gfx/color_utils.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 return BookmarkManagerView::NONE; 130 return BookmarkManagerView::NONE;
131 } 131 }
132 } 132 }
133 133
134 } // namespace 134 } // namespace
135 135
136 BookmarkManagerView::BookmarkManagerView(Profile* profile) 136 BookmarkManagerView::BookmarkManagerView(Profile* profile)
137 : profile_(profile->GetOriginalProfile()), 137 : profile_(profile->GetOriginalProfile()),
138 table_view_(NULL), 138 table_view_(NULL),
139 tree_view_(NULL), 139 tree_view_(NULL),
140 search_factory_(this) { 140 ALLOW_THIS_IN_INITIALIZER_LIST(search_factory_(this)) {
141 search_tf_ = new views::TextField(); 141 search_tf_ = new views::TextField();
142 search_tf_->set_default_width_in_chars(30); 142 search_tf_->set_default_width_in_chars(30);
143 143
144 table_view_ = new BookmarkTableView(profile_, NULL); 144 table_view_ = new BookmarkTableView(profile_, NULL);
145 table_view_->SetObserver(this); 145 table_view_->SetObserver(this);
146 table_view_->SetContextMenuController(this); 146 table_view_->SetContextMenuController(this);
147 147
148 tree_view_ = new BookmarkFolderTreeView(profile_, NULL); 148 tree_view_ = new BookmarkFolderTreeView(profile_, NULL);
149 tree_view_->SetController(this); 149 tree_view_->SetController(this);
150 tree_view_->SetContextMenuController(this); 150 tree_view_->SetContextMenuController(this);
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 int y, 472 int y,
473 bool is_mouse_gesture) { 473 bool is_mouse_gesture) {
474 DCHECK(source == table_view_ || source == tree_view_); 474 DCHECK(source == table_view_ || source == tree_view_);
475 bool is_table = (source == table_view_); 475 bool is_table = (source == table_view_);
476 ShowMenu(GetWidget()->GetNativeView(), x, y, 476 ShowMenu(GetWidget()->GetNativeView(), x, y,
477 is_table ? BookmarkContextMenu::BOOKMARK_MANAGER_TABLE : 477 is_table ? BookmarkContextMenu::BOOKMARK_MANAGER_TABLE :
478 BookmarkContextMenu::BOOKMARK_MANAGER_TREE); 478 BookmarkContextMenu::BOOKMARK_MANAGER_TREE);
479 } 479 }
480 480
481 void BookmarkManagerView::RunMenu(views::View* source, 481 void BookmarkManagerView::RunMenu(views::View* source,
482 const CPoint& pt, 482 const gfx::Point& pt,
483 HWND hwnd) { 483 HWND hwnd) {
484 // TODO(glen): when you change the buttons around and what not, futz with 484 // TODO(glen): when you change the buttons around and what not, futz with
485 // this to make it look good. If you end up keeping padding numbers make them 485 // this to make it look good. If you end up keeping padding numbers make them
486 // constants. 486 // constants.
487 if (!GetBookmarkModel()->IsLoaded()) 487 if (!GetBookmarkModel()->IsLoaded())
488 return; 488 return;
489 489
490 int menu_x = pt.x; 490 int menu_x = pt.x();
491 menu_x += UILayoutIsRightToLeft() ? (source->width() - 5) : 491 menu_x += UILayoutIsRightToLeft() ? (source->width() - 5) :
492 (-source->width() + 5); 492 (-source->width() + 5);
493 if (source->GetID() == kOrganizeMenuButtonID) { 493 if (source->GetID() == kOrganizeMenuButtonID) {
494 ShowMenu(hwnd, menu_x, pt.y + 2, 494 ShowMenu(hwnd, menu_x, pt.y() + 2,
495 BookmarkContextMenu::BOOKMARK_MANAGER_ORGANIZE_MENU); 495 BookmarkContextMenu::BOOKMARK_MANAGER_ORGANIZE_MENU);
496 } else if (source->GetID() == kToolsMenuButtonID) { 496 } else if (source->GetID() == kToolsMenuButtonID) {
497 ShowToolsMenu(hwnd, menu_x, pt.y + 2); 497 ShowToolsMenu(hwnd, menu_x, pt.y() + 2);
498 } else { 498 } else {
499 NOTREACHED(); 499 NOTREACHED();
500 } 500 }
501 } 501 }
502 502
503 void BookmarkManagerView::ExecuteCommand(int id) { 503 void BookmarkManagerView::ExecuteCommand(int id) {
504 switch (id) { 504 switch (id) {
505 case IDS_BOOKMARK_MANAGER_IMPORT_MENU: 505 case IDS_BOOKMARK_MANAGER_IMPORT_MENU:
506 UserMetrics::RecordAction(L"BookmarkManager_Import", profile_); 506 UserMetrics::RecordAction(L"BookmarkManager_Import", profile_);
507 ShowImportBookmarksFileChooser(); 507 ShowImportBookmarksFileChooser();
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 file_type_info.extensions.resize(1); 736 file_type_info.extensions.resize(1);
737 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); 737 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html"));
738 file_type_info.include_all_files = true; 738 file_type_info.include_all_files = true;
739 select_file_dialog_ = SelectFileDialog::Create(this); 739 select_file_dialog_ = SelectFileDialog::Create(this);
740 select_file_dialog_->SelectFile( 740 select_file_dialog_->SelectFile(
741 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), 741 SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(),
742 FilePath(FILE_PATH_LITERAL("bookmarks.html")), &file_type_info, 0, 742 FilePath(FILE_PATH_LITERAL("bookmarks.html")), &file_type_info, 0,
743 L"html", GetWidget()->GetNativeView(), 743 L"html", GetWidget()->GetNativeView(),
744 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); 744 reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU));
745 } 745 }
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_manager_view.h ('k') | chrome/browser/views/bookmark_menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698