Chromium Code Reviews

Side by Side Diff: chrome/browser/ui/views/toolbar/app_menu.cc

Issue 2801583002: Use views::style for buttons, bootstrap ash_typography to do so. (Closed)
Patch Set: More self review Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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 241 matching lines...)
252 class InMenuButton : public LabelButton { 252 class InMenuButton : public LabelButton {
253 public: 253 public:
254 InMenuButton(views::ButtonListener* listener, const base::string16& text) 254 InMenuButton(views::ButtonListener* listener, const base::string16& text)
255 : LabelButton(listener, text), in_menu_background_(NULL) {} 255 : LabelButton(listener, text), in_menu_background_(NULL) {}
256 ~InMenuButton() override {} 256 ~InMenuButton() override {}
257 257
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);
tapted 2017/04/07 07:49:52 (I wonder if horizontal alignment should be part o
Peter Kasting 2017/04/08 01:38:54 My instinct is no, but not sure.
tapted 2017/04/10 12:27:33 Acknowledged.
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);
tapted 2017/04/07 07:49:52 this font_list is a special one for Windows. When
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...)
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 }
OLDNEW

Powered by Google App Engine