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

Side by Side Diff: ui/views/controls/menu/menu_host.cc

Issue 10910144: Get mouse events to work with win aura, and make the combobox function in the views examples app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | « no previous file | ui/views/views.gyp » ('j') | 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) 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 "ui/views/controls/menu/menu_host.h" 5 #include "ui/views/controls/menu/menu_host.h"
6 6
7 #include "ui/views/controls/menu/menu_controller.h" 7 #include "ui/views/controls/menu/menu_controller.h"
8 #include "ui/views/controls/menu/menu_host_root_view.h" 8 #include "ui/views/controls/menu/menu_host_root_view.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/native_menu_host.h" 10 #include "ui/views/controls/menu/native_menu_host.h"
11 #include "ui/views/controls/menu/submenu_view.h" 11 #include "ui/views/controls/menu/submenu_view.h"
12 #include "ui/views/widget/native_widget_private.h" 12 #include "ui/views/widget/native_widget_private.h"
13 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
14 14
15 #if defined(USE_AURA)
16 #include "base/command_line.h"
17 #include "ui/views/widget/desktop_native_widget_aura.h"
18 #endif
19
15 namespace views { 20 namespace views {
16 21
17 //////////////////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////////////////
18 // MenuHost, public: 23 // MenuHost, public:
19 24
20 MenuHost::MenuHost(SubmenuView* submenu) 25 MenuHost::MenuHost(SubmenuView* submenu)
21 : submenu_(submenu), 26 : submenu_(submenu),
22 destroying_(false), 27 destroying_(false),
23 ignore_capture_lost_(false) { 28 ignore_capture_lost_(false) {
24 } 29 }
25 30
26 MenuHost::~MenuHost() { 31 MenuHost::~MenuHost() {
27 } 32 }
28 33
29 void MenuHost::InitMenuHost(Widget* parent, 34 void MenuHost::InitMenuHost(Widget* parent,
30 const gfx::Rect& bounds, 35 const gfx::Rect& bounds,
31 View* contents_view, 36 View* contents_view,
32 bool do_capture) { 37 bool do_capture) {
33 Widget::InitParams params(Widget::InitParams::TYPE_MENU); 38 Widget::InitParams params(Widget::InitParams::TYPE_MENU);
34 params.has_dropshadow = true; 39 params.has_dropshadow = true;
35 params.parent_widget = parent; 40 params.parent_widget = parent;
36 params.bounds = bounds; 41 params.bounds = bounds;
42 #if defined(USE_AURA) && !defined(OS_CHROMEOS)
43 if (CommandLine::ForCurrentProcess()->HasSwitch("win-aura"))
44 params.native_widget = new DesktopNativeWidgetAura(this);
45 #endif
37 Init(params); 46 Init(params);
38 SetContentsView(contents_view); 47 SetContentsView(contents_view);
39 ShowMenuHost(do_capture); 48 ShowMenuHost(do_capture);
40 } 49 }
41 50
42 bool MenuHost::IsMenuHostVisible() { 51 bool MenuHost::IsMenuHostVisible() {
43 return IsVisible(); 52 return IsVisible();
44 } 53 }
45 54
46 void MenuHost::ShowMenuHost(bool do_capture) { 55 void MenuHost::ShowMenuHost(bool do_capture) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (destroying_) 120 if (destroying_)
112 return; 121 return;
113 122
114 MenuController* menu_controller = 123 MenuController* menu_controller =
115 submenu_->GetMenuItem()->GetMenuController(); 124 submenu_->GetMenuItem()->GetMenuController();
116 if (menu_controller && !menu_controller->drag_in_progress()) 125 if (menu_controller && !menu_controller->drag_in_progress())
117 menu_controller->CancelAll(); 126 menu_controller->CancelAll();
118 } 127 }
119 128
120 } // namespace views 129 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698