OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/native_app_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" |
6 | 6 |
7 #include "apps/app_shim/extension_app_shim_handler_mac.h" | 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 461 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
462 NSRect frame = restored_bounds_; | 462 NSRect frame = restored_bounds_; |
463 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); | 463 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); |
464 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); | 464 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); |
465 return bounds; | 465 return bounds; |
466 } | 466 } |
467 | 467 |
468 ui::WindowShowState NativeAppWindowCocoa::GetRestoredState() const { | 468 ui::WindowShowState NativeAppWindowCocoa::GetRestoredState() const { |
469 if (IsMaximized()) | 469 if (IsMaximized()) |
470 return ui::SHOW_STATE_MAXIMIZED; | 470 return ui::SHOW_STATE_MAXIMIZED; |
| 471 if (IsFullscreen()) |
| 472 return ui::SHOW_STATE_FULLSCREEN; |
471 return ui::SHOW_STATE_NORMAL; | 473 return ui::SHOW_STATE_NORMAL; |
472 } | 474 } |
473 | 475 |
474 gfx::Rect NativeAppWindowCocoa::GetBounds() const { | 476 gfx::Rect NativeAppWindowCocoa::GetBounds() const { |
475 // Flip coordinates based on the primary screen. | 477 // Flip coordinates based on the primary screen. |
476 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 478 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
477 NSRect frame = [window() frame]; | 479 NSRect frame = [window() frame]; |
478 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); | 480 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); |
479 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); | 481 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); |
480 return bounds; | 482 return bounds; |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 ShellNSWindow* NativeAppWindowCocoa::window() const { | 921 ShellNSWindow* NativeAppWindowCocoa::window() const { |
920 NSWindow* window = [window_controller_ window]; | 922 NSWindow* window = [window_controller_ window]; |
921 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); | 923 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); |
922 return static_cast<ShellNSWindow*>(window); | 924 return static_cast<ShellNSWindow*>(window); |
923 } | 925 } |
924 | 926 |
925 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 927 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
926 if (IsRestored(*this)) | 928 if (IsRestored(*this)) |
927 restored_bounds_ = [window() frame]; | 929 restored_bounds_ = [window() frame]; |
928 } | 930 } |
OLD | NEW |