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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 - (NSInteger)numberOfOpenPinnedTabs; | 244 - (NSInteger)numberOfOpenPinnedTabs; |
245 - (NSInteger)numberOfOpenNonPinnedTabs; | 245 - (NSInteger)numberOfOpenNonPinnedTabs; |
246 - (void)mouseMoved:(NSEvent*)event; | 246 - (void)mouseMoved:(NSEvent*)event; |
247 - (void)setTabTrackingAreasEnabled:(BOOL)enabled; | 247 - (void)setTabTrackingAreasEnabled:(BOOL)enabled; |
248 - (void)droppingURLsAt:(NSPoint)point | 248 - (void)droppingURLsAt:(NSPoint)point |
249 givesIndex:(NSInteger*)index | 249 givesIndex:(NSInteger*)index |
250 disposition:(WindowOpenDisposition*)disposition; | 250 disposition:(WindowOpenDisposition*)disposition; |
251 - (void)setNewTabButtonHoverState:(BOOL)showHover; | 251 - (void)setNewTabButtonHoverState:(BOOL)showHover; |
252 - (void)themeDidChangeNotification:(NSNotification*)notification; | 252 - (void)themeDidChangeNotification:(NSNotification*)notification; |
253 - (void)setNewTabImages; | 253 - (void)setNewTabImages; |
254 - (void)updateWindowMediaState:(TabMediaState)media_state | |
255 on:(content::WebContents*)changed; | |
Robert Sesek
2015/10/20 13:39:48
nit: align colons
| |
254 @end | 256 @end |
255 | 257 |
256 // A simple view class that contains the traffic light buttons. This class | 258 // A simple view class that contains the traffic light buttons. This class |
257 // ensures that the buttons display the icons when the mouse hovers over | 259 // ensures that the buttons display the icons when the mouse hovers over |
258 // them by overriding the _mouseInGroup method. | 260 // them by overriding the _mouseInGroup method. |
259 @interface CustomWindowControlsView : NSView { | 261 @interface CustomWindowControlsView : NSView { |
260 @private | 262 @private |
261 BOOL mouseInside_; | 263 BOOL mouseInside_; |
262 } | 264 } |
263 | 265 |
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1619 } else if (newState == kTabCrashed) { | 1621 } else if (newState == kTabCrashed) { |
1620 [tabController setIconImage:sadFaviconImage withToastAnimation:YES]; | 1622 [tabController setIconImage:sadFaviconImage withToastAnimation:YES]; |
1621 } else { | 1623 } else { |
1622 [tabController setIconImage:throbberImage]; | 1624 [tabController setIconImage:throbberImage]; |
1623 } | 1625 } |
1624 } else { | 1626 } else { |
1625 [tabController setIconImage:nil]; | 1627 [tabController setIconImage:nil]; |
1626 } | 1628 } |
1627 } | 1629 } |
1628 | 1630 |
1629 [tabController setMediaState:chrome::GetTabMediaStateForContents(contents)]; | 1631 TabMediaState media_state = chrome::GetTabMediaStateForContents(contents); |
Robert Sesek
2015/10/20 13:39:48
naming: mediaState
| |
1632 | |
1633 [self updateWindowMediaState:media_state on:contents]; | |
1634 [tabController setMediaState:media_state]; | |
1630 | 1635 |
1631 [tabController updateVisibility]; | 1636 [tabController updateVisibility]; |
1632 } | 1637 } |
1633 | 1638 |
1634 // Called when a notification is received from the model that the given tab | 1639 // Called when a notification is received from the model that the given tab |
1635 // has been updated. |loading| will be YES when we only want to update the | 1640 // has been updated. |loading| will be YES when we only want to update the |
1636 // throbber state, not anything else about the (partially) loading tab. | 1641 // throbber state, not anything else about the (partially) loading tab. |
1637 - (void)tabChangedWithContents:(content::WebContents*)contents | 1642 - (void)tabChangedWithContents:(content::WebContents*)contents |
1638 atIndex:(NSInteger)modelIndex | 1643 atIndex:(NSInteger)modelIndex |
1639 changeType:(TabStripModelObserver::TabChangeType)change { | 1644 changeType:(TabStripModelObserver::TabChangeType)change { |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2327 [[newTabButton_ cell] setImage:Overlay(background, hover, alpha) | 2332 [[newTabButton_ cell] setImage:Overlay(background, hover, alpha) |
2328 forButtonState:image_button_cell::kHoverStateBackground]; | 2333 forButtonState:image_button_cell::kHoverStateBackground]; |
2329 } else { | 2334 } else { |
2330 [[newTabButton_ cell] setImage:nil | 2335 [[newTabButton_ cell] setImage:nil |
2331 forButtonState:image_button_cell::kDefaultStateBackground]; | 2336 forButtonState:image_button_cell::kDefaultStateBackground]; |
2332 [[newTabButton_ cell] setImage:nil | 2337 [[newTabButton_ cell] setImage:nil |
2333 forButtonState:image_button_cell::kHoverStateBackground]; | 2338 forButtonState:image_button_cell::kHoverStateBackground]; |
2334 } | 2339 } |
2335 } | 2340 } |
2336 | 2341 |
2342 - (void)updateWindowMediaState:(TabMediaState)media_state | |
2343 on:(content::WebContents*)selected { | |
2344 NSWindow* window = [tabStripView_ window]; | |
2345 BrowserWindowController* windowController = | |
2346 [BrowserWindowController browserWindowControllerForWindow:window]; | |
2347 [windowController setMediaState:media_state on:selected]; | |
2348 } | |
2349 | |
2337 @end | 2350 @end |
OLD | NEW |