| OLD | NEW |
| 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 #import "chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 - (void)viewDidMoveToWindow { | 76 - (void)viewDidMoveToWindow { |
| 77 // In Material Design, the icon color depends on the theme. When the tab | 77 // In Material Design, the icon color depends on the theme. When the tab |
| 78 // is moved into another window, make sure that it updates the theme. | 78 // is moved into another window, make sure that it updates the theme. |
| 79 [self updateIconForState:showingAlertState_]; | 79 [self updateIconForState:showingAlertState_]; |
| 80 } | 80 } |
| 81 | 81 |
| 82 - (void)updateIconForState:(TabAlertState)aState { | 82 - (void)updateIconForState:(TabAlertState)aState { |
| 83 if (aState != TabAlertState::NONE) { | 83 if (aState != TabAlertState::NONE) { |
| 84 TabView* const tabView = base::mac::ObjCCast<TabView>([self superview]); | 84 TabView* const tabView = base::mac::ObjCCast<TabView>([self superview]); |
| 85 SkColor iconColor = [tabView closeButtonColor]; | 85 SkColor iconColor = [tabView iconColor]; |
| 86 NSImage* tabIndicatorImage = | 86 NSImage* tabIndicatorImage = |
| 87 chrome::GetTabAlertIndicatorImage(aState, iconColor).ToNSImage(); | 87 chrome::GetTabAlertIndicatorImage(aState, iconColor).ToNSImage(); |
| 88 [self setImage:tabIndicatorImage]; | 88 [self setImage:tabIndicatorImage]; |
| 89 affordanceImage_.reset( | 89 affordanceImage_.reset( |
| 90 [chrome::GetTabAlertIndicatorAffordanceImage(aState, iconColor) | 90 [chrome::GetTabAlertIndicatorAffordanceImage(aState, iconColor) |
| 91 .ToNSImage() retain]); | 91 .ToNSImage() retain]); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 - (void)transitionToAlertState:(TabAlertState)nextState { | 95 - (void)transitionToAlertState:(TabAlertState)nextState { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 - (void)windowDidChangeTheme { | 303 - (void)windowDidChangeTheme { |
| 304 // Force the alert icon to update because the icon color may change based | 304 // Force the alert icon to update because the icon color may change based |
| 305 // on the current theme. | 305 // on the current theme. |
| 306 [self updateIconForState:alertState_]; | 306 [self updateIconForState:alertState_]; |
| 307 } | 307 } |
| 308 | 308 |
| 309 - (void)windowDidChangeActive { | 309 - (void)windowDidChangeActive { |
| 310 } | 310 } |
| 311 | 311 |
| 312 @end | 312 @end |
| OLD | NEW |