| OLD | NEW |
| 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_item_view.h" | 5 #include "ui/views/controls/menu/menu_item_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 // Force a paint and layout. This handles the case of the top | 517 // Force a paint and layout. This handles the case of the top |
| 518 // level window's size remaining the same, resulting in no | 518 // level window's size remaining the same, resulting in no |
| 519 // change to the submenu's size and no layout. | 519 // change to the submenu's size and no layout. |
| 520 submenu_->Layout(); | 520 submenu_->Layout(); |
| 521 submenu_->SchedulePaint(); | 521 submenu_->SchedulePaint(); |
| 522 // Update the menu selection after layout. | 522 // Update the menu selection after layout. |
| 523 controller->UpdateSubmenuSelection(submenu_); | 523 controller->UpdateSubmenuSelection(submenu_); |
| 524 } | 524 } |
| 525 } | 525 } |
| 526 | 526 |
| 527 for (auto item : removed_items_) | 527 for (auto* item : removed_items_) |
| 528 delete item; | 528 delete item; |
| 529 removed_items_.clear(); | 529 removed_items_.clear(); |
| 530 } | 530 } |
| 531 | 531 |
| 532 void MenuItemView::Layout() { | 532 void MenuItemView::Layout() { |
| 533 if (!has_children()) | 533 if (!has_children()) |
| 534 return; | 534 return; |
| 535 | 535 |
| 536 if (IsContainer()) { | 536 if (IsContainer()) { |
| 537 View* child = child_at(0); | 537 View* child = child_at(0); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 left_icon_margin_(0), | 592 left_icon_margin_(0), |
| 593 right_icon_margin_(0), | 593 right_icon_margin_(0), |
| 594 requested_menu_position_(POSITION_BEST_FIT), | 594 requested_menu_position_(POSITION_BEST_FIT), |
| 595 actual_menu_position_(requested_menu_position_), | 595 actual_menu_position_(requested_menu_position_), |
| 596 use_right_margin_(true) { | 596 use_right_margin_(true) { |
| 597 Init(parent, command, type, NULL); | 597 Init(parent, command, type, NULL); |
| 598 } | 598 } |
| 599 | 599 |
| 600 MenuItemView::~MenuItemView() { | 600 MenuItemView::~MenuItemView() { |
| 601 delete submenu_; | 601 delete submenu_; |
| 602 for (auto item : removed_items_) | 602 for (auto* item : removed_items_) |
| 603 delete item; | 603 delete item; |
| 604 } | 604 } |
| 605 | 605 |
| 606 const char* MenuItemView::GetClassName() const { | 606 const char* MenuItemView::GetClassName() const { |
| 607 return kViewClassName; | 607 return kViewClassName; |
| 608 } | 608 } |
| 609 | 609 |
| 610 // Calculates all sizes that we can from the OS. | 610 // Calculates all sizes that we can from the OS. |
| 611 // | 611 // |
| 612 // This is invoked prior to Running a menu. | 612 // This is invoked prior to Running a menu. |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 } else { | 1067 } else { |
| 1068 const Type& type = menu_item->GetType(); | 1068 const Type& type = menu_item->GetType(); |
| 1069 if (type == CHECKBOX || type == RADIO) | 1069 if (type == CHECKBOX || type == RADIO) |
| 1070 return true; | 1070 return true; |
| 1071 } | 1071 } |
| 1072 } | 1072 } |
| 1073 return false; | 1073 return false; |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 } // namespace views | 1076 } // namespace views |
| OLD | NEW |