| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 BrowserList::SetLastActive(browser_); | 69 BrowserList::SetLastActive(browser_); |
| 70 | 70 |
| 71 [window() makeKeyAndOrderFront:controller_]; | 71 [window() makeKeyAndOrderFront:controller_]; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void BrowserWindowCocoa::ShowInactive() { | 74 void BrowserWindowCocoa::ShowInactive() { |
| 75 [window() orderFront:controller_]; | 75 [window() orderFront:controller_]; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) { | 78 void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) { |
| 79 gfx::Rect real_bounds = [controller_ enforceMinWindowSize:bounds]; |
| 80 |
| 79 SetFullscreen(false); | 81 SetFullscreen(false); |
| 80 NSRect cocoa_bounds = NSMakeRect(bounds.x(), 0, bounds.width(), | 82 NSRect cocoa_bounds = NSMakeRect(real_bounds.x(), 0, |
| 81 bounds.height()); | 83 real_bounds.width(), |
| 84 real_bounds.height()); |
| 82 // Flip coordinates based on the primary screen. | 85 // Flip coordinates based on the primary screen. |
| 83 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 86 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
| 84 cocoa_bounds.origin.y = | 87 cocoa_bounds.origin.y = |
| 85 [screen frame].size.height - bounds.height() - bounds.y(); | 88 [screen frame].size.height - real_bounds.height() - real_bounds.y(); |
| 86 | 89 |
| 87 [window() setFrame:cocoa_bounds display:YES]; | 90 [window() setFrame:cocoa_bounds display:YES]; |
| 88 } | 91 } |
| 89 | 92 |
| 90 // Callers assume that this doesn't immediately delete the Browser object. | 93 // Callers assume that this doesn't immediately delete the Browser object. |
| 91 // The controller implementing the window delegate methods called from | 94 // The controller implementing the window delegate methods called from |
| 92 // |-performClose:| must take precautions to ensure that. | 95 // |-performClose:| must take precautions to ensure that. |
| 93 void BrowserWindowCocoa::Close() { | 96 void BrowserWindowCocoa::Close() { |
| 94 // If there is an overlay window, we contain a tab being dragged between | 97 // If there is an overlay window, we contain a tab being dragged between |
| 95 // windows. Don't hide the window as it makes the UI extra confused. We can | 98 // windows. Don't hide the window as it makes the UI extra confused. We can |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 | 603 |
| 601 NSWindow* BrowserWindowCocoa::window() const { | 604 NSWindow* BrowserWindowCocoa::window() const { |
| 602 return [controller_ window]; | 605 return [controller_ window]; |
| 603 } | 606 } |
| 604 | 607 |
| 605 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { | 608 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { |
| 606 if (tab_contents == browser_->GetSelectedTabContents()) { | 609 if (tab_contents == browser_->GetSelectedTabContents()) { |
| 607 [controller_ updateSidebarForContents:tab_contents]; | 610 [controller_ updateSidebarForContents:tab_contents]; |
| 608 } | 611 } |
| 609 } | 612 } |
| OLD | NEW |