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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 1492423003: Rejigger ThemeService: move exposure of ThemeProvider interface to a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix that unittest Created 5 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <limits> 10 #include <limits>
(...skipping 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 2351
2352 - (TabMediaState)mediaStateForContents:(content::WebContents*)contents { 2352 - (TabMediaState)mediaStateForContents:(content::WebContents*)contents {
2353 return chrome::GetTabMediaStateForContents(contents); 2353 return chrome::GetTabMediaStateForContents(contents);
2354 } 2354 }
2355 2355
2356 - (void)themeDidChangeNotification:(NSNotification*)notification { 2356 - (void)themeDidChangeNotification:(NSNotification*)notification {
2357 [self setNewTabImages]; 2357 [self setNewTabImages];
2358 } 2358 }
2359 2359
2360 - (void)setNewTabImages { 2360 - (void)setNewTabImages {
2361 ThemeService *theme = 2361 ui::ThemeProvider* theme = [[tabStripView_ window] themeProvider];
2362 static_cast<ThemeService*>([[tabStripView_ window] themeProvider]);
2363 if (!theme) 2362 if (!theme)
2364 return; 2363 return;
2365 2364
2366 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 2365 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
2367 NSImage* mask = rb.GetNativeImageNamed(IDR_NEWTAB_BUTTON_MASK).ToNSImage(); 2366 NSImage* mask = rb.GetNativeImageNamed(IDR_NEWTAB_BUTTON_MASK).ToNSImage();
2368 NSImage* normal = rb.GetNativeImageNamed(IDR_NEWTAB_BUTTON).ToNSImage(); 2367 NSImage* normal = rb.GetNativeImageNamed(IDR_NEWTAB_BUTTON).ToNSImage();
2369 NSImage* hover = rb.GetNativeImageNamed(IDR_NEWTAB_BUTTON_H).ToNSImage(); 2368 NSImage* hover = rb.GetNativeImageNamed(IDR_NEWTAB_BUTTON_H).ToNSImage();
2370 NSImage* pressed = rb.GetNativeImageNamed(IDR_NEWTAB_BUTTON_P).ToNSImage(); 2369 NSImage* pressed = rb.GetNativeImageNamed(IDR_NEWTAB_BUTTON_P).ToNSImage();
2371 2370
2372 NSImage* foreground = ApplyMask( 2371 NSImage* foreground = ApplyMask(
2373 theme->GetNSImageNamed(IDR_THEME_TAB_BACKGROUND), mask); 2372 theme->GetNSImageNamed(IDR_THEME_TAB_BACKGROUND), mask);
2374 2373
2375 [[newTabButton_ cell] setImage:Overlay(foreground, normal, 1.0) 2374 [[newTabButton_ cell] setImage:Overlay(foreground, normal, 1.0)
2376 forButtonState:image_button_cell::kDefaultState]; 2375 forButtonState:image_button_cell::kDefaultState];
2377 [[newTabButton_ cell] setImage:Overlay(foreground, hover, 1.0) 2376 [[newTabButton_ cell] setImage:Overlay(foreground, hover, 1.0)
2378 forButtonState:image_button_cell::kHoverState]; 2377 forButtonState:image_button_cell::kHoverState];
2379 [[newTabButton_ cell] setImage:Overlay(foreground, pressed, 1.0) 2378 [[newTabButton_ cell] setImage:Overlay(foreground, pressed, 1.0)
2380 forButtonState:image_button_cell::kPressedState]; 2379 forButtonState:image_button_cell::kPressedState];
2381 2380
2382 // IDR_THEME_TAB_BACKGROUND_INACTIVE is only used with the default theme. 2381 // IDR_THEME_TAB_BACKGROUND_INACTIVE is only used with the default theme.
2383 if (theme->UsingDefaultTheme()) { 2382 if (theme->UsingSystemTheme()) {
2384 const CGFloat alpha = tabs::kImageNoFocusAlpha; 2383 const CGFloat alpha = tabs::kImageNoFocusAlpha;
2385 NSImage* background = ApplyMask( 2384 NSImage* background = ApplyMask(
2386 theme->GetNSImageNamed(IDR_THEME_TAB_BACKGROUND_INACTIVE), mask); 2385 theme->GetNSImageNamed(IDR_THEME_TAB_BACKGROUND_INACTIVE), mask);
2387 [[newTabButton_ cell] setImage:Overlay(background, normal, alpha) 2386 [[newTabButton_ cell] setImage:Overlay(background, normal, alpha)
2388 forButtonState:image_button_cell::kDefaultStateBackground]; 2387 forButtonState:image_button_cell::kDefaultStateBackground];
2389 [[newTabButton_ cell] setImage:Overlay(background, hover, alpha) 2388 [[newTabButton_ cell] setImage:Overlay(background, hover, alpha)
2390 forButtonState:image_button_cell::kHoverStateBackground]; 2389 forButtonState:image_button_cell::kHoverStateBackground];
2391 } else { 2390 } else {
2392 [[newTabButton_ cell] setImage:nil 2391 [[newTabButton_ cell] setImage:nil
2393 forButtonState:image_button_cell::kDefaultStateBackground]; 2392 forButtonState:image_button_cell::kDefaultStateBackground];
2394 [[newTabButton_ cell] setImage:nil 2393 [[newTabButton_ cell] setImage:nil
2395 forButtonState:image_button_cell::kHoverStateBackground]; 2394 forButtonState:image_button_cell::kHoverStateBackground];
2396 } 2395 }
2397 } 2396 }
2398 2397
2399 @end 2398 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698