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

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/tab_contents_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/tab_contents/tab_contents_controller.h" 5 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/mac/scoped_cftyperef.h" 9 #include "base/mac/scoped_cftyperef.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // view. 102 // view.
103 - (void)delegateDestroyed { 103 - (void)delegateDestroyed {
104 delegate_ = nil; 104 delegate_ = nil;
105 } 105 }
106 106
107 - (NSColor*)computeBackgroundColor { 107 - (NSColor*)computeBackgroundColor {
108 // This view is sometimes flashed into visibility (e.g, when closing 108 // This view is sometimes flashed into visibility (e.g, when closing
109 // windows or opening new tabs), so ensure that the flash be the theme 109 // windows or opening new tabs), so ensure that the flash be the theme
110 // background color in those cases. 110 // background color in those cases.
111 NSColor* backgroundColor = nil; 111 NSColor* backgroundColor = nil;
112 ThemeService* const theme = 112 ui::ThemeProvider* const theme = [[self window] themeProvider];
113 static_cast<ThemeService*>([[self window] themeProvider]);
114 if (theme) 113 if (theme)
115 backgroundColor = theme->GetNSColor(ThemeProperties::COLOR_NTP_BACKGROUND); 114 backgroundColor = theme->GetNSColor(ThemeProperties::COLOR_NTP_BACKGROUND);
116 if (!backgroundColor) 115 if (!backgroundColor)
117 backgroundColor = [NSColor whiteColor]; 116 backgroundColor = [NSColor whiteColor];
118 117
119 // If the page is in fullscreen tab capture mode, change the background color 118 // If the page is in fullscreen tab capture mode, change the background color
120 // to be a dark tint of the new tab page's background color. 119 // to be a dark tint of the new tab page's background color.
121 if ([delegate_ contentsInFullscreenCaptureMode]) { 120 if ([delegate_ contentsInFullscreenCaptureMode]) {
122 const float kDarknessFraction = 0.80f; 121 const float kDarknessFraction = 0.80f;
123 return [backgroundColor blendedColorWithFraction:kDarknessFraction 122 return [backgroundColor blendedColorWithFraction:kDarknessFraction
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } else { 346 } else {
348 rect.ClampToCenteredSize(gfx::Size( 347 rect.ClampToCenteredSize(gfx::Size(
349 static_cast<int>(x / captureSize.height()), rect.height())); 348 static_cast<int>(x / captureSize.height()), rect.height()));
350 } 349 }
351 } 350 }
352 351
353 return NSRectFromCGRect(rect.ToCGRect()); 352 return NSRectFromCGRect(rect.ToCGRect());
354 } 353 }
355 354
356 @end 355 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/styled_text_field_cell.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698