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: views/controls/menu/native_menu_x.cc

Issue 7746012: Fixes the touch build from patch @ 98179 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
« no previous file with comments | « views/controls/menu/native_menu_x.h ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/controls/menu/native_menu_x.h" 5 #include "views/controls/menu/native_menu_x.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "ui/gfx/canvas_skia.h" 9 #include "ui/gfx/canvas_skia.h"
10 #include "ui/gfx/skia_util.h" 10 #include "ui/gfx/skia_util.h"
11 #include "views/controls/menu/menu_2.h" 11 #include "views/controls/menu/menu_2.h"
12 #include "views/controls/menu/menu_runner.h"
12 #include "views/controls/menu/submenu_view.h" 13 #include "views/controls/menu/submenu_view.h"
13 14
14 namespace views { 15 namespace views {
15 16
16 NativeMenuX::NativeMenuX(Menu2* menu) 17 NativeMenuX::NativeMenuX(Menu2* menu)
17 : model_(menu->model()), 18 : model_(menu->model()),
18 ALLOW_THIS_IN_INITIALIZER_LIST(root_(new MenuItemView(this))) { 19 ALLOW_THIS_IN_INITIALIZER_LIST(root_(new MenuItemView(this))),
20 menu_runner_(new MenuRunner(root_)) {
19 } 21 }
20 22
21 NativeMenuX::~NativeMenuX() { 23 NativeMenuX::~NativeMenuX() {
22 } 24 }
23 25
24 // MenuWrapper implementation: 26 // MenuWrapper implementation:
25 void NativeMenuX::RunMenuAt(const gfx::Point& point, int alignment) { 27 void NativeMenuX::RunMenuAt(const gfx::Point& point, int alignment) {
28 // TODO: this should really return the value from MenuRunner.
26 UpdateStates(); 29 UpdateStates();
27 root_->RunMenuAt(NULL, NULL, gfx::Rect(point, gfx::Size()), 30 if (menu_runner_->RunMenuAt(NULL, NULL, gfx::Rect(point, gfx::Size()),
28 alignment == Menu2::ALIGN_TOPLEFT ? MenuItemView::TOPLEFT : 31 alignment == Menu2::ALIGN_TOPLEFT ? MenuItemView::TOPLEFT :
29 MenuItemView::TOPRIGHT, true); 32 MenuItemView::TOPRIGHT, MenuRunner::HAS_MNEMONICS) ==
33 MenuRunner::MENU_DELETED)
34 return;
30 } 35 }
31 36
32 void NativeMenuX::CancelMenu() { 37 void NativeMenuX::CancelMenu() {
33 NOTIMPLEMENTED(); 38 NOTIMPLEMENTED();
34 } 39 }
35 40
36 void NativeMenuX::Rebuild() { 41 void NativeMenuX::Rebuild() {
37 if (SubmenuView* submenu = root_->GetSubmenu()) { 42 if (SubmenuView* submenu = root_->GetSubmenu())
38 submenu->RemoveAllChildViews(true); 43 submenu->RemoveAllChildViews(true);
39 } 44 AddMenuItemsFromModel(root_, model_);
40 AddMenuItemsFromModel(root_.get(), model_);
41 } 45 }
42 46
43 void NativeMenuX::UpdateStates() { 47 void NativeMenuX::UpdateStates() {
44 SubmenuView* submenu = root_->CreateSubmenu(); 48 SubmenuView* submenu = root_->CreateSubmenu();
45 UpdateMenuFromModel(submenu, model_); 49 UpdateMenuFromModel(submenu, model_);
46 } 50 }
47 51
48 gfx::NativeMenu NativeMenuX::GetNativeMenu() const { 52 gfx::NativeMenu NativeMenuX::GetNativeMenu() const {
49 NOTIMPLEMENTED(); 53 NOTIMPLEMENTED();
50 return NULL; 54 return NULL;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 159 }
156 160
157 // MenuWrapper, public: 161 // MenuWrapper, public:
158 162
159 // static 163 // static
160 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { 164 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) {
161 return new NativeMenuX(menu); 165 return new NativeMenuX(menu);
162 } 166 }
163 167
164 } // namespace views 168 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/native_menu_x.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698