Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

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

Issue 2382443007: Clean up NativeTheme (particularly CommonTheme). (Closed)
Patch Set: two slight fixes Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 default: 188 default:
189 return theme->GetSystemColor( 189 return theme->GetSystemColor(
190 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor); 190 ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor);
191 } 191 }
192 } 192 }
193 193
194 static SkColor BackgroundColor(const View* view, 194 static SkColor BackgroundColor(const View* view,
195 views::Button::ButtonState state) { 195 views::Button::ButtonState state) {
196 const ui::NativeTheme* theme = view->GetNativeTheme(); 196 const ui::NativeTheme* theme = view->GetNativeTheme();
197 switch (state) { 197 switch (state) {
198 case views::Button::STATE_PRESSED:
199 return theme->GetSystemColor(
200 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor);
198 case views::Button::STATE_HOVERED: 201 case views::Button::STATE_HOVERED:
199 // Hovered should be handled in DrawBackground. 202 // Hovered should be handled in DrawBackground.
200 NOTREACHED(); 203 NOTREACHED();
201 return theme->GetSystemColor(
202 ui::NativeTheme::kColorId_HoverMenuItemBackgroundColor);
203 case views::Button::STATE_PRESSED:
204 return theme->GetSystemColor(
205 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor);
206 default: 204 default:
207 return theme->GetSystemColor( 205 return theme->GetSystemColor(
208 ui::NativeTheme::kColorId_MenuBackgroundColor); 206 ui::NativeTheme::kColorId_MenuBackgroundColor);
209 } 207 }
210 } 208 }
211 209
212 void DrawBackground(gfx::Canvas* canvas, 210 void DrawBackground(gfx::Canvas* canvas,
213 const views::View* view, 211 const views::View* view,
214 const gfx::Rect& bounds, 212 const gfx::Rect& bounds,
215 views::Button::ButtonState state) const { 213 views::Button::ButtonState state) const {
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 0, 1248 0,
1251 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, 1249 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS,
1252 BOOKMARK_LAUNCH_LOCATION_APP_MENU); 1250 BOOKMARK_LAUNCH_LOCATION_APP_MENU);
1253 } 1251 }
1254 1252
1255 int AppMenu::ModelIndexFromCommandId(int command_id) const { 1253 int AppMenu::ModelIndexFromCommandId(int command_id) const {
1256 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); 1254 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id);
1257 DCHECK(ix != command_id_to_entry_.end()); 1255 DCHECK(ix != command_id_to_entry_.end());
1258 return ix->second.second; 1256 return ix->second.second;
1259 } 1257 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698