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

Side by Side Diff: views/controls/button/button_dropdown.cc

Issue 7054052: Move more from Window onto Widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 | « chrome/browser/ui/views/wrench_menu.cc ('k') | views/desktop/desktop_window.cc » ('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) 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/button/button_dropdown.h" 5 #include "views/controls/button/button_dropdown.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "grit/app_strings.h" 10 #include "grit/app_strings.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 // Make the button look depressed while the menu is open. 152 // Make the button look depressed while the menu is open.
153 SetState(BS_PUSHED); 153 SetState(BS_PUSHED);
154 154
155 // Create and run menu. Display an empty menu if model is NULL. 155 // Create and run menu. Display an empty menu if model is NULL.
156 if (model_) { 156 if (model_) {
157 MenuModelAdapter menu_delegate(model_); 157 MenuModelAdapter menu_delegate(model_);
158 MenuItemView menu(&menu_delegate); 158 MenuItemView menu(&menu_delegate);
159 menu_delegate.BuildMenu(&menu); 159 menu_delegate.BuildMenu(&menu);
160 160
161 menu.RunMenuAt(GetWindow()->GetNativeWindow(), NULL, 161 menu.RunMenuAt(GetWidget()->GetNativeWindow(), NULL,
162 gfx::Rect(menu_position, gfx::Size(0, 0)), 162 gfx::Rect(menu_position, gfx::Size(0, 0)),
163 views::MenuItemView::TOPLEFT, 163 views::MenuItemView::TOPLEFT,
164 true); 164 true);
165 } else { 165 } else {
166 MenuDelegate menu_delegate; 166 MenuDelegate menu_delegate;
167 MenuItemView menu(&menu_delegate); 167 MenuItemView menu(&menu_delegate);
168 menu.RunMenuAt(GetWindow()->GetNativeWindow(), NULL, 168 menu.RunMenuAt(GetWidget()->GetNativeWindow(), NULL,
169 gfx::Rect(menu_position, gfx::Size(0, 0)), 169 gfx::Rect(menu_position, gfx::Size(0, 0)),
170 views::MenuItemView::TOPLEFT, 170 views::MenuItemView::TOPLEFT,
171 true); 171 true);
172 } 172 }
173 173
174 // Need to explicitly clear mouse handler so that events get sent 174 // Need to explicitly clear mouse handler so that events get sent
175 // properly after the menu finishes running. If we don't do this, then 175 // properly after the menu finishes running. If we don't do this, then
176 // the first click to other parts of the UI is eaten. 176 // the first click to other parts of the UI is eaten.
177 SetMouseHandler(NULL); 177 SetMouseHandler(NULL);
178 178
179 // Set the state back to normal after the drop down menu is closed. 179 // Set the state back to normal after the drop down menu is closed.
180 if (state_ != BS_DISABLED) 180 if (state_ != BS_DISABLED)
181 SetState(BS_NORMAL); 181 SetState(BS_NORMAL);
182 } 182 }
183 183
184 //////////////////////////////////////////////////////////////////////////////// 184 ////////////////////////////////////////////////////////////////////////////////
185 // 185 //
186 // ButtonDropDown - Accessibility 186 // ButtonDropDown - Accessibility
187 // 187 //
188 //////////////////////////////////////////////////////////////////////////////// 188 ////////////////////////////////////////////////////////////////////////////////
189 189
190 } // namespace views 190 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/wrench_menu.cc ('k') | views/desktop/desktop_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698