| 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; | |
| 473 return ui::SHOW_STATE_NORMAL; | 471 return ui::SHOW_STATE_NORMAL; |
| 474 } | 472 } |
| 475 | 473 |
| 476 gfx::Rect NativeAppWindowCocoa::GetBounds() const { | 474 gfx::Rect NativeAppWindowCocoa::GetBounds() const { |
| 477 // Flip coordinates based on the primary screen. | 475 // Flip coordinates based on the primary screen. |
| 478 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 476 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; |
| 479 NSRect frame = [window() frame]; | 477 NSRect frame = [window() frame]; |
| 480 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); | 478 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); |
| 481 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); | 479 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); |
| 482 return bounds; | 480 return bounds; |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 ShellNSWindow* NativeAppWindowCocoa::window() const { | 924 ShellNSWindow* NativeAppWindowCocoa::window() const { |
| 927 NSWindow* window = [window_controller_ window]; | 925 NSWindow* window = [window_controller_ window]; |
| 928 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); | 926 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); |
| 929 return static_cast<ShellNSWindow*>(window); | 927 return static_cast<ShellNSWindow*>(window); |
| 930 } | 928 } |
| 931 | 929 |
| 932 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 930 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
| 933 if (IsRestored(*this)) | 931 if (IsRestored(*this)) |
| 934 restored_bounds_ = [window() frame]; | 932 restored_bounds_ = [window() frame]; |
| 935 } | 933 } |
| OLD | NEW |