OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/views/toolbar/app_menu.h" | 5 #include "chrome/browser/ui/views/toolbar/app_menu.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 void Init(InMenuButtonBackground::ButtonType type) { | 258 void Init(InMenuButtonBackground::ButtonType type) { |
259 // An InMenuButton should always be focusable regardless of the platform. | 259 // An InMenuButton should always be focusable regardless of the platform. |
260 // Hence we don't use SetFocusForPlatform(). | 260 // Hence we don't use SetFocusForPlatform(). |
261 SetFocusBehavior(FocusBehavior::ALWAYS); | 261 SetFocusBehavior(FocusBehavior::ALWAYS); |
262 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 262 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
263 | 263 |
264 in_menu_background_ = new InMenuButtonBackground(type); | 264 in_menu_background_ = new InMenuButtonBackground(type); |
265 set_background(in_menu_background_); | 265 set_background(in_menu_background_); |
266 SetBorder( | 266 SetBorder( |
267 views::CreateEmptyBorder(0, kHorizontalPadding, 0, kHorizontalPadding)); | 267 views::CreateEmptyBorder(0, kHorizontalPadding, 0, kHorizontalPadding)); |
268 SetFontList(MenuConfig::instance().font_list); | 268 label()->SetFontList(MenuConfig::instance().font_list); |
269 } | 269 } |
270 | 270 |
271 void GetAccessibleNodeData(ui::AXNodeData* node_data) override { | 271 void GetAccessibleNodeData(ui::AXNodeData* node_data) override { |
272 LabelButton::GetAccessibleNodeData(node_data); | 272 LabelButton::GetAccessibleNodeData(node_data); |
273 node_data->role = ui::AX_ROLE_MENU_ITEM; | 273 node_data->role = ui::AX_ROLE_MENU_ITEM; |
274 } | 274 } |
275 | 275 |
276 // views::LabelButton | 276 // views::LabelButton |
277 void OnNativeThemeChanged(const ui::NativeTheme* theme) override { | 277 void OnNativeThemeChanged(const ui::NativeTheme* theme) override { |
278 if (theme) { | 278 if (theme) { |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 0, | 1236 0, |
1237 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 1237 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
1238 BOOKMARK_LAUNCH_LOCATION_APP_MENU); | 1238 BOOKMARK_LAUNCH_LOCATION_APP_MENU); |
1239 } | 1239 } |
1240 | 1240 |
1241 int AppMenu::ModelIndexFromCommandId(int command_id) const { | 1241 int AppMenu::ModelIndexFromCommandId(int command_id) const { |
1242 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); | 1242 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); |
1243 DCHECK(ix != command_id_to_entry_.end()); | 1243 DCHECK(ix != command_id_to_entry_.end()); |
1244 return ix->second.second; | 1244 return ix->second.second; |
1245 } | 1245 } |
OLD | NEW |