| 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 "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
| 9 #include "base/scoped_nsdisable_screen_updates.h" | 9 #include "base/scoped_nsdisable_screen_updates.h" |
| 10 #import "base/scoped_nsobject.h" | 10 #import "base/scoped_nsobject.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 [toolbarController_ setHasToolbar:NO]; | 170 [toolbarController_ setHasToolbar:NO]; |
| 171 } | 171 } |
| 172 [[[self window] contentView] addSubview:[toolbarController_ view]]; | 172 [[[self window] contentView] addSubview:[toolbarController_ view]]; |
| 173 | 173 |
| 174 // Create a sub-controller for the bookmark bar. | 174 // Create a sub-controller for the bookmark bar. |
| 175 bookmarkBarController_.reset( | 175 bookmarkBarController_.reset( |
| 176 [[BookmarkBarController alloc] | 176 [[BookmarkBarController alloc] |
| 177 initWithBrowser:browser_.get() | 177 initWithBrowser:browser_.get() |
| 178 initialWidth:NSWidth([[[self window] contentView] frame]) | 178 initialWidth:NSWidth([[[self window] contentView] frame]) |
| 179 compressDelegate:toolbarController_.get() | 179 compressDelegate:toolbarController_.get() |
| 180 resizeDelegate:self | 180 resizeDelegate:self]); |
| 181 urlDelegate:self]); | |
| 182 | 181 |
| 183 // Add bookmark bar to the view hierarchy. This also triggers the | 182 // Add bookmark bar to the view hierarchy. This also triggers the |
| 184 // nib load. The bookmark bar is defined (in the nib) to be | 183 // nib load. The bookmark bar is defined (in the nib) to be |
| 185 // bottom-aligned to it's parent view (among other things), so | 184 // bottom-aligned to it's parent view (among other things), so |
| 186 // position and resize properties don't need to be set. | 185 // position and resize properties don't need to be set. |
| 187 [[[self window] contentView] addSubview:[bookmarkBarController_ view] | 186 [[[self window] contentView] addSubview:[bookmarkBarController_ view] |
| 188 positioned:NSWindowBelow | 187 positioned:NSWindowBelow |
| 189 relativeTo:[toolbarController_ view]]; | 188 relativeTo:[toolbarController_ view]]; |
| 190 | 189 |
| 191 // Disable the bookmark bar if this window doesn't support them. | 190 // Disable the bookmark bar if this window doesn't support them. |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 [self adjustUIForFullscreen:fullscreen]; | 1037 [self adjustUIForFullscreen:fullscreen]; |
| 1039 [dstWindow makeKeyAndOrderFront:self]; | 1038 [dstWindow makeKeyAndOrderFront:self]; |
| 1040 | 1039 |
| 1041 [window orderOut:self]; | 1040 [window orderOut:self]; |
| 1042 } | 1041 } |
| 1043 | 1042 |
| 1044 - (BOOL)isFullscreen { | 1043 - (BOOL)isFullscreen { |
| 1045 return savedRegularWindow_ != nil; | 1044 return savedRegularWindow_ != nil; |
| 1046 } | 1045 } |
| 1047 | 1046 |
| 1048 // Called by the bookmark bar to open a URL. | |
| 1049 - (void)openBookmarkURL:(const GURL&)url | |
| 1050 disposition:(WindowOpenDisposition)disposition { | |
| 1051 browser_->OpenURL(url, GURL(), disposition, PageTransition::AUTO_BOOKMARK); | |
| 1052 } | |
| 1053 | |
| 1054 - (NSInteger)numberOfTabs { | 1047 - (NSInteger)numberOfTabs { |
| 1055 return browser_->tabstrip_model()->count(); | 1048 return browser_->tabstrip_model()->count(); |
| 1056 } | 1049 } |
| 1057 | 1050 |
| 1058 - (NSString*)selectedTabTitle { | 1051 - (NSString*)selectedTabTitle { |
| 1059 TabContents* contents = browser_->tabstrip_model()->GetSelectedTabContents(); | 1052 TabContents* contents = browser_->tabstrip_model()->GetSelectedTabContents(); |
| 1060 return base::SysUTF16ToNSString(contents->GetTitle()); | 1053 return base::SysUTF16ToNSString(contents->GetTitle()); |
| 1061 } | 1054 } |
| 1062 | 1055 |
| 1063 // TYPE_POPUP is not normal (e.g. no tab strip) | 1056 // TYPE_POPUP is not normal (e.g. no tab strip) |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 if (frameOverlayInactiveImage) { | 1612 if (frameOverlayInactiveImage) { |
| 1620 [theme setValue:frameOverlayInactiveImage | 1613 [theme setValue:frameOverlayInactiveImage |
| 1621 forAttribute:@"overlay" | 1614 forAttribute:@"overlay" |
| 1622 style:GTMThemeStyleWindow | 1615 style:GTMThemeStyleWindow |
| 1623 state:GTMThemeStateInactiveWindow]; | 1616 state:GTMThemeStateInactiveWindow]; |
| 1624 } | 1617 } |
| 1625 | 1618 |
| 1626 return theme; | 1619 return theme; |
| 1627 } | 1620 } |
| 1628 @end | 1621 @end |
| OLD | NEW |