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.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1611 // If the browser is in incognito mode or has multi-profiles, install the image | 1611 // If the browser is in incognito mode or has multi-profiles, install the image |
1612 // view to decorate the window at the upper right. Use the same base y | 1612 // view to decorate the window at the upper right. Use the same base y |
1613 // coordinate as the tab strip. | 1613 // coordinate as the tab strip. |
1614 - (void)installAvatar { | 1614 - (void)installAvatar { |
1615 // Only install if this browser window is OTR and has a tab strip. | 1615 // Only install if this browser window is OTR and has a tab strip. |
1616 if (![self shouldShowAvatar]) | 1616 if (![self shouldShowAvatar]) |
1617 return; | 1617 return; |
1618 | 1618 |
1619 // Install the image into the badge view. Hide it for now; positioning, | 1619 // Install the image into the badge view. Hide it for now; positioning, |
1620 // sizing, and showing will be done by the layout code. The AvatarButton will | 1620 // sizing, and showing will be done by the layout code. The AvatarButton will |
1621 // choose which image to display based on the BWC. | 1621 // choose which image to display based on the browser. |
1622 avatarButton_.reset([[AvatarButton alloc] initWithController:self]); | 1622 avatarButton_.reset([[AvatarButton alloc] initWithBrowser:browser_.get()]); |
1623 [avatarButton_ setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; | 1623 [avatarButton_ setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; |
1624 [avatarButton_ setHidden:YES]; | 1624 [avatarButton_ setHidden:YES]; |
1625 // The button shouldn't do anything in incognito. | 1625 // The button shouldn't do anything in incognito. |
1626 [avatarButton_ setOpenMenuOnClick:!browser_->profile()->IsOffTheRecord()]; | 1626 [avatarButton_ setOpenMenuOnClick:!browser_->profile()->IsOffTheRecord()]; |
1627 | 1627 |
1628 // Install the view. | 1628 // Install the view. |
1629 [[[[self window] contentView] superview] addSubview:avatarButton_]; | 1629 [[[[self window] contentView] superview] addSubview:avatarButton_]; |
1630 } | 1630 } |
1631 | 1631 |
1632 // Documented in 10.6+, but present starting in 10.5. Called when we get a | 1632 // Documented in 10.6+, but present starting in 10.5. Called when we get a |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 | 2175 |
2176 - (BOOL)supportsBookmarkBar { | 2176 - (BOOL)supportsBookmarkBar { |
2177 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2177 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2178 } | 2178 } |
2179 | 2179 |
2180 - (BOOL)isTabbedWindow { | 2180 - (BOOL)isTabbedWindow { |
2181 return browser_->is_type_tabbed(); | 2181 return browser_->is_type_tabbed(); |
2182 } | 2182 } |
2183 | 2183 |
2184 @end // @implementation BrowserWindowController(WindowType) | 2184 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |