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/tabs/tab_strip_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
6 | 6 |
7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <limits> | 10 #include <limits> |
(...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 0, | 1629 0, |
1630 kProjectingIconWidthAndHeight, | 1630 kProjectingIconWidthAndHeight, |
1631 kProjectingIconWidthAndHeight); | 1631 kProjectingIconWidthAndHeight); |
1632 TabProjectingImageView* projectingView = | 1632 TabProjectingImageView* projectingView = |
1633 [[[TabProjectingImageView alloc] | 1633 [[[TabProjectingImageView alloc] |
1634 initWithFrame:frame | 1634 initWithFrame:frame |
1635 backgroundImage:[imageView image] | 1635 backgroundImage:[imageView image] |
1636 projectorImage:projector | 1636 projectorImage:projector |
1637 throbImage:projectorGlow | 1637 throbImage:projectorGlow |
1638 durationMS:kRecordingDurationMs | 1638 durationMS:kRecordingDurationMs |
1639 animationContainer:animationContainer_] autorelease]; | 1639 animationContainer:animationContainer_.get()] autorelease]; |
1640 | 1640 |
1641 iconView = projectingView; | 1641 iconView = projectingView; |
1642 } else if (theme && chrome::ShouldShowRecordingIndicator(contents)) { | 1642 } else if (theme && chrome::ShouldShowRecordingIndicator(contents)) { |
1643 // Create a masked favicon. | 1643 // Create a masked favicon. |
1644 NSImage* mask = theme->GetNSImageNamed(IDR_TAB_RECORDING_MASK, true); | 1644 NSImage* mask = theme->GetNSImageNamed(IDR_TAB_RECORDING_MASK, true); |
1645 NSImage* recording = theme->GetNSImageNamed(IDR_TAB_RECORDING, true); | 1645 NSImage* recording = theme->GetNSImageNamed(IDR_TAB_RECORDING, true); |
1646 NSImage* favIconMasked = CreateMaskedFaviconForRecording( | 1646 NSImage* favIconMasked = CreateMaskedFaviconForRecording( |
1647 [imageView image], mask, recording); | 1647 [imageView image], mask, recording); |
1648 | 1648 |
1649 NSRect frame = | 1649 NSRect frame = |
1650 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); | 1650 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); |
1651 ThrobbingImageView* recordingView = | 1651 ThrobbingImageView* recordingView = |
1652 [[[ThrobbingImageView alloc] | 1652 [[[ThrobbingImageView alloc] |
1653 initWithFrame:frame | 1653 initWithFrame:frame |
1654 backgroundImage:favIconMasked | 1654 backgroundImage:favIconMasked |
1655 throbImage:recording | 1655 throbImage:recording |
1656 durationMS:kRecordingDurationMs | 1656 durationMS:kRecordingDurationMs |
1657 throbPosition:kThrobPositionBottomRight | 1657 throbPosition:kThrobPositionBottomRight |
1658 animationContainer:animationContainer_] autorelease]; | 1658 animationContainer:animationContainer_.get()] autorelease]; |
1659 | 1659 |
1660 iconView = recordingView; | 1660 iconView = recordingView; |
1661 } else if (chrome::IsPlayingAudio(contents) || | 1661 } else if (chrome::IsPlayingAudio(contents) || |
1662 [tabAudioIndicatorViewMac isAnimating]) { | 1662 [tabAudioIndicatorViewMac isAnimating]) { |
1663 if (!tabAudioIndicatorViewMac) { | 1663 if (!tabAudioIndicatorViewMac) { |
1664 NSRect frame = | 1664 NSRect frame = |
1665 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); | 1665 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); |
1666 tabAudioIndicatorViewMac = [[[TabAudioIndicatorViewMac alloc] | 1666 tabAudioIndicatorViewMac = [[[TabAudioIndicatorViewMac alloc] |
1667 initWithFrame:frame] autorelease]; | 1667 initWithFrame:frame] autorelease]; |
1668 [tabAudioIndicatorViewMac | 1668 [tabAudioIndicatorViewMac |
1669 setAnimationContainer:animationContainer_]; | 1669 setAnimationContainer:animationContainer_.get()]; |
1670 } | 1670 } |
1671 [tabAudioIndicatorViewMac | 1671 [tabAudioIndicatorViewMac |
1672 setIsPlayingAudio:chrome::IsPlayingAudio(contents)]; | 1672 setIsPlayingAudio:chrome::IsPlayingAudio(contents)]; |
1673 [tabAudioIndicatorViewMac setBackgroundImage:[imageView image]]; | 1673 [tabAudioIndicatorViewMac setBackgroundImage:[imageView image]]; |
1674 iconView = tabAudioIndicatorViewMac; | 1674 iconView = tabAudioIndicatorViewMac; |
1675 } else { | 1675 } else { |
1676 iconView = imageView; | 1676 iconView = imageView; |
1677 } | 1677 } |
1678 } else if (newState == kTabCrashed) { | 1678 } else if (newState == kTabCrashed) { |
1679 NSImage* oldImage = [[self iconImageViewForContents:contents] image]; | 1679 NSImage* oldImage = [[self iconImageViewForContents:contents] image]; |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | 2301 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
2302 // View hierarchy of the contents view: | 2302 // View hierarchy of the contents view: |
2303 // NSView -- switchView, same for all tabs | 2303 // NSView -- switchView, same for all tabs |
2304 // +- NSView -- TabContentsController's view | 2304 // +- NSView -- TabContentsController's view |
2305 // +- TabContentsViewCocoa | 2305 // +- TabContentsViewCocoa |
2306 // | 2306 // |
2307 // Changing it? Do not forget to modify | 2307 // Changing it? Do not forget to modify |
2308 // -[TabStripController swapInTabAtIndex:] too. | 2308 // -[TabStripController swapInTabAtIndex:] too. |
2309 return [web_contents->GetView()->GetNativeView() superview]; | 2309 return [web_contents->GetView()->GetNativeView() superview]; |
2310 } | 2310 } |
OLD | NEW |