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

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

Issue 2126953002: [Material][Mac] Fix the indicator and close button in a dragged tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up Created 4 years, 5 months 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/tabs/tab_window_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 [super setAction:@selector(handleClick:)]; 66 [super setAction:@selector(handleClick:)];
67 } 67 }
68 return self; 68 return self;
69 } 69 }
70 70
71 - (void)removeFromSuperview { 71 - (void)removeFromSuperview {
72 fadeAnimation_.reset(); 72 fadeAnimation_.reset();
73 [super removeFromSuperview]; 73 [super removeFromSuperview];
74 } 74 }
75 75
76 - (void)viewDidMoveToWindow {
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.
79 [self updateIconForState:showingAlertState_];
80 }
81
76 - (void)updateIconForState:(TabAlertState)aState { 82 - (void)updateIconForState:(TabAlertState)aState {
77 if (aState != TabAlertState::NONE) { 83 if (aState != TabAlertState::NONE) {
78 TabView* const tabView = base::mac::ObjCCast<TabView>([self superview]); 84 TabView* const tabView = base::mac::ObjCCast<TabView>([self superview]);
79 SkColor iconColor = [tabView closeButtonColor]; 85 SkColor iconColor = [tabView closeButtonColor];
80 NSImage* tabIndicatorImage = 86 NSImage* tabIndicatorImage =
81 chrome::GetTabAlertIndicatorImage(aState, iconColor).ToNSImage(); 87 chrome::GetTabAlertIndicatorImage(aState, iconColor).ToNSImage();
82 [self setImage:tabIndicatorImage]; 88 [self setImage:tabIndicatorImage];
83 affordanceImage_.reset( 89 affordanceImage_.reset(
84 [chrome::GetTabAlertIndicatorAffordanceImage(aState, iconColor) 90 [chrome::GetTabAlertIndicatorAffordanceImage(aState, iconColor)
85 .ToNSImage() retain]); 91 .ToNSImage() retain]);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 - (void)windowDidChangeTheme { 303 - (void)windowDidChangeTheme {
298 // 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
299 // on the current theme. 305 // on the current theme.
300 [self updateIconForState:alertState_]; 306 [self updateIconForState:alertState_];
301 } 307 }
302 308
303 - (void)windowDidChangeActive { 309 - (void)windowDidChangeActive {
304 } 310 }
305 311
306 @end 312 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/tabs/tab_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698