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

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

Issue 2718503002: [Mac] Reverse tab alert buttons (i.e. audio) in RTL (Closed)
Patch Set: Created 3 years, 10 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 | no next file » | 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"
11 #import "chrome/browser/ui/cocoa/l10n_util.h"
11 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 12 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
12 #include "content/public/browser/user_metrics.h" 13 #include "content/public/browser/user_metrics.h"
13 #include "ui/gfx/animation/animation.h" 14 #include "ui/gfx/animation/animation.h"
14 #include "ui/gfx/animation/animation_delegate.h" 15 #include "ui/gfx/animation/animation_delegate.h"
15 #include "ui/gfx/image/image.h" 16 #include "ui/gfx/image/image.h"
16 17
17 namespace { 18 namespace {
18 19
19 // The minimum required click-to-select area of an inactive tab before allowing 20 // The minimum required click-to-select area of an inactive tab before allowing
20 // the click-to-mute functionality to be enabled. This value is in terms of 21 // the click-to-mute functionality to be enabled. This value is in terms of
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // is moved into another window, make sure that it updates the theme. 79 // is moved into another window, make sure that it updates the theme.
79 [self updateIconForState:showingAlertState_]; 80 [self updateIconForState:showingAlertState_];
80 } 81 }
81 82
82 - (void)updateIconForState:(TabAlertState)aState { 83 - (void)updateIconForState:(TabAlertState)aState {
83 if (aState != TabAlertState::NONE) { 84 if (aState != TabAlertState::NONE) {
84 TabView* const tabView = base::mac::ObjCCast<TabView>([self superview]); 85 TabView* const tabView = base::mac::ObjCCast<TabView>([self superview]);
85 SkColor iconColor = [tabView iconColor]; 86 SkColor iconColor = [tabView iconColor];
86 NSImage* tabIndicatorImage = 87 NSImage* tabIndicatorImage =
87 chrome::GetTabAlertIndicatorImage(aState, iconColor).ToNSImage(); 88 chrome::GetTabAlertIndicatorImage(aState, iconColor).ToNSImage();
89 NSImage* affordanceImage =
90 chrome::GetTabAlertIndicatorAffordanceImage(aState, iconColor)
91 .ToNSImage();
92 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) {
93 tabIndicatorImage = cocoa_l10n_util::FlippedImage(tabIndicatorImage);
94 affordanceImage = cocoa_l10n_util::FlippedImage(affordanceImage);
Avi (use Gerrit) 2017/02/23 18:55:39 Both at once! 👍
95 }
88 [self setImage:tabIndicatorImage]; 96 [self setImage:tabIndicatorImage];
89 affordanceImage_.reset( 97 affordanceImage_.reset([affordanceImage retain]);
90 [chrome::GetTabAlertIndicatorAffordanceImage(aState, iconColor)
91 .ToNSImage() retain]);
92 } 98 }
93 } 99 }
94 100
95 - (void)transitionToAlertState:(TabAlertState)nextState { 101 - (void)transitionToAlertState:(TabAlertState)nextState {
96 if (nextState == alertState_) 102 if (nextState == alertState_)
97 return; 103 return;
98 104
99 [self updateIconForState:nextState]; 105 [self updateIconForState:nextState];
100 106
101 if ((alertState_ == TabAlertState::AUDIO_PLAYING && 107 if ((alertState_ == TabAlertState::AUDIO_PLAYING &&
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 - (void)windowDidChangeTheme { 309 - (void)windowDidChangeTheme {
304 // Force the alert icon to update because the icon color may change based 310 // Force the alert icon to update because the icon color may change based
305 // on the current theme. 311 // on the current theme.
306 [self updateIconForState:alertState_]; 312 [self updateIconForState:alertState_];
307 } 313 }
308 314
309 - (void)windowDidChangeActive { 315 - (void)windowDidChangeActive {
310 } 316 }
311 317
312 @end 318 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698