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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_view.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_view.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/mac/sdk_forward_declarations.h" 9 #include "base/mac/sdk_forward_declarations.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 // If the mouse up occurred in our view or over the close button, then 270 // If the mouse up occurred in our view or over the close button, then
271 // close. 271 // close.
272 if ([self hitTest:upLocation]) 272 if ([self hitTest:upLocation])
273 [controller_ closeTab:self]; 273 [controller_ closeTab:self];
274 } 274 }
275 } 275 }
276 276
277 // Returns the color used to draw the background of a tab. |selected| selects 277 // Returns the color used to draw the background of a tab. |selected| selects
278 // between the foreground and background tabs. 278 // between the foreground and background tabs.
279 - (NSColor*)backgroundColorForSelected:(bool)selected { 279 - (NSColor*)backgroundColorForSelected:(bool)selected {
280 ThemeService* themeProvider = 280 ui::ThemeProvider* themeProvider = [[self window] themeProvider];
281 static_cast<ThemeService*>([[self window] themeProvider]);
282 if (!themeProvider) 281 if (!themeProvider)
283 return [[self window] backgroundColor]; 282 return [[self window] backgroundColor];
284 283
285 int bitmapResources[2][2] = { 284 int bitmapResources[2][2] = {
286 // Background window. 285 // Background window.
287 { 286 {
288 IDR_THEME_TAB_BACKGROUND_INACTIVE, // Background tab. 287 IDR_THEME_TAB_BACKGROUND_INACTIVE, // Background tab.
289 IDR_THEME_TOOLBAR_INACTIVE, // Active tab. 288 IDR_THEME_TOOLBAR_INACTIVE, // Active tab.
290 }, 289 },
291 // Currently focused window. 290 // Currently focused window.
292 { 291 {
293 IDR_THEME_TAB_BACKGROUND, // Background tab. 292 IDR_THEME_TAB_BACKGROUND, // Background tab.
294 IDR_THEME_TOOLBAR, // Active tab. 293 IDR_THEME_TOOLBAR, // Active tab.
295 }, 294 },
296 }; 295 };
297 296
298 // Themes don't have an inactive image so only look for one if there's no 297 // Themes don't have an inactive image so only look for one if there's no
299 // theme. 298 // theme.
300 bool active = 299 bool active =
301 [[self window] isMainWindow] || !themeProvider->UsingDefaultTheme(); 300 [[self window] isMainWindow] || !themeProvider->UsingSystemTheme();
302 return themeProvider->GetNSImageColorNamed(bitmapResources[active][selected]); 301 return themeProvider->GetNSImageColorNamed(bitmapResources[active][selected]);
303 } 302 }
304 303
305 // Draws the tab background. 304 // Draws the tab background.
306 - (void)drawFill:(NSRect)dirtyRect { 305 - (void)drawFill:(NSRect)dirtyRect {
307 gfx::ScopedNSGraphicsContextSaveGState scopedGState; 306 gfx::ScopedNSGraphicsContextSaveGState scopedGState;
308 NSRect bounds = [self bounds]; 307 NSRect bounds = [self bounds];
309 308
310 NSRect clippingRect = bounds; 309 NSRect clippingRect = bounds;
311 clippingRect.size.height = kFillHeight; 310 clippingRect.size.height = kFillHeight;
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 } 704 }
706 705
707 if (nextUpdate < kNoUpdate) 706 if (nextUpdate < kNoUpdate)
708 [self performSelector:_cmd withObject:nil afterDelay:nextUpdate]; 707 [self performSelector:_cmd withObject:nil afterDelay:nextUpdate];
709 708
710 [self resetLastGlowUpdateTime]; 709 [self resetLastGlowUpdateTime];
711 [self setNeedsDisplay:YES]; 710 [self setNeedsDisplay:YES];
712 } 711 }
713 712
714 @end // @implementation TabView(Private) 713 @end // @implementation TabView(Private)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm ('k') | chrome/browser/ui/search/search_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698