| 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/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 - (void)mouseEntered:(NSEvent*)event { | 389 - (void)mouseEntered:(NSEvent*)event { |
| 390 [self mouseMoved:event]; | 390 [self mouseMoved:event]; |
| 391 } | 391 } |
| 392 | 392 |
| 393 - (LocationBarViewMac*)locationBarBridge { | 393 - (LocationBarViewMac*)locationBarBridge { |
| 394 return locationBarView_.get(); | 394 return locationBarView_.get(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 - (void)focusLocationBar:(BOOL)selectAll { | 397 - (void)focusLocationBar:(BOOL)selectAll { |
| 398 if (locationBarView_.get()) { | 398 if (locationBarView_.get()) { |
| 399 if (selectAll && | 399 locationBarView_->FocusLocation(selectAll ? true : false); |
| 400 locationBarView_->GetToolbarModel()->WouldOmitURLDueToOriginChip()) { | |
| 401 // select_all is true when it's expected that the user may want to copy | |
| 402 // the URL to the clipboard. If the origin chip is being displayed (and | |
| 403 // thus the URL is not being shown in the Omnibox) show it now to support | |
| 404 // the same functionality. | |
| 405 locationBarView_->GetOmniboxView()->ShowURL(); | |
| 406 } else { | |
| 407 locationBarView_->FocusLocation(selectAll ? true : false); | |
| 408 } | |
| 409 } | 400 } |
| 410 } | 401 } |
| 411 | 402 |
| 412 // Called when the state for a command changes to |enabled|. Update the | 403 // Called when the state for a command changes to |enabled|. Update the |
| 413 // corresponding UI element. | 404 // corresponding UI element. |
| 414 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled { | 405 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled { |
| 415 NSButton* button = nil; | 406 NSButton* button = nil; |
| 416 switch (command) { | 407 switch (command) { |
| 417 case IDC_BACK: | 408 case IDC_BACK: |
| 418 button = backButton_; | 409 button = backButton_; |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 864 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 874 // Do nothing. | 865 // Do nothing. |
| 875 } | 866 } |
| 876 | 867 |
| 877 // (URLDropTargetController protocol) | 868 // (URLDropTargetController protocol) |
| 878 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 869 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
| 879 return drag_util::IsUnsupportedDropData(profile_, info); | 870 return drag_util::IsUnsupportedDropData(profile_, info); |
| 880 } | 871 } |
| 881 | 872 |
| 882 @end | 873 @end |
| OLD | NEW |