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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc

Issue 2155243007: Turn Bookmark Menus Async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge the pretarget handlers Created 4 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/views/bookmarks/bookmark_menu_controller_views.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_stats.h" 9 #include "chrome/browser/bookmarks/bookmark_stats.h"
10 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 10 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
(...skipping 21 matching lines...) Expand all
32 int start_child_index, 32 int start_child_index,
33 bool for_drop) 33 bool for_drop)
34 : menu_delegate_(new BookmarkMenuDelegate(browser, page_navigator, parent)), 34 : menu_delegate_(new BookmarkMenuDelegate(browser, page_navigator, parent)),
35 node_(node), 35 node_(node),
36 observer_(NULL), 36 observer_(NULL),
37 for_drop_(for_drop), 37 for_drop_(for_drop),
38 bookmark_bar_(NULL) { 38 bookmark_bar_(NULL) {
39 menu_delegate_->Init(this, NULL, node, start_child_index, 39 menu_delegate_->Init(this, NULL, node, start_child_index,
40 BookmarkMenuDelegate::HIDE_PERMANENT_FOLDERS, 40 BookmarkMenuDelegate::HIDE_PERMANENT_FOLDERS,
41 BOOKMARK_LAUNCH_LOCATION_BAR_SUBFOLDER); 41 BOOKMARK_LAUNCH_LOCATION_BAR_SUBFOLDER);
42 menu_runner_.reset(new views::MenuRunner( 42 int run_type = views::MenuRunner::ASYNC;
43 menu_delegate_->menu(), for_drop ? views::MenuRunner::FOR_DROP : 0)); 43 if (for_drop)
44 run_type |= views::MenuRunner::FOR_DROP;
45 menu_runner_.reset(new views::MenuRunner(menu_delegate_->menu(), run_type));
44 } 46 }
45 47
46 void BookmarkMenuController::RunMenuAt(BookmarkBarView* bookmark_bar) { 48 void BookmarkMenuController::RunMenuAt(BookmarkBarView* bookmark_bar) {
47 bookmark_bar_ = bookmark_bar; 49 bookmark_bar_ = bookmark_bar;
48 views::MenuButton* menu_button = bookmark_bar_->GetMenuButtonForNode(node_); 50 views::MenuButton* menu_button = bookmark_bar_->GetMenuButtonForNode(node_);
49 DCHECK(menu_button); 51 DCHECK(menu_button);
50 views::MenuAnchorPosition anchor; 52 views::MenuAnchorPosition anchor;
51 bookmark_bar_->GetAnchorPositionForButton(menu_button, &anchor); 53 bookmark_bar_->GetAnchorPositionForButton(menu_button, &anchor);
52 gfx::Point screen_loc; 54 gfx::Point screen_loc;
53 views::View::ConvertPointToScreen(menu_button, &screen_loc); 55 views::View::ConvertPointToScreen(menu_button, &screen_loc);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 void BookmarkMenuController::BookmarkModelChanged() { 192 void BookmarkMenuController::BookmarkModelChanged() {
191 if (!menu_delegate_->is_mutating_model()) 193 if (!menu_delegate_->is_mutating_model())
192 menu()->Cancel(); 194 menu()->Cancel();
193 } 195 }
194 196
195 BookmarkMenuController::~BookmarkMenuController() { 197 BookmarkMenuController::~BookmarkMenuController() {
196 menu_delegate_->GetBookmarkModel()->RemoveObserver(this); 198 menu_delegate_->GetBookmarkModel()->RemoveObserver(this);
197 if (observer_) 199 if (observer_)
198 observer_->BookmarkMenuControllerDeleted(this); 200 observer_->BookmarkMenuControllerDeleted(this);
199 } 201 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698