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

Side by Side Diff: chrome/browser/ui/cocoa/browser_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/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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.h ('k') | chrome/browser/ui/cocoa/extensions/native_app_window_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698