Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.mm

Issue 14031021: Save and restore State for ShellWindows, including panels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/extensions/native_app_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.h"
6 6
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/cocoa/browser_window_utils.h" 10 #include "chrome/browser/ui/cocoa/browser_window_utils.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendSolidColor, 387 CGDisplayFade(token, kFadeDurationSeconds / 2, kCGDisplayBlendSolidColor,
388 kCGDisplayBlendNormal, 0.0, 0.0, 0.0, /*synchronous=*/false); 388 kCGDisplayBlendNormal, 0.0, 0.0, 0.0, /*synchronous=*/false);
389 CGReleaseDisplayFadeReservation(token); 389 CGReleaseDisplayFadeReservation(token);
390 } 390 }
391 } 391 }
392 392
393 bool NativeAppWindowCocoa::IsFullscreenOrPending() const { 393 bool NativeAppWindowCocoa::IsFullscreenOrPending() const {
394 return is_fullscreen_; 394 return is_fullscreen_;
395 } 395 }
396 396
397 bool NativeAppWindowCocoa::IsDetached() const {
398 return false;
399 }
400
397 gfx::NativeWindow NativeAppWindowCocoa::GetNativeWindow() { 401 gfx::NativeWindow NativeAppWindowCocoa::GetNativeWindow() {
398 return window(); 402 return window();
399 } 403 }
400 404
401 gfx::Rect NativeAppWindowCocoa::GetRestoredBounds() const { 405 gfx::Rect NativeAppWindowCocoa::GetRestoredBounds() const {
402 // Flip coordinates based on the primary screen. 406 // Flip coordinates based on the primary screen.
403 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; 407 NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
404 NSRect frame = [window() frame]; 408 NSRect frame = [window() frame];
405 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame)); 409 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame));
406 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame)); 410 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame));
407 return bounds; 411 return bounds;
408 } 412 }
409 413
414 ui::WindowShowState NativeAppWindowCocoa::GetRestoredState() const {
415 if (IsMaximized())
416 return ui::SHOW_STATE_MAXIMIZED;
417 return ui::SHOW_STATE_NORMAL;
418 }
419
410 gfx::Rect NativeAppWindowCocoa::GetBounds() const { 420 gfx::Rect NativeAppWindowCocoa::GetBounds() const {
411 return GetRestoredBounds(); 421 return GetRestoredBounds();
412 } 422 }
413 423
414 void NativeAppWindowCocoa::Show() { 424 void NativeAppWindowCocoa::Show() {
415 [window_controller_ showWindow:nil]; 425 [window_controller_ showWindow:nil];
416 [window() makeKeyAndOrderFront:window_controller_]; 426 [window() makeKeyAndOrderFront:window_controller_];
417 } 427 }
418 428
419 void NativeAppWindowCocoa::ShowInactive() { 429 void NativeAppWindowCocoa::ShowInactive() {
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); 800 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]);
791 return static_cast<ShellNSWindow*>(window); 801 return static_cast<ShellNSWindow*>(window);
792 } 802 }
793 803
794 // static 804 // static
795 NativeAppWindow* NativeAppWindow::Create( 805 NativeAppWindow* NativeAppWindow::Create(
796 ShellWindow* shell_window, 806 ShellWindow* shell_window,
797 const ShellWindow::CreateParams& params) { 807 const ShellWindow::CreateParams& params) {
798 return new NativeAppWindowCocoa(shell_window, params); 808 return new NativeAppWindowCocoa(shell_window, params);
799 } 809 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.h ('k') | chrome/browser/ui/extensions/native_app_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698