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

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

Issue 2092193004: [Mac][Material Design] Add temporary spinner for Incognito mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | no next file » | 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 22 matching lines...) Expand all
33 #import "chrome/browser/ui/cocoa/image_button_cell.h" 33 #import "chrome/browser/ui/cocoa/image_button_cell.h"
34 #import "chrome/browser/ui/cocoa/new_tab_button.h" 34 #import "chrome/browser/ui/cocoa/new_tab_button.h"
35 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h" 35 #import "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h"
36 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" 36 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
37 #import "chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.h" 37 #import "chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.h"
38 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" 38 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h"
39 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" 39 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h"
40 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" 40 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h"
41 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 41 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
42 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" 42 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
43 #import "chrome/browser/ui/cocoa/themed_window.h"
43 #include "chrome/browser/ui/find_bar/find_bar.h" 44 #include "chrome/browser/ui/find_bar/find_bar.h"
44 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 45 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
45 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 46 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
46 #include "chrome/browser/ui/tabs/tab_menu_model.h" 47 #include "chrome/browser/ui/tabs/tab_menu_model.h"
47 #include "chrome/browser/ui/tabs/tab_strip_model.h" 48 #include "chrome/browser/ui/tabs/tab_strip_model.h"
48 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" 49 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
49 #include "chrome/common/chrome_switches.h" 50 #include "chrome/common/chrome_switches.h"
50 #include "chrome/grit/generated_resources.h" 51 #include "chrome/grit/generated_resources.h"
51 #include "components/metrics/proto/omnibox_event.pb.h" 52 #include "components/metrics/proto/omnibox_event.pb.h"
52 #include "components/omnibox/browser/autocomplete_classifier.h" 53 #include "components/omnibox/browser/autocomplete_classifier.h"
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 // Updates the current loading state, replacing the icon view with a favicon, 1525 // Updates the current loading state, replacing the icon view with a favicon,
1525 // a throbber, the default icon, or nothing at all. 1526 // a throbber, the default icon, or nothing at all.
1526 - (void)updateIconsForContents:(content::WebContents*)contents 1527 - (void)updateIconsForContents:(content::WebContents*)contents
1527 atIndex:(NSInteger)modelIndex { 1528 atIndex:(NSInteger)modelIndex {
1528 if (!contents) 1529 if (!contents)
1529 return; 1530 return;
1530 1531
1531 static NSImage* throbberWaitingImage = 1532 static NSImage* throbberWaitingImage =
1532 ResourceBundle::GetSharedInstance().GetNativeImageNamed( 1533 ResourceBundle::GetSharedInstance().GetNativeImageNamed(
1533 IDR_THROBBER_WAITING).CopyNSImage(); 1534 IDR_THROBBER_WAITING).CopyNSImage();
1535 static NSImage* throbberWaitingIncognitoImage =
1536 ResourceBundle::GetSharedInstance().GetNativeImageNamed(
1537 IDR_THROBBER_WAITING_INCOGNITO).CopyNSImage();
1534 static NSImage* throbberLoadingImage = 1538 static NSImage* throbberLoadingImage =
1535 ResourceBundle::GetSharedInstance().GetNativeImageNamed( 1539 ResourceBundle::GetSharedInstance().GetNativeImageNamed(
1536 IDR_THROBBER).CopyNSImage(); 1540 IDR_THROBBER).CopyNSImage();
1541 static NSImage* throbberLoadingIncognitoImage =
1542 ResourceBundle::GetSharedInstance().GetNativeImageNamed(
1543 IDR_THROBBER_INCOGNITO).CopyNSImage();
1537 static NSImage* sadFaviconImage = 1544 static NSImage* sadFaviconImage =
1538 ResourceBundle::GetSharedInstance() 1545 ResourceBundle::GetSharedInstance()
1539 .GetNativeImageNamed(IDR_CRASH_SAD_FAVICON) 1546 .GetNativeImageNamed(IDR_CRASH_SAD_FAVICON)
1540 .CopyNSImage(); 1547 .CopyNSImage();
1541 1548
1542 // Take closing tabs into account. 1549 // Take closing tabs into account.
1543 NSInteger index = [self indexFromModelIndex:modelIndex]; 1550 NSInteger index = [self indexFromModelIndex:modelIndex];
1544 TabController* tabController = [tabArray_ objectAtIndex:index]; 1551 TabController* tabController = [tabArray_ objectAtIndex:index];
1545 1552
1546 bool oldHasIcon = [tabController iconView] != nil; 1553 bool oldHasIcon = [tabController iconView] != nil;
1547 bool newHasIcon = 1554 bool newHasIcon =
1548 favicon::ShouldDisplayFavicon(contents) || 1555 favicon::ShouldDisplayFavicon(contents) ||
1549 tabStripModel_->IsTabPinned(modelIndex); // Always show icon if pinned. 1556 tabStripModel_->IsTabPinned(modelIndex); // Always show icon if pinned.
1550 1557
1551 TabLoadingState oldState = [tabController loadingState]; 1558 TabLoadingState oldState = [tabController loadingState];
1552 TabLoadingState newState = kTabDone; 1559 TabLoadingState newState = kTabDone;
1553 NSImage* throbberImage = nil; 1560 NSImage* throbberImage = nil;
1554 if (contents->IsCrashed()) { 1561 if (contents->IsCrashed()) {
1555 newState = kTabCrashed; 1562 newState = kTabCrashed;
1556 newHasIcon = true; 1563 newHasIcon = true;
1557 } else if (contents->IsWaitingForResponse()) { 1564 } else if (contents->IsWaitingForResponse()) {
1558 newState = kTabWaiting; 1565 newState = kTabWaiting;
1559 throbberImage = throbberWaitingImage; 1566 if (ui::MaterialDesignController::IsModeMaterial() &&
1567 [[[tabController view] window] inIncognitoMode]) {
1568 throbberImage = throbberWaitingIncognitoImage;
1569 } else {
1570 throbberImage = throbberWaitingImage;
1571 }
1560 } else if (contents->IsLoadingToDifferentDocument()) { 1572 } else if (contents->IsLoadingToDifferentDocument()) {
1561 newState = kTabLoading; 1573 newState = kTabLoading;
1562 throbberImage = throbberLoadingImage; 1574 if (ui::MaterialDesignController::IsModeMaterial() &&
1575 [[[tabController view] window] inIncognitoMode]) {
1576 throbberImage = throbberLoadingIncognitoImage;
1577 } else {
1578 throbberImage = throbberLoadingImage;
1579 }
1563 } 1580 }
1564 1581
1565 if (oldState != newState) 1582 if (oldState != newState)
1566 [tabController setLoadingState:newState]; 1583 [tabController setLoadingState:newState];
1567 1584
1568 // While loading, this function is called repeatedly with the same state. 1585 // While loading, this function is called repeatedly with the same state.
1569 // To avoid expensive unnecessary view manipulation, only make changes when 1586 // To avoid expensive unnecessary view manipulation, only make changes when
1570 // the state is actually changing. When loading is complete (kTabDone), 1587 // the state is actually changing. When loading is complete (kTabDone),
1571 // every call to this function is significant. 1588 // every call to this function is significant.
1572 if (newState == kTabDone || oldState != newState || 1589 if (newState == kTabDone || oldState != newState ||
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 2326
2310 - (void)themeDidChangeNotification:(NSNotification*)notification { 2327 - (void)themeDidChangeNotification:(NSNotification*)notification {
2311 [newTabButton_ setImages]; 2328 [newTabButton_ setImages];
2312 } 2329 }
2313 2330
2314 - (void)setVisualEffectsDisabledForFullscreen:(BOOL)fullscreen { 2331 - (void)setVisualEffectsDisabledForFullscreen:(BOOL)fullscreen {
2315 [tabStripView_ setVisualEffectsDisabledForFullscreen:fullscreen]; 2332 [tabStripView_ setVisualEffectsDisabledForFullscreen:fullscreen];
2316 } 2333 }
2317 2334
2318 @end 2335 @end
OLDNEW
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698