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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 - (void)mouseEntered:(NSEvent*)event { | 386 - (void)mouseEntered:(NSEvent*)event { |
387 [self mouseMoved:event]; | 387 [self mouseMoved:event]; |
388 } | 388 } |
389 | 389 |
390 - (LocationBarViewMac*)locationBarBridge { | 390 - (LocationBarViewMac*)locationBarBridge { |
391 return locationBarView_.get(); | 391 return locationBarView_.get(); |
392 } | 392 } |
393 | 393 |
394 - (void)focusLocationBar:(BOOL)selectAll { | 394 - (void)focusLocationBar:(BOOL)selectAll { |
395 if (locationBarView_.get()) { | 395 if (locationBarView_.get()) { |
396 if (selectAll && | 396 locationBarView_->FocusLocation(selectAll ? true : false); |
397 locationBarView_->GetToolbarModel()->WouldOmitURLDueToOriginChip()) { | |
398 // select_all is true when it's expected that the user may want to copy | |
399 // the URL to the clipboard. If the origin chip is being displayed (and | |
400 // thus the URL is not being shown in the Omnibox) show it now to support | |
401 // the same functionality. | |
402 locationBarView_->GetOmniboxView()->ShowURL(); | |
403 } else { | |
404 locationBarView_->FocusLocation(selectAll ? true : false); | |
405 } | |
406 } | 397 } |
407 } | 398 } |
408 | 399 |
409 // Called when the state for a command changes to |enabled|. Update the | 400 // Called when the state for a command changes to |enabled|. Update the |
410 // corresponding UI element. | 401 // corresponding UI element. |
411 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled { | 402 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled { |
412 NSButton* button = nil; | 403 NSButton* button = nil; |
413 switch (command) { | 404 switch (command) { |
414 case IDC_BACK: | 405 case IDC_BACK: |
415 button = backButton_; | 406 button = backButton_; |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 842 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
852 // Do nothing. | 843 // Do nothing. |
853 } | 844 } |
854 | 845 |
855 // (URLDropTargetController protocol) | 846 // (URLDropTargetController protocol) |
856 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 847 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
857 return drag_util::IsUnsupportedDropData(profile_, info); | 848 return drag_util::IsUnsupportedDropData(profile_, info); |
858 } | 849 } |
859 | 850 |
860 @end | 851 @end |
OLD | NEW |