| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <Carbon/Carbon.h> | 5 #include <Carbon/Carbon.h> |
| 6 | 6 |
| 7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
| 8 #include "base/scoped_nsdisable_screen_updates.h" | 8 #include "base/scoped_nsdisable_screen_updates.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/app/chrome_dll_resource.h" // IDC_* | 10 #include "chrome/app/chrome_dll_resource.h" // IDC_* |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 [self positionOrRemoveToolbar:NO]; | 775 [self positionOrRemoveToolbar:NO]; |
| 776 } | 776 } |
| 777 | 777 |
| 778 // If the browser is in incognito mode, install the image view to decordate | 778 // If the browser is in incognito mode, install the image view to decordate |
| 779 // the window at the upper right. Use the same base y coordinate as the | 779 // the window at the upper right. Use the same base y coordinate as the |
| 780 // tab strip. | 780 // tab strip. |
| 781 - (void)installIncognitoBadge { | 781 - (void)installIncognitoBadge { |
| 782 if (!browser_->profile()->IsOffTheRecord()) | 782 if (!browser_->profile()->IsOffTheRecord()) |
| 783 return; | 783 return; |
| 784 | 784 |
| 785 static const float kOffset = 4; |
| 785 NSString *incognitoPath = [mac_util::MainAppBundle() | 786 NSString *incognitoPath = [mac_util::MainAppBundle() |
| 786 pathForResource:@"otr_icon" | 787 pathForResource:@"otr_icon" |
| 787 ofType:@"pdf"]; | 788 ofType:@"pdf"]; |
| 788 scoped_nsobject<NSImage> incognitoImage( | 789 scoped_nsobject<NSImage> incognitoImage( |
| 789 [[NSImage alloc] initWithContentsOfFile:incognitoPath]); | 790 [[NSImage alloc] initWithContentsOfFile:incognitoPath]); |
| 790 const NSSize imageSize = [incognitoImage size]; | 791 const NSSize imageSize = [incognitoImage size]; |
| 791 const NSRect tabFrame = [[self tabStripView] frame]; | 792 const NSRect tabFrame = [[self tabStripView] frame]; |
| 792 NSRect incognitoFrame = tabFrame; | 793 NSRect incognitoFrame = tabFrame; |
| 793 incognitoFrame.origin.x = NSMaxX(incognitoFrame) - imageSize.width; | 794 incognitoFrame.origin.x = NSMaxX(incognitoFrame) - imageSize.width - |
| 795 kOffset; |
| 794 incognitoFrame.size = imageSize; | 796 incognitoFrame.size = imageSize; |
| 795 scoped_nsobject<NSImageView> incognitoView( | 797 scoped_nsobject<NSImageView> incognitoView( |
| 796 [[NSImageView alloc] initWithFrame:incognitoFrame]); | 798 [[NSImageView alloc] initWithFrame:incognitoFrame]); |
| 797 [incognitoView setImage:incognitoImage]; | 799 [incognitoView setImage:incognitoImage]; |
| 798 [[[[self window] contentView] superview] addSubview:incognitoView.get()]; | 800 [[[[self window] contentView] superview] addSubview:incognitoView.get()]; |
| 799 } | 801 } |
| 800 | 802 |
| 801 - (void)fixWindowGradient { | 803 - (void)fixWindowGradient { |
| 802 NSWindow* win = [self window]; | 804 NSWindow* win = [self window]; |
| 803 if ([win respondsToSelector:@selector( | 805 if ([win respondsToSelector:@selector( |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 browser_->ExecuteCommand(command); | 897 browser_->ExecuteCommand(command); |
| 896 } | 898 } |
| 897 | 899 |
| 898 - (id)windowWillReturnFieldEditor:(NSWindow*)sender toObject:(id)obj { | 900 - (id)windowWillReturnFieldEditor:(NSWindow*)sender toObject:(id)obj { |
| 899 // Ask the toolbar controller if it wants to return a custom field editor | 901 // Ask the toolbar controller if it wants to return a custom field editor |
| 900 // for the specific object. | 902 // for the specific object. |
| 901 return [toolbarController_ customFieldEditorForObject:obj]; | 903 return [toolbarController_ customFieldEditorForObject:obj]; |
| 902 } | 904 } |
| 903 | 905 |
| 904 @end | 906 @end |
| OLD | NEW |