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 "chrome/browser/chromeos/status/network_menu.h" | 5 #include "chrome/browser/chromeos/status/network_menu.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 const MenuItemVector& menu_items() const { return menu_items_; } | 117 const MenuItemVector& menu_items() const { return menu_items_; } |
118 | 118 |
119 // ui::MenuModel implementation | 119 // ui::MenuModel implementation |
120 // GetCommandIdAt() must be implemented by subclasses. | 120 // GetCommandIdAt() must be implemented by subclasses. |
121 virtual bool HasIcons() const OVERRIDE; | 121 virtual bool HasIcons() const OVERRIDE; |
122 virtual int GetItemCount() const OVERRIDE; | 122 virtual int GetItemCount() const OVERRIDE; |
123 virtual ui::MenuModel::ItemType GetTypeAt(int index) const OVERRIDE; | 123 virtual ui::MenuModel::ItemType GetTypeAt(int index) const OVERRIDE; |
124 virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const OVERRIDE; | 124 virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const OVERRIDE; |
125 virtual base::string16 GetLabelAt(int index) const OVERRIDE; | 125 virtual base::string16 GetLabelAt(int index) const OVERRIDE; |
126 virtual bool IsItemDynamicAt(int index) const OVERRIDE; | 126 virtual bool IsItemDynamicAt(int index) const OVERRIDE; |
127 virtual const gfx::Font* GetLabelFontAt(int index) const OVERRIDE; | 127 virtual const gfx::FontList* GetLabelFontListAt(int index) const OVERRIDE; |
128 virtual bool GetAcceleratorAt(int index, | 128 virtual bool GetAcceleratorAt(int index, |
129 ui::Accelerator* accelerator) const OVERRIDE; | 129 ui::Accelerator* accelerator) const OVERRIDE; |
130 virtual bool IsItemCheckedAt(int index) const OVERRIDE; | 130 virtual bool IsItemCheckedAt(int index) const OVERRIDE; |
131 virtual int GetGroupIdAt(int index) const OVERRIDE; | 131 virtual int GetGroupIdAt(int index) const OVERRIDE; |
132 virtual bool GetIconAt(int index, gfx::Image* icon) OVERRIDE; | 132 virtual bool GetIconAt(int index, gfx::Image* icon) OVERRIDE; |
133 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( | 133 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( |
134 int index) const OVERRIDE; | 134 int index) const OVERRIDE; |
135 virtual bool IsEnabledAt(int index) const OVERRIDE; | 135 virtual bool IsEnabledAt(int index) const OVERRIDE; |
136 virtual bool IsVisibleAt(int index) const OVERRIDE; | 136 virtual bool IsVisibleAt(int index) const OVERRIDE; |
137 virtual ui::MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; | 137 virtual ui::MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 | 238 |
239 base::string16 NetworkMenuModel::GetLabelAt(int index) const { | 239 base::string16 NetworkMenuModel::GetLabelAt(int index) const { |
240 return menu_items_[index].label; | 240 return menu_items_[index].label; |
241 } | 241 } |
242 | 242 |
243 bool NetworkMenuModel::IsItemDynamicAt(int index) const { | 243 bool NetworkMenuModel::IsItemDynamicAt(int index) const { |
244 return false; | 244 return false; |
245 } | 245 } |
246 | 246 |
247 const gfx::Font* NetworkMenuModel::GetLabelFontAt(int index) const { | 247 const gfx::FontList* NetworkMenuModel::GetLabelFontListAt(int index) const { |
248 const gfx::Font* font = NULL; | 248 const gfx::FontList* font_list = NULL; |
249 if (menu_items_[index].flags & FLAG_ASSOCIATED) { | 249 if (menu_items_[index].flags & FLAG_ASSOCIATED) { |
250 ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance(); | 250 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
251 font = &resource_bundle.GetFont( | 251 font_list = &rb.GetFontList(browser_defaults::kAssociatedNetworkFontStyle); |
252 browser_defaults::kAssociatedNetworkFontStyle); | |
253 } | 252 } |
254 | 253 |
255 return font; | 254 return font_list; |
256 } | 255 } |
257 | 256 |
258 bool NetworkMenuModel::GetAcceleratorAt(int index, | 257 bool NetworkMenuModel::GetAcceleratorAt(int index, |
259 ui::Accelerator* accelerator) const { | 258 ui::Accelerator* accelerator) const { |
260 return false; | 259 return false; |
261 } | 260 } |
262 | 261 |
263 bool NetworkMenuModel::IsItemCheckedAt(int index) const { | 262 bool NetworkMenuModel::IsItemCheckedAt(int index) const { |
264 // All ui::MenuModel::TYPE_CHECK menu items are checked. | 263 // All ui::MenuModel::TYPE_CHECK menu items are checked. |
265 return true; | 264 return true; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 return main_menu_model_.get(); | 673 return main_menu_model_.get(); |
675 } | 674 } |
676 | 675 |
677 void NetworkMenu::UpdateMenu() { | 676 void NetworkMenu::UpdateMenu() { |
678 refreshing_menu_ = true; | 677 refreshing_menu_ = true; |
679 main_menu_model_->InitMenuItems(delegate_->ShouldOpenButtonOptions()); | 678 main_menu_model_->InitMenuItems(delegate_->ShouldOpenButtonOptions()); |
680 refreshing_menu_ = false; | 679 refreshing_menu_ = false; |
681 } | 680 } |
682 | 681 |
683 } // namespace chromeos | 682 } // namespace chromeos |
OLD | NEW |