| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |