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

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

Issue 12374042: Mac: Audio indicator in each tab (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/tabs/throbbing_image_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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* recordingView = [[[ThrobbingImageView alloc]
Nico 2013/03/01 09:55:22 nit: s/recordingView/equalizerFaviconView/ (or sim
sail 2013/03/01 17:06:47 Done.
1616 initWithFrame:frame
1617 backgroundImage:[imageView image]
1618 throbImage:audioImage
1619 durationMS:kAudioPlayingDurationMs] autorelease];
1620 [recordingView setTweenType:ui::Tween::LINEAR];
1621
1622 iconView = recordingView;
1607 } else { 1623 } else {
1608 iconView = imageView; 1624 iconView = imageView;
1609 } 1625 }
1610 } else if (newState == kTabCrashed) { 1626 } else if (newState == kTabCrashed) {
1611 NSImage* oldImage = [[self iconImageViewForContents:contents] image]; 1627 NSImage* oldImage = [[self iconImageViewForContents:contents] image];
1612 NSRect frame = 1628 NSRect frame =
1613 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); 1629 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight);
1614 iconView = [ThrobberView toastThrobberViewWithFrame:frame 1630 iconView = [ThrobberView toastThrobberViewWithFrame:frame
1615 beforeImage:oldImage 1631 beforeImage:oldImage
1616 afterImage:sadFaviconImage]; 1632 afterImage:sadFaviconImage];
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { 2248 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) {
2233 // View hierarchy of the contents view: 2249 // View hierarchy of the contents view:
2234 // NSView -- switchView, same for all tabs 2250 // NSView -- switchView, same for all tabs
2235 // +- NSView -- TabContentsController's view 2251 // +- NSView -- TabContentsController's view
2236 // +- TabContentsViewCocoa 2252 // +- TabContentsViewCocoa
2237 // 2253 //
2238 // Changing it? Do not forget to modify 2254 // Changing it? Do not forget to modify
2239 // -[TabStripController swapInTabAtIndex:] too. 2255 // -[TabStripController swapInTabAtIndex:] too.
2240 return [web_contents->GetView()->GetNativeView() superview]; 2256 return [web_contents->GetView()->GetNativeView() superview];
2241 } 2257 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/tabs/throbbing_image_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698