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

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

Issue 12648004: Audio indicator: Mac UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebas 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
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 19 matching lines...) Expand all
30 #include "chrome/browser/ui/browser.h" 30 #include "chrome/browser/ui/browser.h"
31 #include "chrome/browser/ui/browser_navigator.h" 31 #include "chrome/browser/ui/browser_navigator.h"
32 #include "chrome/browser/ui/browser_tabstrip.h" 32 #include "chrome/browser/ui/browser_tabstrip.h"
33 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 33 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
34 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h" 34 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h"
35 #include "chrome/browser/ui/cocoa/drag_util.h" 35 #include "chrome/browser/ui/cocoa/drag_util.h"
36 #import "chrome/browser/ui/cocoa/image_button_cell.h" 36 #import "chrome/browser/ui/cocoa/image_button_cell.h"
37 #import "chrome/browser/ui/cocoa/new_tab_button.h" 37 #import "chrome/browser/ui/cocoa/new_tab_button.h"
38 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h" 38 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h"
39 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" 39 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
40 #import "chrome/browser/ui/cocoa/tabs/tab_audio_indicator_view_mac.h"
40 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" 41 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h"
41 #import "chrome/browser/ui/cocoa/tabs/tab_projecting_image_view.h" 42 #import "chrome/browser/ui/cocoa/tabs/tab_projecting_image_view.h"
42 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" 43 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h"
43 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" 44 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h"
44 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 45 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
45 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 46 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
46 #import "chrome/browser/ui/cocoa/tabs/throbber_view.h" 47 #import "chrome/browser/ui/cocoa/tabs/throbber_view.h"
47 #import "chrome/browser/ui/cocoa/tabs/throbbing_image_view.h" 48 #import "chrome/browser/ui/cocoa/tabs/throbbing_image_view.h"
48 #include "chrome/browser/ui/find_bar/find_bar.h" 49 #include "chrome/browser/ui/find_bar/find_bar.h"
49 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 50 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 // While loading, this function is called repeatedly with the same state. 1566 // While loading, this function is called repeatedly with the same state.
1566 // To avoid expensive unnecessary view manipulation, only make changes when 1567 // To avoid expensive unnecessary view manipulation, only make changes when
1567 // the state is actually changing. When loading is complete (kTabDone), 1568 // the state is actually changing. When loading is complete (kTabDone),
1568 // every call to this function is significant. 1569 // every call to this function is significant.
1569 if (newState == kTabDone || oldState != newState || 1570 if (newState == kTabDone || oldState != newState ||
1570 oldHasIcon != newHasIcon) { 1571 oldHasIcon != newHasIcon) {
1571 NSView* iconView = nil; 1572 NSView* iconView = nil;
1572 if (newHasIcon) { 1573 if (newHasIcon) {
1573 if (newState == kTabDone) { 1574 if (newState == kTabDone) {
1574 NSImageView* imageView = [self iconImageViewForContents:contents]; 1575 NSImageView* imageView = [self iconImageViewForContents:contents];
1576 TabAudioIndicatorViewMac* tabAudioIndicatorViewMac =
1577 base::mac::ObjCCast<TabAudioIndicatorViewMac>(
1578 [tabController iconView]);
1575 1579
1576 ui::ThemeProvider* theme = [[tabStripView_ window] themeProvider]; 1580 ui::ThemeProvider* theme = [[tabStripView_ window] themeProvider];
1577 if (theme && [tabController projecting]) { 1581 if (theme && [tabController projecting]) {
1578 NSImage* projectorGlow = 1582 NSImage* projectorGlow =
1579 theme->GetNSImageNamed(IDR_TAB_CAPTURE_GLOW, true); 1583 theme->GetNSImageNamed(IDR_TAB_CAPTURE_GLOW, true);
1580 NSImage* projector = theme->GetNSImageNamed(IDR_TAB_CAPTURE, true); 1584 NSImage* projector = theme->GetNSImageNamed(IDR_TAB_CAPTURE, true);
1581 1585
1582 NSRect frame = NSMakeRect(0, 1586 NSRect frame = NSMakeRect(0,
1583 0, 1587 0,
1584 kProjectingIconWidthAndHeight, 1588 kProjectingIconWidthAndHeight,
(...skipping 13 matching lines...) Expand all
1598 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); 1602 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight);
1599 ThrobbingImageView* recordingView = 1603 ThrobbingImageView* recordingView =
1600 [[[ThrobbingImageView alloc] 1604 [[[ThrobbingImageView alloc]
1601 initWithFrame:frame 1605 initWithFrame:frame
1602 backgroundImage:[imageView image] 1606 backgroundImage:[imageView image]
1603 throbImage:recording 1607 throbImage:recording
1604 durationMS:kRecordingDurationMs 1608 durationMS:kRecordingDurationMs
1605 throbPosition:kThrobPositionBottomRight] autorelease]; 1609 throbPosition:kThrobPositionBottomRight] autorelease];
1606 1610
1607 iconView = recordingView; 1611 iconView = recordingView;
1612 } else if (chrome::IsPlayingAudio(contents) ||
1613 [tabAudioIndicatorViewMac isAnimating]) {
1614 if (!tabAudioIndicatorViewMac) {
1615 NSRect frame =
1616 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight);
1617 tabAudioIndicatorViewMac = [[[TabAudioIndicatorViewMac alloc]
1618 initWithFrame:frame] autorelease];
1619 }
1620 [tabAudioIndicatorViewMac
1621 setIsPlayingAudio:chrome::IsPlayingAudio(contents)];
1622 [tabAudioIndicatorViewMac setBackgroundImage:[imageView image]];
1623 iconView = tabAudioIndicatorViewMac;
1608 } else { 1624 } else {
1609 iconView = imageView; 1625 iconView = imageView;
1610 } 1626 }
1611 } else if (newState == kTabCrashed) { 1627 } else if (newState == kTabCrashed) {
1612 NSImage* oldImage = [[self iconImageViewForContents:contents] image]; 1628 NSImage* oldImage = [[self iconImageViewForContents:contents] image];
1613 NSRect frame = 1629 NSRect frame =
1614 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight); 1630 NSMakeRect(0, 0, kIconWidthAndHeight, kIconWidthAndHeight);
1615 iconView = [ThrobberView toastThrobberViewWithFrame:frame 1631 iconView = [ThrobberView toastThrobberViewWithFrame:frame
1616 beforeImage:oldImage 1632 beforeImage:oldImage
1617 afterImage:sadFaviconImage]; 1633 afterImage:sadFaviconImage];
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { 2249 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) {
2234 // View hierarchy of the contents view: 2250 // View hierarchy of the contents view:
2235 // NSView -- switchView, same for all tabs 2251 // NSView -- switchView, same for all tabs
2236 // +- NSView -- TabContentsController's view 2252 // +- NSView -- TabContentsController's view
2237 // +- TabContentsViewCocoa 2253 // +- TabContentsViewCocoa
2238 // 2254 //
2239 // Changing it? Do not forget to modify 2255 // Changing it? Do not forget to modify
2240 // -[TabStripController swapInTabAtIndex:] too. 2256 // -[TabStripController swapInTabAtIndex:] too.
2241 return [web_contents->GetView()->GetNativeView() superview]; 2257 return [web_contents->GetView()->GetNativeView() superview];
2242 } 2258 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_audio_indicator_view_mac_unittest.mm ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698