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

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

Issue 12041085: Fix menu corners: the menu background was being painted as a rect when in fact, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 11 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
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/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
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 params.transparent = true;
39 Init(params); 40 Init(params);
40 41
41 if (ui::NativeTheme::IsNewMenuStyleEnabled()) { 42 if (ui::NativeTheme::IsNewMenuStyleEnabled()) {
42 // TODO(yefim): Investigate it more on aura. 43 // TODO(yefim): Investigate it more on aura.
43 gfx::Path path; 44 gfx::Path path;
44 RoundRectPainter::CreateRoundRectPath(bounds, &path); 45 RoundRectPainter::CreateRoundRectPath(bounds, &path);
45 SetShape(path.CreateNativeRegion()); 46 SetShape(path.CreateNativeRegion());
46 } 47 }
47 48
48 SetContentsView(contents_view); 49 SetContentsView(contents_view);
50 SetOpacity(0);
49 ShowMenuHost(do_capture); 51 ShowMenuHost(do_capture);
50 } 52 }
51 53
52 bool MenuHost::IsMenuHostVisible() { 54 bool MenuHost::IsMenuHostVisible() {
53 return IsVisible(); 55 return IsVisible();
54 } 56 }
55 57
56 void MenuHost::ShowMenuHost(bool do_capture) { 58 void MenuHost::ShowMenuHost(bool do_capture) {
57 // Doing a capture may make us get capture lost. Ignore it while we're in the 59 // Doing a capture may make us get capture lost. Ignore it while we're in the
58 // process of showing. 60 // process of showing.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (destroying_) 123 if (destroying_)
122 return; 124 return;
123 125
124 MenuController* menu_controller = 126 MenuController* menu_controller =
125 submenu_->GetMenuItem()->GetMenuController(); 127 submenu_->GetMenuItem()->GetMenuController();
126 if (menu_controller && !menu_controller->drag_in_progress()) 128 if (menu_controller && !menu_controller->drag_in_progress())
127 menu_controller->CancelAll(); 129 menu_controller->CancelAll();
128 } 130 }
129 131
130 } // namespace views 132 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698