OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 gfx::Rect BrowserWindowCocoa::GetRestoredBounds() const { | 310 gfx::Rect BrowserWindowCocoa::GetRestoredBounds() const { |
311 // Flip coordinates based on the primary screen. | 311 // Flip coordinates based on the primary screen. |
312 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 312 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
313 NSRect frame = [controller_ regularWindowFrame]; | 313 NSRect frame = [controller_ regularWindowFrame]; |
314 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); | 314 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); |
315 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); | 315 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); |
316 return bounds; | 316 return bounds; |
317 } | 317 } |
318 | 318 |
| 319 ui::WindowShowState BrowserWindowCocoa::GetRestoredState() const { |
| 320 if (IsMaximized()) |
| 321 return ui::SHOW_STATE_MAXIMIZED; |
| 322 if (IsMinimized()) |
| 323 return ui::SHOW_STATE_MINIMIZED; |
| 324 return ui::SHOW_STATE_NORMAL; |
| 325 } |
| 326 |
319 gfx::Rect BrowserWindowCocoa::GetBounds() const { | 327 gfx::Rect BrowserWindowCocoa::GetBounds() const { |
320 return GetRestoredBounds(); | 328 return GetRestoredBounds(); |
321 } | 329 } |
322 | 330 |
323 bool BrowserWindowCocoa::IsMaximized() const { | 331 bool BrowserWindowCocoa::IsMaximized() const { |
324 return [window() isZoomed]; | 332 return [window() isZoomed]; |
325 } | 333 } |
326 | 334 |
327 bool BrowserWindowCocoa::IsMinimized() const { | 335 bool BrowserWindowCocoa::IsMinimized() const { |
328 return [window() isMiniaturized]; | 336 return [window() isMiniaturized]; |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 PasswordGenerationBubbleController* controller = | 717 PasswordGenerationBubbleController* controller = |
710 [[PasswordGenerationBubbleController alloc] | 718 [[PasswordGenerationBubbleController alloc] |
711 initWithWindow:browser_->window()->GetNativeWindow() | 719 initWithWindow:browser_->window()->GetNativeWindow() |
712 anchoredAt:point | 720 anchoredAt:point |
713 renderViewHost:web_contents->GetRenderViewHost() | 721 renderViewHost:web_contents->GetRenderViewHost() |
714 passwordManager:PasswordManager::FromWebContents(web_contents) | 722 passwordManager:PasswordManager::FromWebContents(web_contents) |
715 usingGenerator:password_generator | 723 usingGenerator:password_generator |
716 forForm:form]; | 724 forForm:form]; |
717 [controller showWindow:nil]; | 725 [controller showWindow:nil]; |
718 } | 726 } |
OLD | NEW |