| 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/toolbar/toolbar_controller.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 } | 554 } |
| 555 | 555 |
| 556 - (WrenchMenuController*)wrenchMenuController { | 556 - (WrenchMenuController*)wrenchMenuController { |
| 557 return wrenchMenuController_; | 557 return wrenchMenuController_; |
| 558 } | 558 } |
| 559 | 559 |
| 560 - (void)updateWrenchButtonSeverity { | 560 - (void)updateWrenchButtonSeverity { |
| 561 WrenchToolbarButtonCell* cell = | 561 WrenchToolbarButtonCell* cell = |
| 562 base::mac::ObjCCastStrict<WrenchToolbarButtonCell>([wrenchButton_ cell]); | 562 base::mac::ObjCCastStrict<WrenchToolbarButtonCell>([wrenchButton_ cell]); |
| 563 if (UpgradeDetector::GetInstance()->notify_upgrade()) { | 563 if (UpgradeDetector::GetInstance()->notify_upgrade()) { |
| 564 [cell setSeverity:WrenchIconPainter::SeverityFromUpgradeLevel( | 564 WrenchIconPainter::Severity severity = |
| 565 UpgradeDetector::GetInstance()->upgrade_notification_stage())]; | 565 WrenchIconPainter::SeverityFromUpgradeLevel( |
| 566 UpgradeDetector::GetInstance()->upgrade_notification_stage()); |
| 567 bool shouldAnimate = true; |
| 568 if (severity == WrenchIconPainter::SEVERITY_LOW) { |
| 569 // Only animate low severity upgrades once. |
| 570 static bool sShouldAnimate = true; |
| 571 shouldAnimate = sShouldAnimate; |
| 572 sShouldAnimate = false; |
| 573 } |
| 574 [cell setSeverity:severity shouldAnimate:shouldAnimate]; |
| 566 return; | 575 return; |
| 567 } | 576 } |
| 568 | 577 |
| 569 GlobalError* error = GlobalErrorServiceFactory::GetForProfile( | 578 GlobalError* error = GlobalErrorServiceFactory::GetForProfile( |
| 570 browser_->profile())->GetHighestSeverityGlobalErrorWithWrenchMenuItem(); | 579 browser_->profile())->GetHighestSeverityGlobalErrorWithWrenchMenuItem(); |
| 571 if (error) { | 580 if (error) { |
| 572 [cell setSeverity:WrenchIconPainter::SeverityFromGlobalErrorSeverity( | 581 [cell setSeverity:WrenchIconPainter::SeverityFromGlobalErrorSeverity( |
| 573 error->GetSeverity())]; | 582 error->GetSeverity()) |
| 583 shouldAnimate:YES]; |
| 574 return; | 584 return; |
| 575 } | 585 } |
| 576 | 586 |
| 577 [cell setSeverity:WrenchIconPainter::SEVERITY_NONE]; | 587 [cell setSeverity:WrenchIconPainter::SEVERITY_NONE shouldAnimate:YES]; |
| 578 } | 588 } |
| 579 | 589 |
| 580 - (void)prefChanged:(const std::string&)prefName { | 590 - (void)prefChanged:(const std::string&)prefName { |
| 581 if (prefName == prefs::kShowHomeButton) { | 591 if (prefName == prefs::kShowHomeButton) { |
| 582 [self showOptionalHomeButton]; | 592 [self showOptionalHomeButton]; |
| 583 } | 593 } |
| 584 } | 594 } |
| 585 | 595 |
| 586 - (void)createBrowserActionButtons { | 596 - (void)createBrowserActionButtons { |
| 587 if (!browserActionsController_.get()) { | 597 if (!browserActionsController_.get()) { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 818 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 809 // Do nothing. | 819 // Do nothing. |
| 810 } | 820 } |
| 811 | 821 |
| 812 // (URLDropTargetController protocol) | 822 // (URLDropTargetController protocol) |
| 813 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 823 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
| 814 return drag_util::IsUnsupportedDropData(profile_, info); | 824 return drag_util::IsUnsupportedDropData(profile_, info); |
| 815 } | 825 } |
| 816 | 826 |
| 817 @end | 827 @end |
| OLD | NEW |