| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import "base/memory/scoped_nsobject.h" | 10 #import "base/memory/scoped_nsobject.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 13 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/profiles/profile_info_util.h" |
| 15 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 16 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 16 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
| 17 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" | 18 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" |
| 18 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 19 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
| 19 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" | 20 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" |
| 20 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" | 21 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" |
| 21 #import "chrome/browser/ui/cocoa/focus_tracker.h" | 22 #import "chrome/browser/ui/cocoa/focus_tracker.h" |
| 22 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 23 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 23 #import "chrome/browser/ui/cocoa/fullscreen_window.h" | 24 #import "chrome/browser/ui/cocoa/fullscreen_window.h" |
| 24 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 25 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 if ([self shouldShowAvatar]) | 351 if ([self shouldShowAvatar]) |
| 351 rightIndent += (kAvatarTabStripShrink + possibleExtraShiftForLion); | 352 rightIndent += (kAvatarTabStripShrink + possibleExtraShiftForLion); |
| 352 [tabStripController_ setRightIndentForControls:rightIndent]; | 353 [tabStripController_ setRightIndentForControls:rightIndent]; |
| 353 | 354 |
| 354 // Go ahead and layout the tabs. | 355 // Go ahead and layout the tabs. |
| 355 [tabStripController_ layoutTabsWithoutAnimation]; | 356 [tabStripController_ layoutTabsWithoutAnimation]; |
| 356 | 357 |
| 357 // Now lay out incognito badge together with the tab strip. | 358 // Now lay out incognito badge together with the tab strip. |
| 358 if ([self shouldShowAvatar]) { | 359 if ([self shouldShowAvatar]) { |
| 359 NSView* avatarButton = [avatarButtonController_ view]; | 360 NSView* avatarButton = [avatarButtonController_ view]; |
| 360 [avatarButton setFrameSize:NSMakeSize(tabStripHeight, | 361 CGFloat buttonHeight = std::min( |
| 361 tabStripHeight - 5.0)]; | 362 static_cast<CGFloat>(profiles::kAvatarIconHeight), tabStripHeight); |
| 363 [avatarButton setFrameSize:NSMakeSize(profiles::kAvatarIconWidth, |
| 364 buttonHeight)]; |
| 362 | 365 |
| 363 // Actually place the badge *above* |maxY|, by +2 to miss the divider. On | 366 // Actually place the badge *above* |maxY|, by +2 to miss the divider. On |
| 364 // Lion or later, shift the badge left to move it away from the fullscreen | 367 // Lion or later, shift the badge left to move it away from the fullscreen |
| 365 // button. | 368 // button. |
| 366 CGFloat badgeOffset = kAvatarRightOffset + possibleExtraShiftForLion; | 369 CGFloat badgeOffset = kAvatarRightOffset + possibleExtraShiftForLion; |
| 367 NSPoint origin = | 370 NSPoint origin = |
| 368 NSMakePoint(width - NSWidth([avatarButton frame]) - badgeOffset, | 371 NSMakePoint(width - NSWidth([avatarButton frame]) - badgeOffset, |
| 369 maxY + 2); | 372 maxY + 2); |
| 370 [avatarButton setFrameOrigin:origin]; | 373 [avatarButton setFrameOrigin:origin]; |
| 371 [avatarButton setHidden:NO]; // Make sure it's shown. | 374 [avatarButton setHidden:NO]; // Make sure it's shown. |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 - (void)disableBarVisibilityUpdates { | 902 - (void)disableBarVisibilityUpdates { |
| 900 // Early escape if there's nothing to do. | 903 // Early escape if there's nothing to do. |
| 901 if (!barVisibilityUpdatesEnabled_) | 904 if (!barVisibilityUpdatesEnabled_) |
| 902 return; | 905 return; |
| 903 | 906 |
| 904 barVisibilityUpdatesEnabled_ = NO; | 907 barVisibilityUpdatesEnabled_ = NO; |
| 905 [presentationModeController_ cancelAnimationAndTimers]; | 908 [presentationModeController_ cancelAnimationAndTimers]; |
| 906 } | 909 } |
| 907 | 910 |
| 908 @end // @implementation BrowserWindowController(Private) | 911 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |