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

Side by Side Diff: views/controls/menu/menu_controller.cc

Issue 6811025: Change status button menu implementation from Menu2 to MenuItemView. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Changed refcount guard to use OS_CHROMEOS. Created 9 years, 8 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) 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/menu/menu_controller.h" 5 #include "views/controls/menu/menu_controller.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "ui/base/dragdrop/os_exchange_data.h" 10 #include "ui/base/dragdrop/os_exchange_data.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 if (!blocking_run_) { 297 if (!blocking_run_) {
298 // Start the timer to hide the menu. This is needed as we get no 298 // Start the timer to hide the menu. This is needed as we get no
299 // notification when the drag has finished. 299 // notification when the drag has finished.
300 StartCancelAllTimer(); 300 StartCancelAllTimer();
301 return NULL; 301 return NULL;
302 } else if (button) { 302 } else if (button) {
303 menu_button_ = button; 303 menu_button_ = button;
304 } 304 }
305 305
306 // Make sure Chrome doesn't attempt to shut down while the menu is showing. 306 // Make sure Chrome doesn't attempt to shut down while the menu is
307 // showing. We don't ref and unref the ViewsDelegate for ChromeOS
308 // because this will exit the message loop if no browsers exist,
309 // (e.g. on the login screen).
310 #if !defined(OS_CHROMEOS)
oshima 2011/04/14 17:27:31 This looks suspicious. Let's discuss offline.
rhashimoto 2011/04/14 18:27:04 Sounds like a good idea.
rhashimoto 2011/04/15 21:20:27 Reverted to original file. The login screen shoul
307 if (ViewsDelegate::views_delegate) 311 if (ViewsDelegate::views_delegate)
308 ViewsDelegate::views_delegate->AddRef(); 312 ViewsDelegate::views_delegate->AddRef();
313 #endif
309 314
310 // We need to turn on nestable tasks as in some situations (pressing alt-f for 315 // We need to turn on nestable tasks as in some situations (pressing alt-f for
311 // one) the menus are run from a task. If we don't do this and are invoked 316 // one) the menus are run from a task. If we don't do this and are invoked
312 // from a task none of the tasks we schedule are processed and the menu 317 // from a task none of the tasks we schedule are processed and the menu
313 // appears totally broken. 318 // appears totally broken.
314 MessageLoopForUI* loop = MessageLoopForUI::current(); 319 MessageLoopForUI* loop = MessageLoopForUI::current();
315 bool did_allow_task_nesting = loop->NestableTasksAllowed(); 320 bool did_allow_task_nesting = loop->NestableTasksAllowed();
316 loop->SetNestableTasksAllowed(true); 321 loop->SetNestableTasksAllowed(true);
317 loop->Run(this); 322 loop->Run(this);
318 loop->SetNestableTasksAllowed(did_allow_task_nesting); 323 loop->SetNestableTasksAllowed(did_allow_task_nesting);
319 324
325 #if !defined(OS_CHROMEOS)
320 if (ViewsDelegate::views_delegate) 326 if (ViewsDelegate::views_delegate)
321 ViewsDelegate::views_delegate->ReleaseRef(); 327 ViewsDelegate::views_delegate->ReleaseRef();
328 #endif
322 329
323 // Close any open menus. 330 // Close any open menus.
324 SetSelection(NULL, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT); 331 SetSelection(NULL, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT);
325 332
326 if (nested_menu) { 333 if (nested_menu) {
327 DCHECK(!menu_stack_.empty()); 334 DCHECK(!menu_stack_.empty());
328 // We're running from within a menu, restore the previous state. 335 // We're running from within a menu, restore the previous state.
329 // The menus are already showing, so we don't have to show them. 336 // The menus are already showing, so we don't have to show them.
330 state_ = menu_stack_.back(); 337 state_ = menu_stack_.back();
331 pending_state_ = menu_stack_.back(); 338 pending_state_ = menu_stack_.back();
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 return; 1852 return;
1846 1853
1847 // Reset the active_mouse_view_ before sending mouse capture lost. That way if 1854 // Reset the active_mouse_view_ before sending mouse capture lost. That way if
1848 // it calls back to us, we aren't in a weird state. 1855 // it calls back to us, we aren't in a weird state.
1849 View* active_view = active_mouse_view_; 1856 View* active_view = active_mouse_view_;
1850 active_mouse_view_ = NULL; 1857 active_mouse_view_ = NULL;
1851 active_view->OnMouseCaptureLost(); 1858 active_view->OnMouseCaptureLost();
1852 } 1859 }
1853 1860
1854 } // namespace views 1861 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698