| 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "ui/base/l10n/l10n_util.h" | 6 #include "ui/base/l10n/l10n_util.h" |
| 7 #include "ui/base/models/menu_model.h" | 7 #include "ui/base/models/menu_model.h" |
| 8 #include "ui/base/models/menu_model_delegate.h" | 8 #include "ui/base/models/menu_model_delegate.h" |
| 9 #include "ui/views/controls/menu/menu_item_view.h" | 9 #include "ui/views/controls/menu/menu_item_view.h" |
| 10 #include "ui/views/controls/menu/menu_model_adapter.h" | 10 #include "ui/views/controls/menu/menu_model_adapter.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual int GetItemCount() const OVERRIDE { | 45 virtual int GetItemCount() const OVERRIDE { |
| 46 return static_cast<int>(items_.size()); | 46 return static_cast<int>(items_.size()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual ItemType GetTypeAt(int index) const OVERRIDE { | 49 virtual ItemType GetTypeAt(int index) const OVERRIDE { |
| 50 return items_[index - GetFirstItemIndex(NULL)].type; | 50 return items_[index - GetFirstItemIndex(NULL)].type; |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual ui::MenuSeparatorType GetSeparatorTypeAt( |
| 54 int index) const OVERRIDE { |
| 55 return ui::NORMAL_SEPARATOR; |
| 56 } |
| 57 |
| 53 virtual int GetCommandIdAt(int index) const OVERRIDE { | 58 virtual int GetCommandIdAt(int index) const OVERRIDE { |
| 54 return index - GetFirstItemIndex(NULL) + command_id_base_; | 59 return index - GetFirstItemIndex(NULL) + command_id_base_; |
| 55 } | 60 } |
| 56 | 61 |
| 57 string16 GetLabelAt(int index) const OVERRIDE { | 62 string16 GetLabelAt(int index) const OVERRIDE { |
| 58 return items_[index - GetFirstItemIndex(NULL)].label; | 63 return items_[index - GetFirstItemIndex(NULL)].label; |
| 59 } | 64 } |
| 60 | 65 |
| 61 virtual bool IsItemDynamicAt(int index) const OVERRIDE { | 66 virtual bool IsItemDynamicAt(int index) const OVERRIDE { |
| 62 return false; | 67 return false; |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 submodel->set_last_activation(-1); | 304 submodel->set_last_activation(-1); |
| 300 } | 305 } |
| 301 | 306 |
| 302 // Check that selecting the root item is safe. The MenuModel does | 307 // Check that selecting the root item is safe. The MenuModel does |
| 303 // not care about the root so MenuModelAdapter should do nothing | 308 // not care about the root so MenuModelAdapter should do nothing |
| 304 // (not hit the NOTREACHED check) when the root is selected. | 309 // (not hit the NOTREACHED check) when the root is selected. |
| 305 static_cast<views::MenuDelegate*>(&delegate)->SelectionChanged(menu); | 310 static_cast<views::MenuDelegate*>(&delegate)->SelectionChanged(menu); |
| 306 } | 311 } |
| 307 | 312 |
| 308 } // namespace views | 313 } // namespace views |
| OLD | NEW |