| 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 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 bool oldHasIcon = [tabController iconView] != nil; | 1569 bool oldHasIcon = [tabController iconView] != nil; |
| 1570 bool newHasIcon = favicon_tab_helper->ShouldDisplayFavicon() || | 1570 bool newHasIcon = favicon_tab_helper->ShouldDisplayFavicon() || |
| 1571 tabStripModel_->IsMiniTab(modelIndex); // Always show icon if mini. | 1571 tabStripModel_->IsMiniTab(modelIndex); // Always show icon if mini. |
| 1572 | 1572 |
| 1573 TabLoadingState oldState = [tabController loadingState]; | 1573 TabLoadingState oldState = [tabController loadingState]; |
| 1574 TabLoadingState newState = kTabDone; | 1574 TabLoadingState newState = kTabDone; |
| 1575 NSImage* throbberImage = nil; | 1575 NSImage* throbberImage = nil; |
| 1576 if (contents->IsCrashed()) { | 1576 if (contents->IsCrashed()) { |
| 1577 newState = kTabCrashed; | 1577 newState = kTabCrashed; |
| 1578 newHasIcon = true; | 1578 newHasIcon = true; |
| 1579 } else if (contents->IsWaitingForResponse()) { | 1579 } else if (contents->IsWaitingForResponse() && |
| 1580 contents->IsLoadToDifferentDocument()) { |
| 1580 newState = kTabWaiting; | 1581 newState = kTabWaiting; |
| 1581 throbberImage = throbberWaitingImage; | 1582 throbberImage = throbberWaitingImage; |
| 1582 } else if (contents->IsLoading()) { | 1583 } else if (contents->IsLoading() && |
| 1584 contents->IsLoadToDifferentDocument()) { |
| 1583 newState = kTabLoading; | 1585 newState = kTabLoading; |
| 1584 throbberImage = throbberLoadingImage; | 1586 throbberImage = throbberLoadingImage; |
| 1585 } | 1587 } |
| 1586 | 1588 |
| 1587 if (oldState != newState) | 1589 if (oldState != newState) |
| 1588 [tabController setLoadingState:newState]; | 1590 [tabController setLoadingState:newState]; |
| 1589 | 1591 |
| 1590 // While loading, this function is called repeatedly with the same state. | 1592 // While loading, this function is called repeatedly with the same state. |
| 1591 // To avoid expensive unnecessary view manipulation, only make changes when | 1593 // To avoid expensive unnecessary view manipulation, only make changes when |
| 1592 // the state is actually changing. When loading is complete (kTabDone), | 1594 // the state is actually changing. When loading is complete (kTabDone), |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2229 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | 2231 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
| 2230 // View hierarchy of the contents view: | 2232 // View hierarchy of the contents view: |
| 2231 // NSView -- switchView, same for all tabs | 2233 // NSView -- switchView, same for all tabs |
| 2232 // +- NSView -- TabContentsController's view | 2234 // +- NSView -- TabContentsController's view |
| 2233 // +- TabContentsViewCocoa | 2235 // +- TabContentsViewCocoa |
| 2234 // | 2236 // |
| 2235 // Changing it? Do not forget to modify | 2237 // Changing it? Do not forget to modify |
| 2236 // -[TabStripController swapInTabAtIndex:] too. | 2238 // -[TabStripController swapInTabAtIndex:] too. |
| 2237 return [web_contents->GetNativeView() superview]; | 2239 return [web_contents->GetNativeView() superview]; |
| 2238 } | 2240 } |
| OLD | NEW |