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 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 newState = kTabWaiting; | 1580 newState = kTabWaiting; |
1581 throbberImage = throbberWaitingImage; | 1581 throbberImage = throbberWaitingImage; |
1582 } else if (contents->IsLoading()) { | 1582 } else if (contents->IsLoadingToDifferentDocument()) { |
1583 newState = kTabLoading; | 1583 newState = kTabLoading; |
1584 throbberImage = throbberLoadingImage; | 1584 throbberImage = throbberLoadingImage; |
1585 } | 1585 } |
1586 | 1586 |
1587 if (oldState != newState) | 1587 if (oldState != newState) |
1588 [tabController setLoadingState:newState]; | 1588 [tabController setLoadingState:newState]; |
1589 | 1589 |
1590 // While loading, this function is called repeatedly with the same state. | 1590 // While loading, this function is called repeatedly with the same state. |
1591 // To avoid expensive unnecessary view manipulation, only make changes when | 1591 // To avoid expensive unnecessary view manipulation, only make changes when |
1592 // the state is actually changing. When loading is complete (kTabDone), | 1592 // 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) { | 2229 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
2230 // View hierarchy of the contents view: | 2230 // View hierarchy of the contents view: |
2231 // NSView -- switchView, same for all tabs | 2231 // NSView -- switchView, same for all tabs |
2232 // +- NSView -- TabContentsController's view | 2232 // +- NSView -- TabContentsController's view |
2233 // +- TabContentsViewCocoa | 2233 // +- TabContentsViewCocoa |
2234 // | 2234 // |
2235 // Changing it? Do not forget to modify | 2235 // Changing it? Do not forget to modify |
2236 // -[TabStripController swapInTabAtIndex:] too. | 2236 // -[TabStripController swapInTabAtIndex:] too. |
2237 return [web_contents->GetNativeView() superview]; | 2237 return [web_contents->GetNativeView() superview]; |
2238 } | 2238 } |
OLD | NEW |