| OLD | NEW |
| 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 #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/profiles/profile_info_util.h" |
| 16 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 16 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 17 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" | 17 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" |
| 18 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" | 18 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" |
| 19 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 19 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
| 20 #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" |
| 21 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" | 21 #import "chrome/browser/ui/cocoa/floating_bar_backing_view.h" |
| 22 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 22 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 23 #import "chrome/browser/ui/cocoa/fullscreen_window.h" | 23 #import "chrome/browser/ui/cocoa/fullscreen_window.h" |
| 24 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 24 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 25 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
| 25 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" | 26 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" |
| 26 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" | 27 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" |
| 27 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" | 28 #import "chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller.h" |
| 28 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 29 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 29 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | 30 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
| 30 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 31 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 31 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 32 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 32 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 33 #include "content/public/browser/render_widget_host_view.h" | 34 #include "content/public/browser/render_widget_host_view.h" |
| 34 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 if ([self shouldShowAvatar]) { | 365 if ([self shouldShowAvatar]) { |
| 365 NSView* avatarButton = [avatarButtonController_ view]; | 366 NSView* avatarButton = [avatarButtonController_ view]; |
| 366 CGFloat buttonHeight = std::min( | 367 CGFloat buttonHeight = std::min( |
| 367 static_cast<CGFloat>(profiles::kAvatarIconHeight), tabStripHeight); | 368 static_cast<CGFloat>(profiles::kAvatarIconHeight), tabStripHeight); |
| 368 [avatarButton setFrameSize:NSMakeSize(profiles::kAvatarIconWidth, | 369 [avatarButton setFrameSize:NSMakeSize(profiles::kAvatarIconWidth, |
| 369 buttonHeight)]; | 370 buttonHeight)]; |
| 370 | 371 |
| 371 // Actually place the badge *above* |maxY|, by +2 to miss the divider. On | 372 // Actually place the badge *above* |maxY|, by +2 to miss the divider. On |
| 372 // Lion or later, shift the badge left to move it away from the fullscreen | 373 // Lion or later, shift the badge left to move it away from the fullscreen |
| 373 // button. | 374 // button. |
| 374 CGFloat badgeOffset = kAvatarRightOffset + possibleExtraShiftForLion; | 375 CGFloat badgeXOffset = -(kAvatarRightOffset + possibleExtraShiftForLion); |
| 376 CGFloat badgeYOffset = 2 * [[avatarButton superview] cr_lineWidth]; |
| 375 NSPoint origin = | 377 NSPoint origin = |
| 376 NSMakePoint(width - NSWidth([avatarButton frame]) - badgeOffset, | 378 NSMakePoint(width - NSWidth([avatarButton frame]) + badgeXOffset, |
| 377 maxY + 2); | 379 maxY + badgeYOffset); |
| 378 [avatarButton setFrameOrigin:origin]; | 380 [avatarButton setFrameOrigin:origin]; |
| 379 [avatarButton setHidden:NO]; // Make sure it's shown. | 381 [avatarButton setHidden:NO]; // Make sure it's shown. |
| 380 } | 382 } |
| 381 | 383 |
| 382 return maxY; | 384 return maxY; |
| 383 } | 385 } |
| 384 | 386 |
| 385 - (CGFloat)layoutToolbarAtMinX:(CGFloat)minX | 387 - (CGFloat)layoutToolbarAtMinX:(CGFloat)minX |
| 386 maxY:(CGFloat)maxY | 388 maxY:(CGFloat)maxY |
| 387 width:(CGFloat)width { | 389 width:(CGFloat)width { |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 - (void)disableBarVisibilityUpdates { | 905 - (void)disableBarVisibilityUpdates { |
| 904 // Early escape if there's nothing to do. | 906 // Early escape if there's nothing to do. |
| 905 if (!barVisibilityUpdatesEnabled_) | 907 if (!barVisibilityUpdatesEnabled_) |
| 906 return; | 908 return; |
| 907 | 909 |
| 908 barVisibilityUpdatesEnabled_ = NO; | 910 barVisibilityUpdatesEnabled_ = NO; |
| 909 [presentationModeController_ cancelAnimationAndTimers]; | 911 [presentationModeController_ cancelAnimationAndTimers]; |
| 910 } | 912 } |
| 911 | 913 |
| 912 @end // @implementation BrowserWindowController(Private) | 914 @end // @implementation BrowserWindowController(Private) |
| OLD | NEW |