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

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

Issue 331993009: MacViews: Run native Cocoa context menus to support Services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add VIEWS_EXPORT for unit test access Created 6 years, 5 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 views::View* source, 244 views::View* source,
245 const gfx::Point& point, 245 const gfx::Point& point,
246 ui::MenuSourceType source_type) { 246 ui::MenuSourceType source_type) {
247 DCHECK_EQ(tree_view_, source); 247 DCHECK_EQ(tree_view_, source);
248 if (!tree_view_->GetSelectedNode()) 248 if (!tree_view_->GetSelectedNode())
249 return; 249 return;
250 running_menu_for_root_ = 250 running_menu_for_root_ =
251 (tree_model_->GetParent(tree_view_->GetSelectedNode()) == 251 (tree_model_->GetParent(tree_view_->GetSelectedNode()) ==
252 tree_model_->GetRoot()); 252 tree_model_->GetRoot());
253 253
254 context_menu_runner_.reset(new views::MenuRunner(GetMenuModel())); 254 context_menu_runner_.reset(new views::MenuRunner(
255 GetMenuModel(),
256 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU));
255 257
256 if (context_menu_runner_->RunMenuAt( 258 if (context_menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(),
257 source->GetWidget()->GetTopLevelWidget(), 259 NULL,
258 NULL, 260 gfx::Rect(point, gfx::Size()),
259 gfx::Rect(point, gfx::Size()), 261 views::MENU_ANCHOR_TOPRIGHT,
260 views::MENU_ANCHOR_TOPRIGHT, 262 source_type) ==
261 source_type,
262 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU) ==
263 views::MenuRunner::MENU_DELETED) { 263 views::MenuRunner::MENU_DELETED) {
264 return; 264 return;
265 } 265 }
266 } 266 }
267 267
268 void BookmarkEditorView::Init() { 268 void BookmarkEditorView::Init() {
269 bb_model_->AddObserver(this); 269 bb_model_->AddObserver(this);
270 270
271 title_label_ = new views::Label( 271 title_label_ = new views::Label(
272 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL)); 272 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL));
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } 637 }
638 return context_menu_model_.get(); 638 return context_menu_model_.get();
639 } 639 }
640 640
641 void BookmarkEditorView::EditorTreeModel::SetTitle( 641 void BookmarkEditorView::EditorTreeModel::SetTitle(
642 ui::TreeModelNode* node, 642 ui::TreeModelNode* node,
643 const base::string16& title) { 643 const base::string16& title) {
644 if (!title.empty()) 644 if (!title.empty())
645 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); 645 ui::TreeNodeModel<EditorNode>::SetTitle(node, title);
646 } 646 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698