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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 1305143008: [Mac] Implement LocationBarViewMac::UpdateLocationBarVisibility() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/browser_window_controller_private.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/mac/bind_objc_block.h" 10 #include "base/mac/bind_objc_block.h"
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 - (void)permissionBubbleWindowWillClose:(NSNotification*)notification { 430 - (void)permissionBubbleWindowWillClose:(NSNotification*)notification {
431 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; 431 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
432 [center removeObserver:self 432 [center removeObserver:self
433 name:NSWindowWillCloseNotification 433 name:NSWindowWillCloseNotification
434 object:[notification object]]; 434 object:[notification object]];
435 [self releaseBarVisibilityForOwner:[notification object] 435 [self releaseBarVisibilityForOwner:[notification object]
436 withAnimation:YES 436 withAnimation:YES
437 delay:YES]; 437 delay:YES];
438 } 438 }
439 439
440 - (void)showToolbar:(NSNotification*)notification {
441 if (!shouldShowToolbar_) {
442 shouldShowToolbar_ = YES;
443 [self layoutSubviews];
444 }
445 }
446
447 - (void)hideToolbar:(NSNotification*)notification {
448 if (shouldShowToolbar_) {
449 shouldShowToolbar_ = NO;
450 [self layoutSubviews];
451 }
452 }
453
440 - (void)configurePresentationModeController { 454 - (void)configurePresentationModeController {
441 BOOL fullscreen_for_tab = browser_->exclusive_access_manager() 455 BOOL fullscreen_for_tab = browser_->exclusive_access_manager()
442 ->fullscreen_controller() 456 ->fullscreen_controller()
443 ->IsWindowFullscreenForTabOrPending(); 457 ->IsWindowFullscreenForTabOrPending();
444 BOOL kiosk_mode = 458 BOOL kiosk_mode =
445 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); 459 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode);
446 BOOL showDropdown = 460 BOOL showDropdown =
447 !fullscreen_for_tab && !kiosk_mode && ([self floatingBarHasFocus]); 461 !fullscreen_for_tab && !kiosk_mode && ([self floatingBarHasFocus]);
448 462
449 PermissionBubbleManager* manager = [self permissionBubbleManager]; 463 PermissionBubbleManager* manager = [self permissionBubbleManager];
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 [layout setFullscreenButtonFrame:[self fullscreenButtonFrame]]; 908 [layout setFullscreenButtonFrame:[self fullscreenButtonFrame]];
895 909
896 if ([self shouldShowAvatar]) { 910 if ([self shouldShowAvatar]) {
897 NSView* avatar = [avatarButtonController_ view]; 911 NSView* avatar = [avatarButtonController_ view];
898 [layout setShouldShowAvatar:YES]; 912 [layout setShouldShowAvatar:YES];
899 [layout setShouldUseNewAvatar:[self shouldUseNewAvatarButton]]; 913 [layout setShouldUseNewAvatar:[self shouldUseNewAvatarButton]];
900 [layout setAvatarSize:[avatar frame].size]; 914 [layout setAvatarSize:[avatar frame].size];
901 [layout setAvatarLineWidth:[[avatar superview] cr_lineWidth]]; 915 [layout setAvatarLineWidth:[[avatar superview] cr_lineWidth]];
902 } 916 }
903 917
904 [layout setHasToolbar:[self hasToolbar]]; 918 if (shouldShowToolbar_) {
tapted 2015/09/08 05:55:05 I think you can read `shouldShowToolbar` by just a
dominickn 2015/10/09 06:37:02 Done.
905 [layout setToolbarHeight:NSHeight([[toolbarController_ view] bounds])]; 919 [layout setHasToolbar:[self hasToolbar]];
920 [layout setToolbarHeight:NSHeight([[toolbarController_ view] bounds])];
921 } else {
922 [layout setHasToolbar:NO];
923 [layout setToolbarHeight:0];
924 }
906 925
907 [layout setHasLocationBar:[self hasLocationBar]]; 926 [layout setHasLocationBar:[self hasLocationBar]];
908 927
909 [layout setPlaceBookmarkBarBelowInfoBar:[self placeBookmarkBarBelowInfoBar]]; 928 [layout setPlaceBookmarkBarBelowInfoBar:[self placeBookmarkBarBelowInfoBar]];
910 [layout setBookmarkBarHidden:[bookmarkBarController_ view].isHidden]; 929 [layout setBookmarkBarHidden:[bookmarkBarController_ view].isHidden];
911 [layout setBookmarkBarHeight: 930 [layout setBookmarkBarHeight:
912 NSHeight([[bookmarkBarController_ view] bounds])]; 931 NSHeight([[bookmarkBarController_ view] bounds])];
913 932
914 [layout setInfoBarHeight:[infoBarContainerController_ heightOfInfoBars]]; 933 [layout setInfoBarHeight:[infoBarContainerController_ heightOfInfoBars]];
915 [layout setPageInfoBubblePointY:[self pageInfoBubblePointY]]; 934 [layout setPageInfoBubblePointY:[self pageInfoBubblePointY]];
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 return browser_->tab_strip_model()->GetActiveWebContents(); 1163 return browser_->tab_strip_model()->GetActiveWebContents();
1145 } 1164 }
1146 1165
1147 - (PermissionBubbleManager*)permissionBubbleManager { 1166 - (PermissionBubbleManager*)permissionBubbleManager {
1148 if (WebContents* contents = [self webContents]) 1167 if (WebContents* contents = [self webContents])
1149 return PermissionBubbleManager::FromWebContents(contents); 1168 return PermissionBubbleManager::FromWebContents(contents);
1150 return nil; 1169 return nil;
1151 } 1170 }
1152 1171
1153 @end // @implementation BrowserWindowController(Private) 1172 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698