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

Side by Side Diff: chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc

Issue 1661673004: Enables hot-tracking for overflow extension buttons in the app menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restores hot-tracking of extension buttons in app menu with MD Created 4 years, 10 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/libgtk2ui/native_theme_gtk2.h" 5 #include "chrome/browser/ui/libgtk2ui/native_theme_gtk2.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h" 9 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h"
10 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_menu_subclasses.h" 10 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_menu_subclasses.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } else { 192 } else {
193 canvas->drawColor(GetSystemColor(kColorId_MenuBackgroundColor), 193 canvas->drawColor(GetSystemColor(kColorId_MenuBackgroundColor),
194 SkXfermode::kSrc_Mode); 194 SkXfermode::kSrc_Mode);
195 } 195 }
196 } 196 }
197 197
198 void NativeThemeGtk2::PaintMenuItemBackground( 198 void NativeThemeGtk2::PaintMenuItemBackground(
199 SkCanvas* canvas, 199 SkCanvas* canvas,
200 State state, 200 State state,
201 const gfx::Rect& rect, 201 const gfx::Rect& rect,
202 const MenuListExtraParams& menu_list) const { 202 const MenuItemExtraParams& menu_item) const {
203 SkColor color; 203 SkColor color;
204 SkPaint paint; 204 SkPaint paint;
205 switch (state) { 205 switch (state) {
206 case NativeTheme::kNormal: 206 case NativeTheme::kNormal:
207 case NativeTheme::kDisabled: 207 case NativeTheme::kDisabled:
208 color = GetSystemColor(NativeTheme::kColorId_MenuBackgroundColor); 208 color = GetSystemColor(NativeTheme::kColorId_MenuBackgroundColor);
209 paint.setColor(color); 209 paint.setColor(color);
210 break; 210 break;
211 case NativeTheme::kHovered: 211 case NativeTheme::kHovered:
212 color = GetSystemColor( 212 color = GetSystemColor(
213 NativeTheme::kColorId_FocusedMenuItemBackgroundColor); 213 NativeTheme::kColorId_FocusedMenuItemBackgroundColor);
214 paint.setColor(color); 214 paint.setColor(color);
215 break; 215 break;
216 default: 216 default:
217 NOTREACHED() << "Invalid state " << state; 217 NOTREACHED() << "Invalid state " << state;
218 break; 218 break;
219 } 219 }
220 if (menu_item.corner_radius > 0) {
221 canvas->drawRoundRect(gfx::RectToSkRect(rect),
222 SkIntToScalar(menu_item.corner_radius),
223 SkIntToScalar(menu_item.corner_radius), paint);
224 return;
225 }
220 canvas->drawRect(gfx::RectToSkRect(rect), paint); 226 canvas->drawRect(gfx::RectToSkRect(rect), paint);
221 } 227 }
222 228
223 SkColor NativeThemeGtk2::GetSystemColor(ColorId color_id) const { 229 SkColor NativeThemeGtk2::GetSystemColor(ColorId color_id) const {
224 const SkColor kPositiveTextColor = SkColorSetRGB(0x0b, 0x80, 0x43); 230 const SkColor kPositiveTextColor = SkColorSetRGB(0x0b, 0x80, 0x43);
225 const SkColor kNegativeTextColor = SkColorSetRGB(0xc5, 0x39, 0x29); 231 const SkColor kNegativeTextColor = SkColorSetRGB(0xc5, 0x39, 0x29);
226 232
227 switch (color_id) { 233 switch (color_id) {
228 // Windows 234 // Windows
229 case kColorId_WindowBackground: 235 case kColorId_WindowBackground:
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 574
569 if (!fake_menu_item) { 575 if (!fake_menu_item) {
570 fake_menu_item = gtk_custom_menu_item_new(); 576 fake_menu_item = gtk_custom_menu_item_new();
571 gtk_menu_shell_append(GTK_MENU_SHELL(GetMenu()), fake_menu_item); 577 gtk_menu_shell_append(GTK_MENU_SHELL(GetMenu()), fake_menu_item);
572 } 578 }
573 579
574 return fake_menu_item; 580 return fake_menu_item;
575 } 581 }
576 582
577 } // namespace libgtk2ui 583 } // namespace libgtk2ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698