| 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 "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 &left_icon_margin_, | 971 &left_icon_margin_, |
| 972 &right_icon_margin_); | 972 &right_icon_margin_); |
| 973 } else { | 973 } else { |
| 974 left_icon_margin_ = 0; | 974 left_icon_margin_ = 0; |
| 975 right_icon_margin_ = 0; | 975 right_icon_margin_ = 0; |
| 976 } | 976 } |
| 977 int label_start = GetLabelStartForThisItem(); | 977 int label_start = GetLabelStartForThisItem(); |
| 978 | 978 |
| 979 int string_width = font.GetStringWidth(title_); | 979 int string_width = font.GetStringWidth(title_); |
| 980 if (!subtitle_.empty()) | 980 if (!subtitle_.empty()) |
| 981 string_width = std::max(string_width, font.GetStringWidth(subtitle_)); | 981 string_width = std::max<int>(string_width, font.GetStringWidth(subtitle_)); |
| 982 | 982 |
| 983 dimensions.standard_width = string_width + label_start + | 983 dimensions.standard_width = string_width + label_start + |
| 984 item_right_margin_; | 984 item_right_margin_; |
| 985 // Determine the length of the right-side text. | 985 // Determine the length of the right-side text. |
| 986 string16 minor_text = GetMinorText(); | 986 string16 minor_text = GetMinorText(); |
| 987 dimensions.minor_text_width = | 987 dimensions.minor_text_width = |
| 988 minor_text.empty() ? 0 : GetFont().GetStringWidth(minor_text); | 988 minor_text.empty() ? 0 : GetFont().GetStringWidth(minor_text); |
| 989 | 989 |
| 990 // Determine the height to use. | 990 // Determine the height to use. |
| 991 dimensions.height = std::max(dimensions.height, | 991 dimensions.height = std::max(dimensions.height, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 } else { | 1056 } else { |
| 1057 const Type& type = menu_item->GetType(); | 1057 const Type& type = menu_item->GetType(); |
| 1058 if (type == CHECKBOX || type == RADIO) | 1058 if (type == CHECKBOX || type == RADIO) |
| 1059 return true; | 1059 return true; |
| 1060 } | 1060 } |
| 1061 } | 1061 } |
| 1062 return false; | 1062 return false; |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 } // namespace views | 1065 } // namespace views |
| OLD | NEW |