| 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/media_indicator_button_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/tabs/media_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/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" | 10 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 fadeAnimation_.reset(); | 70 fadeAnimation_.reset(); |
| 71 [super removeFromSuperview]; | 71 [super removeFromSuperview]; |
| 72 } | 72 } |
| 73 | 73 |
| 74 - (void)transitionToMediaState:(TabMediaState)nextState { | 74 - (void)transitionToMediaState:(TabMediaState)nextState { |
| 75 if (nextState == mediaState_) | 75 if (nextState == mediaState_) |
| 76 return; | 76 return; |
| 77 | 77 |
| 78 if (nextState != TAB_MEDIA_STATE_NONE) { | 78 if (nextState != TAB_MEDIA_STATE_NONE) { |
| 79 [self | 79 [self |
| 80 setImage:chrome::GetTabMediaIndicatorImage(nextState, nil).ToNSImage()]; | 80 setImage:chrome::GetTabMediaIndicatorImage(nextState, 0).ToNSImage()]; |
| 81 affordanceImage_.reset( | 81 affordanceImage_.reset( |
| 82 [chrome::GetTabMediaIndicatorAffordanceImage(nextState, nil) | 82 [chrome::GetTabMediaIndicatorAffordanceImage(nextState, 0) |
| 83 .ToNSImage() retain]); | 83 .ToNSImage() retain]); |
| 84 } | 84 } |
| 85 | 85 |
| 86 if ((mediaState_ == TAB_MEDIA_STATE_AUDIO_PLAYING && | 86 if ((mediaState_ == TAB_MEDIA_STATE_AUDIO_PLAYING && |
| 87 nextState == TAB_MEDIA_STATE_AUDIO_MUTING) || | 87 nextState == TAB_MEDIA_STATE_AUDIO_MUTING) || |
| 88 (mediaState_ == TAB_MEDIA_STATE_AUDIO_MUTING && | 88 (mediaState_ == TAB_MEDIA_STATE_AUDIO_MUTING && |
| 89 nextState == TAB_MEDIA_STATE_AUDIO_PLAYING) || | 89 nextState == TAB_MEDIA_STATE_AUDIO_PLAYING) || |
| 90 (mediaState_ == TAB_MEDIA_STATE_AUDIO_MUTING && | 90 (mediaState_ == TAB_MEDIA_STATE_AUDIO_MUTING && |
| 91 nextState == TAB_MEDIA_STATE_NONE)) { | 91 nextState == TAB_MEDIA_STATE_NONE)) { |
| 92 // Instant user feedback: No fade animation. | 92 // Instant user feedback: No fade animation. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 if (enable && tabView && ([tabView state] != NSOnState)) { | 230 if (enable && tabView && ([tabView state] != NSOnState)) { |
| 231 const int requiredWidth = | 231 const int requiredWidth = |
| 232 NSWidth([self frame]) * kMinMouseSelectableAreaPercent / 100; | 232 NSWidth([self frame]) * kMinMouseSelectableAreaPercent / 100; |
| 233 enable = ([tabView widthOfLargestSelectableRegion] >= requiredWidth); | 233 enable = ([tabView widthOfLargestSelectableRegion] >= requiredWidth); |
| 234 } | 234 } |
| 235 | 235 |
| 236 [self setEnabled:enable]; | 236 [self setEnabled:enable]; |
| 237 } | 237 } |
| 238 | 238 |
| 239 @end | 239 @end |
| OLD | NEW |