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

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

Issue 7076027: Couple more wrench menu issues. The patch I sent around a couple of (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Makes unit test compile 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') | no next file » | 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/menu/menu_controller.h" 5 #include "views/controls/menu/menu_controller.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 DCHECK(item); 1318 DCHECK(item);
1319 if (item->GetSubmenu()->IsShowing()) { 1319 if (item->GetSubmenu()->IsShowing()) {
1320 return; 1320 return;
1321 } 1321 }
1322 1322
1323 OpenMenuImpl(item, true); 1323 OpenMenuImpl(item, true);
1324 did_capture_ = true; 1324 did_capture_ = true;
1325 } 1325 }
1326 1326
1327 void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { 1327 void MenuController::OpenMenuImpl(MenuItemView* item, bool show) {
1328 if (show) 1328 if (show) {
1329 int old_count = item->GetSubmenu()->child_count();
1329 item->GetDelegate()->WillShowMenu(item); 1330 item->GetDelegate()->WillShowMenu(item);
1331 if (old_count != item->GetSubmenu()->child_count()) {
1332 // If the number of children changed then we may need to add empty items.
1333 item->AddEmptyMenus();
1334 }
1335 }
1330 bool prefer_leading = 1336 bool prefer_leading =
1331 state_.open_leading.empty() ? true : state_.open_leading.back(); 1337 state_.open_leading.empty() ? true : state_.open_leading.back();
1332 bool resulting_direction; 1338 bool resulting_direction;
1333 gfx::Rect bounds = 1339 gfx::Rect bounds =
1334 CalculateMenuBounds(item, prefer_leading, &resulting_direction); 1340 CalculateMenuBounds(item, prefer_leading, &resulting_direction);
1335 state_.open_leading.push_back(resulting_direction); 1341 state_.open_leading.push_back(resulting_direction);
1336 bool do_capture = (!did_capture_ && blocking_run_); 1342 bool do_capture = (!did_capture_ && blocking_run_);
1337 showing_submenu_ = true; 1343 showing_submenu_ = true;
1338 if (show) 1344 if (show)
1339 item->GetSubmenu()->ShowAt(owner_, bounds, do_capture); 1345 item->GetSubmenu()->ShowAt(owner_, bounds, do_capture);
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 return; 1868 return;
1863 1869
1864 // Reset the active_mouse_view_ before sending mouse capture lost. That way if 1870 // Reset the active_mouse_view_ before sending mouse capture lost. That way if
1865 // it calls back to us, we aren't in a weird state. 1871 // it calls back to us, we aren't in a weird state.
1866 View* active_view = active_mouse_view_; 1872 View* active_view = active_mouse_view_;
1867 active_mouse_view_ = NULL; 1873 active_mouse_view_ = NULL;
1868 active_view->OnMouseCaptureLost(); 1874 active_view->OnMouseCaptureLost();
1869 } 1875 }
1870 1876
1871 } // namespace views 1877 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/wrench_menu.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698