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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 391 |
392 - (void)mouseEntered:(NSEvent*)event { | 392 - (void)mouseEntered:(NSEvent*)event { |
393 [self mouseMoved:event]; | 393 [self mouseMoved:event]; |
394 } | 394 } |
395 | 395 |
396 - (LocationBarViewMac*)locationBarBridge { | 396 - (LocationBarViewMac*)locationBarBridge { |
397 return locationBarView_.get(); | 397 return locationBarView_.get(); |
398 } | 398 } |
399 | 399 |
400 - (void)focusLocationBar:(BOOL)selectAll { | 400 - (void)focusLocationBar:(BOOL)selectAll { |
401 if (locationBarView_.get()) | 401 if (locationBarView_.get()) { |
402 locationBarView_->FocusLocation(selectAll ? true : false); | 402 if (chrome::ShouldDisplayOriginChip() && selectAll) { |
| 403 // select_all is true when it's expected that the user may want to copy |
| 404 // the URL to the clipboard. If the origin chip is being displayed (and |
| 405 // thus the URL is not being shown in the Omnibox) show it now to support |
| 406 // the same functionality. |
| 407 locationBarView_->GetOmniboxView()->ShowURL(); |
| 408 } else { |
| 409 locationBarView_->FocusLocation(selectAll ? true : false); |
| 410 } |
| 411 } |
403 } | 412 } |
404 | 413 |
405 // Called when the state for a command changes to |enabled|. Update the | 414 // Called when the state for a command changes to |enabled|. Update the |
406 // corresponding UI element. | 415 // corresponding UI element. |
407 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled { | 416 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled { |
408 NSButton* button = nil; | 417 NSButton* button = nil; |
409 switch (command) { | 418 switch (command) { |
410 case IDC_BACK: | 419 case IDC_BACK: |
411 button = backButton_; | 420 button = backButton_; |
412 break; | 421 break; |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 828 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
820 // Do nothing. | 829 // Do nothing. |
821 } | 830 } |
822 | 831 |
823 // (URLDropTargetController protocol) | 832 // (URLDropTargetController protocol) |
824 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 833 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
825 return drag_util::IsUnsupportedDropData(profile_, info); | 834 return drag_util::IsUnsupportedDropData(profile_, info); |
826 } | 835 } |
827 | 836 |
828 @end | 837 @end |
OLD | NEW |