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