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

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

Issue 1485002: Merge 41644 - [Mac] Add support for showing extensions in incognito mode, whi... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/342/src/
Patch Set: Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/extensions/browser_actions_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/cocoa/toolbar_controller.h" 5 #import "chrome/browser/cocoa/toolbar_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/l10n_util_mac.h" 9 #include "app/l10n_util_mac.h"
10 #include "base/mac_util.h" 10 #include "base/mac_util.h"
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 - (void)prefChanged:(std::wstring*)prefName { 585 - (void)prefChanged:(std::wstring*)prefName {
586 if (!prefName) return; 586 if (!prefName) return;
587 if (*prefName == prefs::kShowHomeButton) { 587 if (*prefName == prefs::kShowHomeButton) {
588 [self showOptionalHomeButton]; 588 [self showOptionalHomeButton];
589 } else if (*prefName == prefs::kShowPageOptionsButtons) { 589 } else if (*prefName == prefs::kShowPageOptionsButtons) {
590 [self showOptionalPageWrenchButtons]; 590 [self showOptionalPageWrenchButtons];
591 } 591 }
592 } 592 }
593 593
594 - (void)createBrowserActionButtons { 594 - (void)createBrowserActionButtons {
595 if (browserActionsController_.get() == nil) { 595 if (!browserActionsController_.get()) {
596 browserActionsController_.reset([[BrowserActionsController alloc] 596 browserActionsController_.reset([[BrowserActionsController alloc]
597 initWithBrowser:browser_ 597 initWithBrowser:browser_
598 containerView:browserActionsContainerView_]); 598 containerView:browserActionsContainerView_]);
599 [[NSNotificationCenter defaultCenter] 599 [[NSNotificationCenter defaultCenter]
600 addObserver:self 600 addObserver:self
601 selector:@selector(browserActionsContainerDragged) 601 selector:@selector(browserActionsContainerDragged)
602 name:kBrowserActionGrippyDraggingNotification 602 name:kBrowserActionGrippyDraggingNotification
603 object:browserActionsController_]; 603 object:browserActionsController_];
604 [[NSNotificationCenter defaultCenter] 604 [[NSNotificationCenter defaultCenter]
605 addObserver:self 605 addObserver:self
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 - (void)maintainMinimumLocationBarWidth { 655 - (void)maintainMinimumLocationBarWidth {
656 CGFloat locationBarWidth = NSWidth([locationBar_ frame]); 656 CGFloat locationBarWidth = NSWidth([locationBar_ frame]);
657 locationBarAtMinSize_ = locationBarWidth <= kMinimumLocationBarWidth; 657 locationBarAtMinSize_ = locationBarWidth <= kMinimumLocationBarWidth;
658 if (locationBarAtMinSize_) { 658 if (locationBarAtMinSize_) {
659 CGFloat dX = kMinimumLocationBarWidth - locationBarWidth; 659 CGFloat dX = kMinimumLocationBarWidth - locationBarWidth;
660 [self adjustLocationAndGoPositionsBy:dX]; 660 [self adjustLocationAndGoPositionsBy:dX];
661 } 661 }
662 } 662 }
663 663
664 - (void)toolbarFrameChanged { 664 - (void)toolbarFrameChanged {
665 // Do nothing if the frame changes but no Browser Action Controller is
666 // present.
667 if (!browserActionsController_.get())
668 return;
669
665 [self maintainMinimumLocationBarWidth]; 670 [self maintainMinimumLocationBarWidth];
666 671
667 if (locationBarAtMinSize_) { 672 if (locationBarAtMinSize_) {
668 // Once the grippy is pinned, leave it until it is explicity un-pinned. 673 // Once the grippy is pinned, leave it until it is explicity un-pinned.
669 [browserActionsContainerView_ setGrippyPinned:YES]; 674 [browserActionsContainerView_ setGrippyPinned:YES];
670 NSRect containerFrame = [browserActionsContainerView_ frame]; 675 NSRect containerFrame = [browserActionsContainerView_ frame];
671 // Determine how much the container needs to move in case it's overlapping 676 // Determine how much the container needs to move in case it's overlapping
672 // with the location bar. 677 // with the location bar.
673 CGFloat dX = ([goButton_ frame].origin.x + NSWidth([goButton_ frame])) - 678 CGFloat dX = ([goButton_ frame].origin.x + NSWidth([goButton_ frame])) -
674 containerFrame.origin.x + kBrowserActionsContainerLeftPadding; 679 containerFrame.origin.x + kBrowserActionsContainerLeftPadding;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { 844 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point {
840 // Do nothing. 845 // Do nothing.
841 } 846 }
842 847
843 // (URLDropTargetController protocol) 848 // (URLDropTargetController protocol)
844 - (void)hideDropURLsIndicatorInView:(NSView*)view { 849 - (void)hideDropURLsIndicatorInView:(NSView*)view {
845 // Do nothing. 850 // Do nothing.
846 } 851 }
847 852
848 @end 853 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/extensions/browser_actions_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698