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