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 #import "base/scoped_nsobject.h" | 9 #import "base/scoped_nsobject.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // Register ourselves for frame changed notifications from the | 197 // Register ourselves for frame changed notifications from the |
198 // tabContentArea. This has to come after all of the resizing and | 198 // tabContentArea. This has to come after all of the resizing and |
199 // positioning above. | 199 // positioning above. |
200 [[NSNotificationCenter defaultCenter] | 200 [[NSNotificationCenter defaultCenter] |
201 addObserver:self | 201 addObserver:self |
202 selector:@selector(tabContentAreaFrameChanged:) | 202 selector:@selector(tabContentAreaFrameChanged:) |
203 name:nil | 203 name:nil |
204 object:[self tabContentArea]]; | 204 object:[self tabContentArea]]; |
205 | 205 |
206 // Create the bridge for the status bubble. | 206 // Create the bridge for the status bubble. |
207 statusBubble_.reset(new StatusBubbleMac([self window])); | 207 statusBubble_.reset(new StatusBubbleMac([self window], self)); |
208 | 208 |
209 #if 0 | 209 #if 0 |
210 // Move all buttons down two pixels for visual balance. | 210 // Move all buttons down two pixels for visual balance. |
211 // TODO(alcor): remove this if we can't prevent window resize from breaking. | 211 // TODO(alcor): remove this if we can't prevent window resize from breaking. |
212 NSArray* buttons = | 212 NSArray* buttons = |
213 [NSArray arrayWithObjects: | 213 [NSArray arrayWithObjects: |
214 [[self window] standardWindowButton:NSWindowCloseButton], | 214 [[self window] standardWindowButton:NSWindowCloseButton], |
215 [[self window] standardWindowButton:NSWindowZoomButton], | 215 [[self window] standardWindowButton:NSWindowZoomButton], |
216 [[self window] standardWindowButton:NSWindowMiniaturizeButton], | 216 [[self window] standardWindowButton:NSWindowMiniaturizeButton], |
217 nil]; | 217 nil]; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 browser_->ExecuteCommand(tag); | 433 browser_->ExecuteCommand(tag); |
434 } | 434 } |
435 | 435 |
436 // Called when another part of the internal codebase needs to execute a | 436 // Called when another part of the internal codebase needs to execute a |
437 // command. | 437 // command. |
438 - (void)executeCommand:(int)command { | 438 - (void)executeCommand:(int)command { |
439 if (browser_->command_updater()->IsCommandEnabled(command)) | 439 if (browser_->command_updater()->IsCommandEnabled(command)) |
440 browser_->ExecuteCommand(command); | 440 browser_->ExecuteCommand(command); |
441 } | 441 } |
442 | 442 |
| 443 // StatusBubble delegate method: tell the status bubble how far above the bottom |
| 444 // of the window it should position itself. |
| 445 - (float)verticalOffsetForStatusBubble { |
| 446 float offset = 0.0; |
| 447 |
| 448 // Don't create a download shelf if there isn't one. |
| 449 if (downloadShelfController_.get() && [[self downloadShelf] isVisible]) |
| 450 offset += [[self downloadShelf] height]; |
| 451 |
| 452 return offset; |
| 453 } |
| 454 |
443 - (LocationBar*)locationBar { | 455 - (LocationBar*)locationBar { |
444 return [toolbarController_ locationBar]; | 456 return [toolbarController_ locationBar]; |
445 } | 457 } |
446 | 458 |
447 - (StatusBubble*)statusBubble { | 459 - (StatusBubble*)statusBubble { |
448 return statusBubble_.get(); | 460 return statusBubble_.get(); |
449 } | 461 } |
450 | 462 |
451 - (void)updateToolbarWithContents:(TabContents*)tab | 463 - (void)updateToolbarWithContents:(TabContents*)tab |
452 shouldRestoreState:(BOOL)shouldRestore { | 464 shouldRestoreState:(BOOL)shouldRestore { |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 NSColor* toolbarButtonBorderColor = toolbarButtonIconColor; | 1123 NSColor* toolbarButtonBorderColor = toolbarButtonIconColor; |
1112 [theme setValue:toolbarButtonBorderColor | 1124 [theme setValue:toolbarButtonBorderColor |
1113 forAttribute:@"borderColor" | 1125 forAttribute:@"borderColor" |
1114 style:GTMThemeStyleToolBar | 1126 style:GTMThemeStyleToolBar |
1115 state:YES]; | 1127 state:YES]; |
1116 | 1128 |
1117 return theme; | 1129 return theme; |
1118 } | 1130 } |
1119 @end | 1131 @end |
1120 | 1132 |
OLD | NEW |