Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/gfx/path.h" | 7 #include "ui/gfx/path.h" |
| 8 #include "ui/native_theme/native_theme.h" | 8 #include "ui/native_theme/native_theme.h" |
| 9 #include "ui/views/controls/menu/menu_controller.h" | 9 #include "ui/views/controls/menu/menu_controller.h" |
| 10 #include "ui/views/controls/menu/menu_host_root_view.h" | 10 #include "ui/views/controls/menu/menu_host_root_view.h" |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 } | 29 } |
| 30 | 30 |
| 31 void MenuHost::InitMenuHost(Widget* parent, | 31 void MenuHost::InitMenuHost(Widget* parent, |
| 32 const gfx::Rect& bounds, | 32 const gfx::Rect& bounds, |
| 33 View* contents_view, | 33 View* contents_view, |
| 34 bool do_capture) { | 34 bool do_capture) { |
| 35 Widget::InitParams params(Widget::InitParams::TYPE_MENU); | 35 Widget::InitParams params(Widget::InitParams::TYPE_MENU); |
| 36 params.has_dropshadow = true; | 36 params.has_dropshadow = true; |
| 37 params.parent = parent ? parent->GetNativeView() : NULL; | 37 params.parent = parent ? parent->GetNativeView() : NULL; |
| 38 params.bounds = bounds; | 38 params.bounds = bounds; |
| 39 | |
| 40 const MenuConfig& menu_config = submenu_->GetMenuItem()->GetMenuConfig(); | |
|
sky
2013/01/25 20:30:24
Can you make sure the MenuController is correctly
varunjain
2013/01/25 22:57:29
I think it does not matter if the controller exist
sky
2013/01/25 23:43:18
If the code falls back to MenuConfig::instance() t
varunjain
2013/01/28 20:58:01
my point is that the default value of corner radiu
| |
| 41 if (menu_config.corner_radius > 0) | |
| 42 params.transparent = true; | |
| 39 Init(params); | 43 Init(params); |
| 40 | 44 |
| 41 if (ui::NativeTheme::IsNewMenuStyleEnabled()) { | 45 if (ui::NativeTheme::IsNewMenuStyleEnabled() && |
|
sky
2013/01/25 20:30:24
I tend to think this code isn't needed at all. Set
varunjain
2013/01/25 22:57:29
I think so too. But I am not very familiar with th
sky
2013/01/25 23:43:18
Nuke it.
varunjain
2013/01/28 20:58:01
Done.
| |
| 46 menu_config.corner_radius > 0) { | |
| 42 // TODO(yefim): Investigate it more on aura. | 47 // TODO(yefim): Investigate it more on aura. |
| 43 gfx::Path path; | 48 gfx::Path path; |
| 44 RoundRectPainter::CreateRoundRectPath(bounds, &path); | 49 RoundRectPainter::CreateRoundRectPath(bounds, &path, |
| 50 menu_config.corner_radius); | |
| 45 SetShape(path.CreateNativeRegion()); | 51 SetShape(path.CreateNativeRegion()); |
| 46 } | 52 } |
| 47 | 53 |
| 48 SetContentsView(contents_view); | 54 SetContentsView(contents_view); |
| 55 if (menu_config.corner_radius > 0) | |
| 56 SetOpacity(0); | |
| 49 ShowMenuHost(do_capture); | 57 ShowMenuHost(do_capture); |
| 50 } | 58 } |
| 51 | 59 |
| 52 bool MenuHost::IsMenuHostVisible() { | 60 bool MenuHost::IsMenuHostVisible() { |
| 53 return IsVisible(); | 61 return IsVisible(); |
| 54 } | 62 } |
| 55 | 63 |
| 56 void MenuHost::ShowMenuHost(bool do_capture) { | 64 void MenuHost::ShowMenuHost(bool do_capture) { |
| 57 // Doing a capture may make us get capture lost. Ignore it while we're in the | 65 // Doing a capture may make us get capture lost. Ignore it while we're in the |
| 58 // process of showing. | 66 // process of showing. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 if (destroying_) | 129 if (destroying_) |
| 122 return; | 130 return; |
| 123 | 131 |
| 124 MenuController* menu_controller = | 132 MenuController* menu_controller = |
| 125 submenu_->GetMenuItem()->GetMenuController(); | 133 submenu_->GetMenuItem()->GetMenuController(); |
| 126 if (menu_controller && !menu_controller->drag_in_progress()) | 134 if (menu_controller && !menu_controller->drag_in_progress()) |
| 127 menu_controller->CancelAll(); | 135 menu_controller->CancelAll(); |
| 128 } | 136 } |
| 129 | 137 |
| 130 } // namespace views | 138 } // namespace views |
| OLD | NEW |