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

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

Issue 1477253002: Use a single views::MenuConfig instance for each platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add menu_config_android Created 5 years 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 | « ui/views/controls/menu/menu_controller.cc ('k') | ui/views/controls/menu/menu_item_view.h » ('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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "ui/events/gestures/gesture_recognizer.h" 9 #include "ui/events/gestures/gesture_recognizer.h"
10 #include "ui/gfx/path.h" 10 #include "ui/gfx/path.h"
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 void MenuHost::InitMenuHost(Widget* parent, 36 void MenuHost::InitMenuHost(Widget* parent,
37 const gfx::Rect& bounds, 37 const gfx::Rect& bounds,
38 View* contents_view, 38 View* contents_view,
39 bool do_capture) { 39 bool do_capture) {
40 TRACE_EVENT0("views", "MenuHost::InitMenuHost"); 40 TRACE_EVENT0("views", "MenuHost::InitMenuHost");
41 Widget::InitParams params(Widget::InitParams::TYPE_MENU); 41 Widget::InitParams params(Widget::InitParams::TYPE_MENU);
42 const MenuController* menu_controller = 42 const MenuController* menu_controller =
43 submenu_->GetMenuItem()->GetMenuController(); 43 submenu_->GetMenuItem()->GetMenuController();
44 const MenuConfig& menu_config = submenu_->GetMenuItem()->GetMenuConfig(); 44 const MenuConfig& menu_config = MenuConfig::instance();
45 bool rounded_border = menu_controller && menu_config.corner_radius > 0; 45 bool rounded_border = menu_controller && menu_config.corner_radius > 0;
46 bool bubble_border = submenu_->GetScrollViewContainer() && 46 bool bubble_border = submenu_->GetScrollViewContainer() &&
47 submenu_->GetScrollViewContainer()->HasBubbleBorder(); 47 submenu_->GetScrollViewContainer()->HasBubbleBorder();
48 params.shadow_type = bubble_border ? Widget::InitParams::SHADOW_TYPE_NONE 48 params.shadow_type = bubble_border ? Widget::InitParams::SHADOW_TYPE_NONE
49 : Widget::InitParams::SHADOW_TYPE_DROP; 49 : Widget::InitParams::SHADOW_TYPE_DROP;
50 params.opacity = (bubble_border || rounded_border) ? 50 params.opacity = (bubble_border || rounded_border) ?
51 Widget::InitParams::TRANSLUCENT_WINDOW : 51 Widget::InitParams::TRANSLUCENT_WINDOW :
52 Widget::InitParams::OPAQUE_WINDOW; 52 Widget::InitParams::OPAQUE_WINDOW;
53 params.parent = parent ? parent->GetNativeView() : NULL; 53 params.parent = parent ? parent->GetNativeView() : NULL;
54 params.bounds = bounds; 54 params.bounds = bounds;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 menu_controller->OnDragComplete(should_close); 166 menu_controller->OnDragComplete(should_close);
167 167
168 // We may have lost capture in the drag and drop, but are remaining open. 168 // We may have lost capture in the drag and drop, but are remaining open.
169 // Return capture so we get MouseCaptureLost events. 169 // Return capture so we get MouseCaptureLost events.
170 if (!should_close) 170 if (!should_close)
171 native_widget_private()->SetCapture(); 171 native_widget_private()->SetCapture();
172 } 172 }
173 173
174 } // namespace views 174 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_controller.cc ('k') | ui/views/controls/menu/menu_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698