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

Side by Side Diff: components/renderer_context_menu/views/toolkit_delegate_views.cc

Issue 2255923002: Turn Browser Context Menu Async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Vox Tests 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
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/renderer_context_menu/views/toolkit_delegate_views.h" 5 #include "components/renderer_context_menu/views/toolkit_delegate_views.h"
6 6
7 #include "ui/gfx/geometry/rect.h" 7 #include "ui/gfx/geometry/rect.h"
8 #include "ui/gfx/image/image.h" 8 #include "ui/gfx/image/image.h"
9 #include "ui/views/controls/menu/menu_item_view.h" 9 #include "ui/views/controls/menu/menu_item_view.h"
10 #include "ui/views/controls/menu/menu_model_adapter.h" 10 #include "ui/views/controls/menu/menu_model_adapter.h"
(...skipping 11 matching lines...) Expand all
22 type == ui::MENU_SOURCE_TOUCH_EDIT_MENU) 22 type == ui::MENU_SOURCE_TOUCH_EDIT_MENU)
23 ? views::MENU_ANCHOR_BOTTOMCENTER 23 ? views::MENU_ANCHOR_BOTTOMCENTER
24 : views::MENU_ANCHOR_TOPLEFT; 24 : views::MENU_ANCHOR_TOPLEFT;
25 ignore_result(menu_runner_->RunMenuAt( 25 ignore_result(menu_runner_->RunMenuAt(
26 parent, NULL, gfx::Rect(point, gfx::Size()), anchor_position, type)); 26 parent, NULL, gfx::Rect(point, gfx::Size()), anchor_position, type));
27 } 27 }
28 28
29 void ToolkitDelegateViews::Init(ui::SimpleMenuModel* menu_model) { 29 void ToolkitDelegateViews::Init(ui::SimpleMenuModel* menu_model) {
30 menu_adapter_.reset(new views::MenuModelAdapter(menu_model)); 30 menu_adapter_.reset(new views::MenuModelAdapter(menu_model));
31 menu_view_ = menu_adapter_->CreateMenu(); 31 menu_view_ = menu_adapter_->CreateMenu();
32 menu_runner_.reset(new views::MenuRunner( 32 menu_runner_.reset(
33 menu_view_, 33 new views::MenuRunner(menu_view_, views::MenuRunner::HAS_MNEMONICS |
34 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU)); 34 views::MenuRunner::CONTEXT_MENU |
35 views::MenuRunner::ASYNC));
35 } 36 }
36 37
37 void ToolkitDelegateViews::Cancel() { 38 void ToolkitDelegateViews::Cancel() {
38 DCHECK(menu_runner_.get()); 39 DCHECK(menu_runner_.get());
39 menu_runner_->Cancel(); 40 menu_runner_->Cancel();
40 } 41 }
41 42
42 void ToolkitDelegateViews::UpdateMenuItem(int command_id, 43 void ToolkitDelegateViews::UpdateMenuItem(int command_id,
43 bool enabled, 44 bool enabled,
44 bool hidden, 45 bool hidden,
(...skipping 22 matching lines...) Expand all
67 68
68 item->SetIcon(*image.ToImageSkia()); 69 item->SetIcon(*image.ToImageSkia());
69 70
70 views::MenuItemView* parent = item->GetParentMenuItem(); 71 views::MenuItemView* parent = item->GetParentMenuItem();
71 if (!parent) 72 if (!parent)
72 return; 73 return;
73 74
74 parent->ChildrenChanged(); 75 parent->ChildrenChanged();
75 } 76 }
76 #endif 77 #endif
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698