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

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

Issue 250943008: Move enum MenuAnchorPosition to reduce deps on menu_item_view.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indent Created 6 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) 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/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 ui::MenuSourceType source_type) { 242 ui::MenuSourceType source_type) {
243 DCHECK_EQ(tree_view_, source); 243 DCHECK_EQ(tree_view_, source);
244 if (!tree_view_->GetSelectedNode()) 244 if (!tree_view_->GetSelectedNode())
245 return; 245 return;
246 running_menu_for_root_ = 246 running_menu_for_root_ =
247 (tree_model_->GetParent(tree_view_->GetSelectedNode()) == 247 (tree_model_->GetParent(tree_view_->GetSelectedNode()) ==
248 tree_model_->GetRoot()); 248 tree_model_->GetRoot());
249 249
250 context_menu_runner_.reset(new views::MenuRunner(GetMenuModel())); 250 context_menu_runner_.reset(new views::MenuRunner(GetMenuModel()));
251 251
252 if (context_menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), 252 if (context_menu_runner_->RunMenuAt(
253 NULL, gfx::Rect(point, gfx::Size()), views::MenuItemView::TOPRIGHT, 253 source->GetWidget()->GetTopLevelWidget(),
254 source_type, 254 NULL,
255 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU) == 255 gfx::Rect(point, gfx::Size()),
256 views::MenuRunner::MENU_DELETED) 256 views::MENU_ANCHOR_TOPRIGHT,
257 source_type,
258 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU) ==
259 views::MenuRunner::MENU_DELETED) {
257 return; 260 return;
261 }
258 } 262 }
259 263
260 void BookmarkEditorView::Init() { 264 void BookmarkEditorView::Init() {
261 bb_model_ = BookmarkModelFactory::GetForProfile(profile_); 265 bb_model_ = BookmarkModelFactory::GetForProfile(profile_);
262 DCHECK(bb_model_); 266 DCHECK(bb_model_);
263 bb_model_->AddObserver(this); 267 bb_model_->AddObserver(this);
264 268
265 title_label_ = new views::Label( 269 title_label_ = new views::Label(
266 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL)); 270 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL));
267 271
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 } 630 }
627 return context_menu_model_.get(); 631 return context_menu_model_.get();
628 } 632 }
629 633
630 void BookmarkEditorView::EditorTreeModel::SetTitle( 634 void BookmarkEditorView::EditorTreeModel::SetTitle(
631 ui::TreeModelNode* node, 635 ui::TreeModelNode* node,
632 const base::string16& title) { 636 const base::string16& title) {
633 if (!title.empty()) 637 if (!title.empty())
634 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); 638 ui::TreeNodeModel<EditorNode>::SetTitle(node, title);
635 } 639 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698