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 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 browser_->OnWindowDidShow(); | 127 browser_->OnWindowDidShow(); |
128 } | 128 } |
129 | 129 |
130 void BrowserWindowCocoa::ShowInactive() { | 130 void BrowserWindowCocoa::ShowInactive() { |
131 [window() orderFront:controller_]; | 131 [window() orderFront:controller_]; |
132 } | 132 } |
133 | 133 |
134 void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) { | 134 void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) { |
135 gfx::Rect real_bounds = [controller_ enforceMinWindowSize:bounds]; | 135 gfx::Rect real_bounds = [controller_ enforceMinWindowSize:bounds]; |
136 | 136 |
137 SetFullscreen(false); | 137 SetFullscreen(false, GURL(), false); |
138 NSRect cocoa_bounds = NSMakeRect(real_bounds.x(), 0, | 138 NSRect cocoa_bounds = NSMakeRect(real_bounds.x(), 0, |
139 real_bounds.width(), | 139 real_bounds.width(), |
140 real_bounds.height()); | 140 real_bounds.height()); |
141 // Flip coordinates based on the primary screen. | 141 // Flip coordinates based on the primary screen. |
142 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 142 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
143 cocoa_bounds.origin.y = | 143 cocoa_bounds.origin.y = |
144 [screen frame].size.height - real_bounds.height() - real_bounds.y(); | 144 [screen frame].size.height - real_bounds.height() - real_bounds.y(); |
145 | 145 |
146 [window() setFrame:cocoa_bounds display:YES]; | 146 [window() setFrame:cocoa_bounds display:YES]; |
147 } | 147 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 | 249 |
250 bool BrowserWindowCocoa::IsMaximized() const { | 250 bool BrowserWindowCocoa::IsMaximized() const { |
251 return [window() isZoomed]; | 251 return [window() isZoomed]; |
252 } | 252 } |
253 | 253 |
254 bool BrowserWindowCocoa::IsMinimized() const { | 254 bool BrowserWindowCocoa::IsMinimized() const { |
255 return [window() isMiniaturized]; | 255 return [window() isMiniaturized]; |
256 } | 256 } |
257 | 257 |
258 void BrowserWindowCocoa::SetFullscreen(bool fullscreen) { | 258 void BrowserWindowCocoa::SetFullscreen(bool fullscreen, const GURL& url, bool sh
ow_buttons) { |
259 [controller_ setFullscreen:fullscreen]; | 259 [controller_ setFullscreen:fullscreen forURL:url showButtons:show_buttons]; |
260 } | 260 } |
261 | 261 |
262 bool BrowserWindowCocoa::IsFullscreen() const { | 262 bool BrowserWindowCocoa::IsFullscreen() const { |
263 return !![controller_ isFullscreen]; | 263 return !![controller_ isFullscreen]; |
264 } | 264 } |
265 | 265 |
266 bool BrowserWindowCocoa::IsFullscreenBubbleVisible() const { | 266 bool BrowserWindowCocoa::IsFullscreenBubbleVisible() const { |
267 return false; | 267 return false; |
268 } | 268 } |
269 | 269 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 } | 499 } |
500 | 500 |
501 void BrowserWindowCocoa::ToggleTabStripMode() { | 501 void BrowserWindowCocoa::ToggleTabStripMode() { |
502 NOTIMPLEMENTED(); | 502 NOTIMPLEMENTED(); |
503 } | 503 } |
504 | 504 |
505 void BrowserWindowCocoa::OpenTabpose() { | 505 void BrowserWindowCocoa::OpenTabpose() { |
506 [controller_ openTabpose]; | 506 [controller_ openTabpose]; |
507 } | 507 } |
508 | 508 |
509 void BrowserWindowCocoa::SetPresentationMode(bool presentation_mode) { | 509 void BrowserWindowCocoa::SetPresentationMode(bool presentation_mode, |
510 [controller_ setPresentationMode:presentation_mode]; | 510 const GURL& url, |
| 511 bool show_buttons) { |
| 512 [controller_ setPresentationMode:presentation_mode |
| 513 url:url |
| 514 showButtons:show_buttons]; |
511 } | 515 } |
512 | 516 |
513 bool BrowserWindowCocoa::InPresentationMode() { | 517 bool BrowserWindowCocoa::InPresentationMode() { |
514 return [controller_ inPresentationMode]; | 518 return [controller_ inPresentationMode]; |
515 } | 519 } |
516 | 520 |
517 void BrowserWindowCocoa::PrepareForInstant() { | 521 void BrowserWindowCocoa::PrepareForInstant() { |
518 // TODO: implement fade as done on windows. | 522 // TODO: implement fade as done on windows. |
519 } | 523 } |
520 | 524 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 586 |
583 NSWindow* BrowserWindowCocoa::window() const { | 587 NSWindow* BrowserWindowCocoa::window() const { |
584 return [controller_ window]; | 588 return [controller_ window]; |
585 } | 589 } |
586 | 590 |
587 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { | 591 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { |
588 if (tab_contents == browser_->GetSelectedTabContents()) { | 592 if (tab_contents == browser_->GetSelectedTabContents()) { |
589 [controller_ updateSidebarForContents:tab_contents]; | 593 [controller_ updateSidebarForContents:tab_contents]; |
590 } | 594 } |
591 } | 595 } |
OLD | NEW |