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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // The amount by which the profile menu button is offset (from tab tabs or new | 104 // The amount by which the profile menu button is offset (from tab tabs or new |
105 // tab button). | 105 // tab button). |
106 const CGFloat kProfileMenuButtonOffset = 6.0; | 106 const CGFloat kProfileMenuButtonOffset = 6.0; |
107 | 107 |
108 // The width and height of the icon + glow for projecting mode. | 108 // The width and height of the icon + glow for projecting mode. |
109 const CGFloat kProjectingIconWidthAndHeight = 32.0; | 109 const CGFloat kProjectingIconWidthAndHeight = 32.0; |
110 | 110 |
111 // Throbbing duration on webrtc "this web page is watching you" favicon overlay. | 111 // Throbbing duration on webrtc "this web page is watching you" favicon overlay. |
112 const int kRecordingDurationMs = 1000; | 112 const int kRecordingDurationMs = 1000; |
113 | 113 |
| 114 // Throbbing duration on audio playing animation. |
| 115 const int kAudioPlayingDurationMs = 2000; |
| 116 |
114 // Helper class for doing NSAnimationContext calls that takes a bool to disable | 117 // Helper class for doing NSAnimationContext calls that takes a bool to disable |
115 // all the work. Useful for code that wants to conditionally animate. | 118 // all the work. Useful for code that wants to conditionally animate. |
116 class ScopedNSAnimationContextGroup { | 119 class ScopedNSAnimationContextGroup { |
117 public: | 120 public: |
118 explicit ScopedNSAnimationContextGroup(bool animate) | 121 explicit ScopedNSAnimationContextGroup(bool animate) |
119 : animate_(animate) { | 122 : animate_(animate) { |
120 if (animate_) { | 123 if (animate_) { |
121 [NSAnimationContext beginGrouping]; | 124 [NSAnimationContext beginGrouping]; |
122 } | 125 } |
123 } | 126 } |
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 NSRect frame = | 1600 NSRect frame = |
1598 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); | 1601 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); |
1599 ThrobbingImageView* recordingView = | 1602 ThrobbingImageView* recordingView = |
1600 [[[ThrobbingImageView alloc] initWithFrame:frame | 1603 [[[ThrobbingImageView alloc] initWithFrame:frame |
1601 backgroundImage:[imageView image] | 1604 backgroundImage:[imageView image] |
1602 throbImage:recording | 1605 throbImage:recording |
1603 durationMS:kRecordingDurationMs] | 1606 durationMS:kRecordingDurationMs] |
1604 autorelease]; | 1607 autorelease]; |
1605 | 1608 |
1606 iconView = recordingView; | 1609 iconView = recordingView; |
| 1610 } else if (theme && chrome::IsPlayingAudio(contents)) { |
| 1611 NSImage* audioImage = |
| 1612 theme->GetNSImageNamed(IDR_AUDIO_ANIMATION, true); |
| 1613 NSRect frame = |
| 1614 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); |
| 1615 ThrobbingImageView* equalizerFaviconView = |
| 1616 [[[ThrobbingImageView alloc] |
| 1617 initWithFrame:frame |
| 1618 backgroundImage:[imageView image] |
| 1619 throbImage:audioImage |
| 1620 durationMS:kAudioPlayingDurationMs] autorelease]; |
| 1621 [equalizerFaviconView setTweenType:ui::Tween::LINEAR]; |
| 1622 |
| 1623 iconView = equalizerFaviconView; |
1607 } else { | 1624 } else { |
1608 iconView = imageView; | 1625 iconView = imageView; |
1609 } | 1626 } |
1610 } else if (newState == kTabCrashed) { | 1627 } else if (newState == kTabCrashed) { |
1611 NSImage* oldImage = [[self iconImageViewForContents:contents] image]; | 1628 NSImage* oldImage = [[self iconImageViewForContents:contents] image]; |
1612 NSRect frame = | 1629 NSRect frame = |
1613 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); | 1630 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); |
1614 iconView = [ThrobberView toastThrobberViewWithFrame:frame | 1631 iconView = [ThrobberView toastThrobberViewWithFrame:frame |
1615 beforeImage:oldImage | 1632 beforeImage:oldImage |
1616 afterImage:sadFaviconImage]; | 1633 afterImage:sadFaviconImage]; |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2232 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | 2249 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
2233 // View hierarchy of the contents view: | 2250 // View hierarchy of the contents view: |
2234 // NSView -- switchView, same for all tabs | 2251 // NSView -- switchView, same for all tabs |
2235 // +- NSView -- TabContentsController's view | 2252 // +- NSView -- TabContentsController's view |
2236 // +- TabContentsViewCocoa | 2253 // +- TabContentsViewCocoa |
2237 // | 2254 // |
2238 // Changing it? Do not forget to modify | 2255 // Changing it? Do not forget to modify |
2239 // -[TabStripController swapInTabAtIndex:] too. | 2256 // -[TabStripController swapInTabAtIndex:] too. |
2240 return [web_contents->GetView()->GetNativeView() superview]; | 2257 return [web_contents->GetView()->GetNativeView() superview]; |
2241 } | 2258 } |
OLD | NEW |