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

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

Issue 6931039: Add MenuItemView API to add and remove items at a particular index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed another spurious OVERRIDE. Created 9 years, 7 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 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 item->GetSubmenu()->ShowAt(owner_, bounds, do_capture); 1337 item->GetSubmenu()->ShowAt(owner_, bounds, do_capture);
1338 else 1338 else
1339 item->GetSubmenu()->Reposition(bounds); 1339 item->GetSubmenu()->Reposition(bounds);
1340 showing_submenu_ = false; 1340 showing_submenu_ = false;
1341 } 1341 }
1342 1342
1343 void MenuController::MenuChildrenChanged(MenuItemView* item) { 1343 void MenuController::MenuChildrenChanged(MenuItemView* item) {
1344 DCHECK(item); 1344 DCHECK(item);
1345 DCHECK(item->GetSubmenu()->IsShowing()); 1345 DCHECK(item->GetSubmenu()->IsShowing());
1346 1346
1347 // Currently this only supports adjusting the bounds of the last menu.
1348 DCHECK(item == state_.item->GetParentMenuItem());
1349
1350 // Make sure the submenu isn't showing for the current item (the position may 1347 // Make sure the submenu isn't showing for the current item (the position may
1351 // have changed or the menu removed). This also moves the selection back to 1348 // have changed or the menu removed). This also moves the selection back to
1352 // the parent, which handles the case where the selected item was removed. 1349 // the parent, which handles the case where the selected item was removed.
1353 SetSelection(state_.item->GetParentMenuItem(), 1350 if (state_.item)
1354 SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); 1351 SetSelection(item, SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY);
sky 2011/05/06 16:17:00 This isn't right. It forces the selection to be wh
rhashimoto 2011/05/11 00:44:53 You're right. I've changed this to check if the c
1355 1352
1356 OpenMenuImpl(item, false); 1353 OpenMenuImpl(item, false);
1357 } 1354 }
1358 1355
1359 void MenuController::BuildPathsAndCalculateDiff( 1356 void MenuController::BuildPathsAndCalculateDiff(
1360 MenuItemView* old_item, 1357 MenuItemView* old_item,
1361 MenuItemView* new_item, 1358 MenuItemView* new_item,
1362 std::vector<MenuItemView*>* old_path, 1359 std::vector<MenuItemView*>* old_path,
1363 std::vector<MenuItemView*>* new_path, 1360 std::vector<MenuItemView*>* new_path,
1364 size_t* first_diff_at) { 1361 size_t* first_diff_at) {
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 return; 1854 return;
1858 1855
1859 // Reset the active_mouse_view_ before sending mouse capture lost. That way if 1856 // Reset the active_mouse_view_ before sending mouse capture lost. That way if
1860 // it calls back to us, we aren't in a weird state. 1857 // it calls back to us, we aren't in a weird state.
1861 View* active_view = active_mouse_view_; 1858 View* active_view = active_mouse_view_;
1862 active_mouse_view_ = NULL; 1859 active_mouse_view_ = NULL;
1863 active_view->OnMouseCaptureLost(); 1860 active_view->OnMouseCaptureLost();
1864 } 1861 }
1865 1862
1866 } // namespace views 1863 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698