| 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 | |
| 117 // Helper class for doing NSAnimationContext calls that takes a bool to disable | 114 // Helper class for doing NSAnimationContext calls that takes a bool to disable |
| 118 // all the work. Useful for code that wants to conditionally animate. | 115 // all the work. Useful for code that wants to conditionally animate. |
| 119 class ScopedNSAnimationContextGroup { | 116 class ScopedNSAnimationContextGroup { |
| 120 public: | 117 public: |
| 121 explicit ScopedNSAnimationContextGroup(bool animate) | 118 explicit ScopedNSAnimationContextGroup(bool animate) |
| 122 : animate_(animate) { | 119 : animate_(animate) { |
| 123 if (animate_) { | 120 if (animate_) { |
| 124 [NSAnimationContext beginGrouping]; | 121 [NSAnimationContext beginGrouping]; |
| 125 } | 122 } |
| 126 } | 123 } |
| (...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); | 1598 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); |
| 1602 ThrobbingImageView* recordingView = | 1599 ThrobbingImageView* recordingView = |
| 1603 [[[ThrobbingImageView alloc] | 1600 [[[ThrobbingImageView alloc] |
| 1604 initWithFrame:frame | 1601 initWithFrame:frame |
| 1605 backgroundImage:[imageView image] | 1602 backgroundImage:[imageView image] |
| 1606 throbImage:recording | 1603 throbImage:recording |
| 1607 durationMS:kRecordingDurationMs | 1604 durationMS:kRecordingDurationMs |
| 1608 throbPosition:kThrobPositionBottomRight] autorelease]; | 1605 throbPosition:kThrobPositionBottomRight] autorelease]; |
| 1609 | 1606 |
| 1610 iconView = recordingView; | 1607 iconView = recordingView; |
| 1611 } else if (theme && chrome::IsPlayingAudio(contents)) { | |
| 1612 NSImage* audioImage = | |
| 1613 theme->GetNSImageNamed(IDR_AUDIO_ANIMATION, true); | |
| 1614 NSRect frame = | |
| 1615 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); | |
| 1616 ThrobbingImageView* equalizerFaviconView = | |
| 1617 [[[ThrobbingImageView alloc] | |
| 1618 initWithFrame:frame | |
| 1619 backgroundImage:[imageView image] | |
| 1620 throbImage:audioImage | |
| 1621 durationMS:kAudioPlayingDurationMs | |
| 1622 throbPosition:kThrobPositionOverlay] autorelease]; | |
| 1623 [equalizerFaviconView setTweenType:ui::Tween::LINEAR]; | |
| 1624 | |
| 1625 iconView = equalizerFaviconView; | |
| 1626 } else { | 1608 } else { |
| 1627 iconView = imageView; | 1609 iconView = imageView; |
| 1628 } | 1610 } |
| 1629 } else if (newState == kTabCrashed) { | 1611 } else if (newState == kTabCrashed) { |
| 1630 NSImage* oldImage = [[self iconImageViewForContents:contents] image]; | 1612 NSImage* oldImage = [[self iconImageViewForContents:contents] image]; |
| 1631 NSRect frame = | 1613 NSRect frame = |
| 1632 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); | 1614 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); |
| 1633 iconView = [ThrobberView toastThrobberViewWithFrame:frame | 1615 iconView = [ThrobberView toastThrobberViewWithFrame:frame |
| 1634 beforeImage:oldImage | 1616 beforeImage:oldImage |
| 1635 afterImage:sadFaviconImage]; | 1617 afterImage:sadFaviconImage]; |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2251 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | 2233 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
| 2252 // View hierarchy of the contents view: | 2234 // View hierarchy of the contents view: |
| 2253 // NSView -- switchView, same for all tabs | 2235 // NSView -- switchView, same for all tabs |
| 2254 // +- NSView -- TabContentsController's view | 2236 // +- NSView -- TabContentsController's view |
| 2255 // +- TabContentsViewCocoa | 2237 // +- TabContentsViewCocoa |
| 2256 // | 2238 // |
| 2257 // Changing it? Do not forget to modify | 2239 // Changing it? Do not forget to modify |
| 2258 // -[TabStripController swapInTabAtIndex:] too. | 2240 // -[TabStripController swapInTabAtIndex:] too. |
| 2259 return [web_contents->GetView()->GetNativeView() superview]; | 2241 return [web_contents->GetView()->GetNativeView() superview]; |
| 2260 } | 2242 } |
| OLD | NEW |