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/framed_browser_window.h" | 5 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
9 #include "chrome/browser/profiles/profile_info_util.h" | 9 #include "chrome/browser/profiles/profile_info_util.h" |
| 10 #include "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" |
10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
11 #import "chrome/browser/ui/cocoa/custom_frame_view.h" | 12 #import "chrome/browser/ui/cocoa/custom_frame_view.h" |
12 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 13 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
13 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
14 #import "chrome/browser/ui/cocoa/themed_window.h" | 15 #import "chrome/browser/ui/cocoa/themed_window.h" |
15 #include "chrome/browser/themes/theme_properties.h" | 16 #include "chrome/browser/themes/theme_properties.h" |
16 #include "chrome/browser/themes/theme_service.h" | 17 #include "chrome/browser/themes/theme_service.h" |
17 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
18 | 19 |
19 // Replicate specific 10.7 SDK declarations for building with prior SDKs. | 20 // Replicate specific 10.7 SDK declarations for building with prior SDKs. |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 NSPoint origin = NSMakePoint(0, -6); | 315 NSPoint origin = NSMakePoint(0, -6); |
315 | 316 |
316 // If there is a profile avatar present, shift the button over by its | 317 // If there is a profile avatar present, shift the button over by its |
317 // width and some padding. | 318 // width and some padding. |
318 BrowserWindowController* bwc = | 319 BrowserWindowController* bwc = |
319 static_cast<BrowserWindowController*>([self windowController]); | 320 static_cast<BrowserWindowController*>([self windowController]); |
320 if ([bwc shouldShowAvatar]) { | 321 if ([bwc shouldShowAvatar]) { |
321 AvatarButtonController* avatarButtonVC = [bwc avatarButtonController]; | 322 AvatarButtonController* avatarButtonVC = [bwc avatarButtonController]; |
322 NSView* avatarButton = [avatarButtonVC view]; | 323 NSView* avatarButton = [avatarButtonVC view]; |
323 origin.x = -(NSWidth([avatarButton frame]) + 3); | 324 origin.x = -(NSWidth([avatarButton frame]) + 3); |
| 325 if ([avatarButtonVC labelView]) |
| 326 origin.x -= NSWidth([[avatarButtonVC labelView] frame]) + 10; |
324 } else { | 327 } else { |
325 origin.x -= 6; | 328 origin.x -= 6; |
326 } | 329 } |
327 | 330 |
328 return origin; | 331 return origin; |
329 } | 332 } |
330 | 333 |
331 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view { | 334 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view { |
332 // WARNING: There is an obvious optimization opportunity here that you DO NOT | 335 // WARNING: There is an obvious optimization opportunity here that you DO NOT |
333 // want to take. To save painting cycles, you might think it would be a good | 336 // want to take. To save painting cycles, you might think it would be a good |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 if (titleColor) | 533 if (titleColor) |
531 return titleColor; | 534 return titleColor; |
532 | 535 |
533 if (incognito) | 536 if (incognito) |
534 return [NSColor whiteColor]; | 537 return [NSColor whiteColor]; |
535 else | 538 else |
536 return [NSColor windowFrameTextColor]; | 539 return [NSColor windowFrameTextColor]; |
537 } | 540 } |
538 | 541 |
539 @end | 542 @end |
OLD | NEW |