| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/toolbar_controller.h" | 5 #import "chrome/browser/cocoa/toolbar_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/l10n_util_mac.h" | 10 #include "app/l10n_util_mac.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 // corresponding UI element. | 415 // corresponding UI element. |
| 416 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled { | 416 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled { |
| 417 NSButton* button = nil; | 417 NSButton* button = nil; |
| 418 switch (command) { | 418 switch (command) { |
| 419 case IDC_BACK: | 419 case IDC_BACK: |
| 420 button = backButton_; | 420 button = backButton_; |
| 421 break; | 421 break; |
| 422 case IDC_FORWARD: | 422 case IDC_FORWARD: |
| 423 button = forwardButton_; | 423 button = forwardButton_; |
| 424 break; | 424 break; |
| 425 case IDC_RELOAD: | |
| 426 button = reloadButton_; | |
| 427 break; | |
| 428 case IDC_HOME: | 425 case IDC_HOME: |
| 429 button = homeButton_; | 426 button = homeButton_; |
| 430 break; | 427 break; |
| 431 } | 428 } |
| 432 [button setEnabled:enabled]; | 429 [button setEnabled:enabled]; |
| 433 } | 430 } |
| 434 | 431 |
| 435 // Init the enabled state of the buttons on the toolbar to match the state in | 432 // Init the enabled state of the buttons on the toolbar to match the state in |
| 436 // the controller. | 433 // the controller. |
| 437 - (void)initCommandStatus:(CommandUpdater*)commands { | 434 - (void)initCommandStatus:(CommandUpdater*)commands { |
| 438 [backButton_ setEnabled:commands->IsCommandEnabled(IDC_BACK) ? YES : NO]; | 435 [backButton_ setEnabled:commands->IsCommandEnabled(IDC_BACK) ? YES : NO]; |
| 439 [forwardButton_ | 436 [forwardButton_ |
| 440 setEnabled:commands->IsCommandEnabled(IDC_FORWARD) ? YES : NO]; | 437 setEnabled:commands->IsCommandEnabled(IDC_FORWARD) ? YES : NO]; |
| 441 [reloadButton_ setEnabled:commands->IsCommandEnabled(IDC_RELOAD) ? YES : NO]; | 438 [reloadButton_ setEnabled:YES]; |
| 442 [homeButton_ setEnabled:commands->IsCommandEnabled(IDC_HOME) ? YES : NO]; | 439 [homeButton_ setEnabled:commands->IsCommandEnabled(IDC_HOME) ? YES : NO]; |
| 443 } | 440 } |
| 444 | 441 |
| 445 - (void)updateToolbarWithContents:(TabContents*)tab | 442 - (void)updateToolbarWithContents:(TabContents*)tab |
| 446 shouldRestoreState:(BOOL)shouldRestore { | 443 shouldRestoreState:(BOOL)shouldRestore { |
| 447 locationBarView_->Update(tab, shouldRestore ? true : false); | 444 locationBarView_->Update(tab, shouldRestore ? true : false); |
| 448 | 445 |
| 449 [locationBar_ updateCursorAndToolTipRects]; | 446 [locationBar_ updateCursorAndToolTipRects]; |
| 450 | 447 |
| 451 if (browserActionsController_.get()) { | 448 if (browserActionsController_.get()) { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { | 793 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { |
| 797 // Do nothing. | 794 // Do nothing. |
| 798 } | 795 } |
| 799 | 796 |
| 800 // (URLDropTargetController protocol) | 797 // (URLDropTargetController protocol) |
| 801 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 798 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 802 // Do nothing. | 799 // Do nothing. |
| 803 } | 800 } |
| 804 | 801 |
| 805 @end | 802 @end |
| OLD | NEW |