Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 151283006: Mac OS X: Show the Translate icon on Omnibox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue-307352-translate-bubble-2
Patch Set: . Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 if (browserActionsController_.get()) { 437 if (browserActionsController_.get()) {
438 [browserActionsController_ update]; 438 [browserActionsController_ update];
439 } 439 }
440 } 440 }
441 441
442 - (void)setStarredState:(BOOL)isStarred { 442 - (void)setStarredState:(BOOL)isStarred {
443 locationBarView_->SetStarred(isStarred ? true : false); 443 locationBarView_->SetStarred(isStarred ? true : false);
444 } 444 }
445 445
446 - (void)setTranslateIconToggled:(BOOL)on {
447 locationBarView_->SetTranslateIconToggled(on ? true : false);
Nico 2014/02/05 06:07:18 No need for ` ? true : false` here either.
hajimehoshi 2014/02/05 11:08:03 Done.
448 }
449
446 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble { 450 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble {
447 locationBarView_->ZoomChangedForActiveTab( 451 locationBarView_->ZoomChangedForActiveTab(
448 canShowBubble && ![wrenchMenuController_ isMenuOpen]); 452 canShowBubble && ![wrenchMenuController_ isMenuOpen]);
449 } 453 }
450 454
451 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force { 455 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force {
452 [reloadButton_ setIsLoading:isLoading force:force]; 456 [reloadButton_ setIsLoading:isLoading force:force];
453 } 457 }
454 458
455 - (void)setHasToolbar:(BOOL)toolbar hasLocationBar:(BOOL)locBar { 459 - (void)setHasToolbar:(BOOL)toolbar hasLocationBar:(BOOL)locBar {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 return locationBarView_->GetBookmarkBubblePoint(); 731 return locationBarView_->GetBookmarkBubblePoint();
728 732
729 // Grab bottom middle of hotdogs. 733 // Grab bottom middle of hotdogs.
730 NSRect frame = wrenchButton_.frame; 734 NSRect frame = wrenchButton_.frame;
731 NSPoint point = NSMakePoint(NSMidX(frame), NSMinY(frame)); 735 NSPoint point = NSMakePoint(NSMidX(frame), NSMinY(frame));
732 // Inset to account for the whitespace around the hotdogs. 736 // Inset to account for the whitespace around the hotdogs.
733 point.y += wrench_menu_controller::kWrenchBubblePointOffsetY; 737 point.y += wrench_menu_controller::kWrenchBubblePointOffsetY;
734 return [self.view convertPoint:point toView:nil]; 738 return [self.view convertPoint:point toView:nil];
735 } 739 }
736 740
741 - (NSPoint)translateBubblePoint {
742 return locationBarView_->GetTranslateBubblePoint();
743 }
744
737 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight { 745 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight {
738 // With no toolbar, just ignore the compression. 746 // With no toolbar, just ignore the compression.
739 if (!hasToolbar_) 747 if (!hasToolbar_)
740 return NSHeight([locationBar_ frame]); 748 return NSHeight([locationBar_ frame]);
741 749
742 return kBaseToolbarHeightNormal - compressByHeight; 750 return kBaseToolbarHeightNormal - compressByHeight;
743 } 751 }
744 752
745 - (void)setDividerOpacity:(CGFloat)opacity { 753 - (void)setDividerOpacity:(CGFloat)opacity {
746 BackgroundGradientView* view = [self backgroundGradientView]; 754 BackgroundGradientView* view = [self backgroundGradientView];
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 - (void)hideDropURLsIndicatorInView:(NSView*)view { 825 - (void)hideDropURLsIndicatorInView:(NSView*)view {
818 // Do nothing. 826 // Do nothing.
819 } 827 }
820 828
821 // (URLDropTargetController protocol) 829 // (URLDropTargetController protocol)
822 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 830 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
823 return drag_util::IsUnsupportedDropData(profile_, info); 831 return drag_util::IsUnsupportedDropData(profile_, info);
824 } 832 }
825 833
826 @end 834 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698