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

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

Issue 135003002: Make the apparance of pressed and hover state the same (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/wrench_menu.h" 5 #include "chrome/browser/ui/views/toolbar/wrench_menu.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 10
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 default: 289 default:
290 return theme->GetSystemColor( 290 return theme->GetSystemColor(
291 ui::NativeTheme::kColorId_MenuBackgroundColor); 291 ui::NativeTheme::kColorId_MenuBackgroundColor);
292 } 292 }
293 } 293 }
294 294
295 void DrawBackground(gfx::Canvas* canvas, 295 void DrawBackground(gfx::Canvas* canvas,
296 const views::View* view, 296 const views::View* view,
297 const gfx::Rect& bounds, 297 const gfx::Rect& bounds,
298 views::Button::ButtonState state) const { 298 views::Button::ButtonState state) const {
299 if (state == views::Button::STATE_HOVERED) { 299 if (state == views::Button::STATE_HOVERED ||
300 state == views::Button::STATE_PRESSED) {
300 view->GetNativeTheme()->Paint(canvas->sk_canvas(), 301 view->GetNativeTheme()->Paint(canvas->sk_canvas(),
301 ui::NativeTheme::kMenuItemBackground, 302 ui::NativeTheme::kMenuItemBackground,
302 ui::NativeTheme::kHovered, 303 ui::NativeTheme::kHovered,
303 bounds, 304 bounds,
304 ui::NativeTheme::ExtraParams()); 305 ui::NativeTheme::ExtraParams());
305 return; 306 return;
306 } 307 }
307 if (use_new_menu_) 308 if (use_new_menu_)
308 return; 309 return;
309 canvas->FillRect(bounds, BackgroundColor(view, state)); 310 canvas->FillRect(bounds, BackgroundColor(view, state));
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 fullscreen_button_ = new FullscreenButton(this); 642 fullscreen_button_ = new FullscreenButton(this);
642 // all buttons on menu should must be a custom button in order for 643 // all buttons on menu should must be a custom button in order for
643 // the keyboard nativigation work. 644 // the keyboard nativigation work.
644 DCHECK(CustomButton::AsCustomButton(fullscreen_button_)); 645 DCHECK(CustomButton::AsCustomButton(fullscreen_button_));
645 gfx::ImageSkia* full_screen_image = 646 gfx::ImageSkia* full_screen_image =
646 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 647 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
647 IDR_FULLSCREEN_MENU_BUTTON); 648 IDR_FULLSCREEN_MENU_BUTTON);
648 fullscreen_button_->SetImage(ImageButton::STATE_NORMAL, full_screen_image); 649 fullscreen_button_->SetImage(ImageButton::STATE_NORMAL, full_screen_image);
649 SkColor fg_color = native_theme->GetSystemColor( 650 SkColor fg_color = native_theme->GetSystemColor(
650 ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor); 651 ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor);
652 gfx::ImageSkia hovered_fullscreen_image(
653 new HoveredImageSource(*full_screen_image, fg_color),
654 full_screen_image->size());
651 fullscreen_button_->SetImage( 655 fullscreen_button_->SetImage(
652 ImageButton::STATE_HOVERED, 656 ImageButton::STATE_HOVERED, &hovered_fullscreen_image);
653 new gfx::ImageSkia(new HoveredImageSource(*full_screen_image, fg_color), 657 fullscreen_button_->SetImage(
654 full_screen_image->size())); 658 ImageButton::STATE_PRESSED, &hovered_fullscreen_image);
659
655 SkColor enabled_text_color = native_theme->GetSystemColor( 660 SkColor enabled_text_color = native_theme->GetSystemColor(
656 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); 661 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor);
657 zoom_label_->SetEnabledColor(enabled_text_color); 662 zoom_label_->SetEnabledColor(enabled_text_color);
658 decrement_button_->SetTextColor(views::Button::STATE_NORMAL, 663 decrement_button_->SetTextColor(views::Button::STATE_NORMAL,
659 enabled_text_color); 664 enabled_text_color);
660 increment_button_->SetTextColor(views::Button::STATE_NORMAL, 665 increment_button_->SetTextColor(views::Button::STATE_NORMAL,
661 enabled_text_color); 666 enabled_text_color);
662 SkColor disabled_text_color = native_theme->GetSystemColor( 667 SkColor disabled_text_color = native_theme->GetSystemColor(
663 ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor); 668 ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor);
664 decrement_button_->SetTextColor(views::Button::STATE_DISABLED, 669 decrement_button_->SetTextColor(views::Button::STATE_DISABLED,
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 0, 1366 0,
1362 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, 1367 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS,
1363 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); 1368 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU);
1364 } 1369 }
1365 1370
1366 int WrenchMenu::ModelIndexFromCommandId(int command_id) const { 1371 int WrenchMenu::ModelIndexFromCommandId(int command_id) const {
1367 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); 1372 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id);
1368 DCHECK(ix != command_id_to_entry_.end()); 1373 DCHECK(ix != command_id_to_entry_.end());
1369 return ix->second.second; 1374 return ix->second.second;
1370 } 1375 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698