Chromium Code Reviews| 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 [avatarButton setFrameSize:NSMakeSize(profiles::kAvatarIconWidth, |
|
sail
2011/11/26 06:52:00
On my machine (10.6) tabStripHeight is 37 pixels.
Robert Sesek
2011/11/28 23:03:23
Does this look OK now? Or should we turn on image
sail
2011/11/28 23:11:33
This looks really good now.
With the new control s
| |
| 361 tabStripHeight - 5.0)]; | 362 MIN(profiles::kAvatarIconHeight, tabStripHeight))]; |
|
Robert Sesek
2011/11/28 19:17:53
std::min
sail
2011/11/28 19:40:31
Done.
| |
| 362 | 363 |
| 363 // Actually place the badge *above* |maxY|, by +2 to miss the divider. On | 364 // 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 | 365 // Lion or later, shift the badge left to move it away from the fullscreen |
| 365 // button. | 366 // button. |
| 366 CGFloat badgeOffset = kAvatarRightOffset + possibleExtraShiftForLion; | 367 CGFloat badgeOffset = kAvatarRightOffset + possibleExtraShiftForLion; |
| 367 NSPoint origin = | 368 NSPoint origin = |
| 368 NSMakePoint(width - NSWidth([avatarButton frame]) - badgeOffset, | 369 NSMakePoint(width - NSWidth([avatarButton frame]) - badgeOffset, |
| 369 maxY + 2); | 370 maxY + 2); |
| 370 [avatarButton setFrameOrigin:origin]; | 371 [avatarButton setFrameOrigin:origin]; |
| 371 [avatarButton setHidden:NO]; // Make sure it's shown. | 372 [avatarButton setHidden:NO]; // Make sure it's shown. |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 899 - (void)disableBarVisibilityUpdates { | 900 - (void)disableBarVisibilityUpdates { |
| 900 // Early escape if there's nothing to do. | 901 // Early escape if there's nothing to do. |
| 901 if (!barVisibilityUpdatesEnabled_) | 902 if (!barVisibilityUpdatesEnabled_) |
| 902 return; | 903 return; |
| 903 | 904 |
| 904 barVisibilityUpdatesEnabled_ = NO; | 905 barVisibilityUpdatesEnabled_ = NO; |
| 905 [presentationModeController_ cancelAnimationAndTimers]; | 906 [presentationModeController_ cancelAnimationAndTimers]; |
| 906 } | 907 } |
| 907 | 908 |
| 908 @end // @implementation BrowserWindowController(Private) | 909 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |