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

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

Issue 2790773002: Cleanup MenuRunner API (Closed)
Patch Set: Rebase Created 3 years, 8 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_editor_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 const gfx::Point& point, 239 const gfx::Point& point,
240 ui::MenuSourceType source_type) { 240 ui::MenuSourceType source_type) {
241 DCHECK_EQ(tree_view_, source); 241 DCHECK_EQ(tree_view_, source);
242 if (!tree_view_->GetSelectedNode()) 242 if (!tree_view_->GetSelectedNode())
243 return; 243 return;
244 running_menu_for_root_ = 244 running_menu_for_root_ =
245 (tree_model_->GetParent(tree_view_->GetSelectedNode()) == 245 (tree_model_->GetParent(tree_view_->GetSelectedNode()) ==
246 tree_model_->GetRoot()); 246 tree_model_->GetRoot());
247 247
248 context_menu_runner_.reset(new views::MenuRunner( 248 context_menu_runner_.reset(new views::MenuRunner(
249 GetMenuModel(), views::MenuRunner::HAS_MNEMONICS | 249 GetMenuModel(),
250 views::MenuRunner::CONTEXT_MENU | 250 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU));
251 views::MenuRunner::ASYNC));
252 251
253 if (context_menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), 252 context_menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(),
254 NULL, 253 NULL, gfx::Rect(point, gfx::Size()),
255 gfx::Rect(point, gfx::Size()), 254 views::MENU_ANCHOR_TOPRIGHT, source_type);
256 views::MENU_ANCHOR_TOPRIGHT,
257 source_type) ==
258 views::MenuRunner::MENU_DELETED) {
259 return;
260 }
261 } 255 }
262 256
263 const char* BookmarkEditorView::GetClassName() const { 257 const char* BookmarkEditorView::GetClassName() const {
264 return "BookmarkEditorView"; 258 return "BookmarkEditorView";
265 } 259 }
266 260
267 void BookmarkEditorView::BookmarkNodeMoved(BookmarkModel* model, 261 void BookmarkEditorView::BookmarkNodeMoved(BookmarkModel* model,
268 const BookmarkNode* old_parent, 262 const BookmarkNode* old_parent,
269 int old_index, 263 int old_index,
270 const BookmarkNode* new_parent, 264 const BookmarkNode* new_parent,
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 Profile* profile, 662 Profile* profile,
669 const BookmarkEditor::EditDetails& details, 663 const BookmarkEditor::EditDetails& details,
670 BookmarkEditor::Configuration configuration) { 664 BookmarkEditor::Configuration configuration) {
671 DCHECK(profile); 665 DCHECK(profile);
672 BookmarkEditorView* editor = new BookmarkEditorView( 666 BookmarkEditorView* editor = new BookmarkEditorView(
673 profile, details.parent_node, details, configuration); 667 profile, details.parent_node, details, configuration);
674 editor->Show(parent_window); 668 editor->Show(parent_window);
675 } 669 }
676 670
677 } // namespace chrome 671 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698