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

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

Issue 1005873012: Makes bookmark menu lazily create menus and removes limits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review feedback Created 5 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
« no previous file with comments | « chrome/browser/ui/views/toolbar/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) 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_controller.h" 5 #include "ui/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/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 } 1508 }
1509 1509
1510 void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { 1510 void MenuController::OpenMenuImpl(MenuItemView* item, bool show) {
1511 // TODO(oshima|sky): Don't show the menu if drag is in progress and 1511 // TODO(oshima|sky): Don't show the menu if drag is in progress and
1512 // this menu doesn't support drag drop. See crbug.com/110495. 1512 // this menu doesn't support drag drop. See crbug.com/110495.
1513 if (show) { 1513 if (show) {
1514 int old_count = item->GetSubmenu()->child_count(); 1514 int old_count = item->GetSubmenu()->child_count();
1515 item->GetDelegate()->WillShowMenu(item); 1515 item->GetDelegate()->WillShowMenu(item);
1516 if (old_count != item->GetSubmenu()->child_count()) { 1516 if (old_count != item->GetSubmenu()->child_count()) {
1517 // If the number of children changed then we may need to add empty items. 1517 // If the number of children changed then we may need to add empty items.
1518 item->RemoveEmptyMenus();
1518 item->AddEmptyMenus(); 1519 item->AddEmptyMenus();
1519 } 1520 }
1520 } 1521 }
1521 bool prefer_leading = 1522 bool prefer_leading =
1522 state_.open_leading.empty() ? true : state_.open_leading.back(); 1523 state_.open_leading.empty() ? true : state_.open_leading.back();
1523 bool resulting_direction; 1524 bool resulting_direction;
1524 gfx::Rect bounds = MenuItemView::IsBubble(state_.anchor) ? 1525 gfx::Rect bounds = MenuItemView::IsBubble(state_.anchor) ?
1525 CalculateBubbleMenuBounds(item, prefer_leading, &resulting_direction) : 1526 CalculateBubbleMenuBounds(item, prefer_leading, &resulting_direction) :
1526 CalculateMenuBounds(item, prefer_leading, &resulting_direction); 1527 CalculateMenuBounds(item, prefer_leading, &resulting_direction);
1527 state_.open_leading.push_back(resulting_direction); 1528 state_.open_leading.push_back(resulting_direction);
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
2327 } 2328 }
2328 } 2329 }
2329 2330
2330 gfx::Screen* MenuController::GetScreen() { 2331 gfx::Screen* MenuController::GetScreen() {
2331 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; 2332 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL;
2332 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) 2333 return root ? gfx::Screen::GetScreenFor(root->GetNativeView())
2333 : gfx::Screen::GetNativeScreen(); 2334 : gfx::Screen::GetNativeScreen();
2334 } 2335 }
2335 2336
2336 } // namespace views 2337 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/wrench_menu.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698