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

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

Issue 23494065: Fix restoring a window after maximizing it. (Mac) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
« no previous file with comments | « chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 - (void)windowDidResignKey:(NSNotification*)notification { 78 - (void)windowDidResignKey:(NSNotification*)notification {
79 if (appWindow_) 79 if (appWindow_)
80 appWindow_->WindowDidResignKey(); 80 appWindow_->WindowDidResignKey();
81 } 81 }
82 82
83 - (void)windowDidResize:(NSNotification*)notification { 83 - (void)windowDidResize:(NSNotification*)notification {
84 if (appWindow_) 84 if (appWindow_)
85 appWindow_->WindowDidResize(); 85 appWindow_->WindowDidResize();
86 } 86 }
87 87
88 - (void)windowDidEndLiveResize:(NSNotification*)notification {
89 if (appWindow_)
90 appWindow_->WindowDidFinishResize();
91 }
92
93 - (void)windowDidExitFullScreen:(NSNotification*)notification {
tapted 2013/09/24 03:11:44 What about windowDidEnterFullScreen - should that
jackhou1 2013/09/24 04:52:03 Yup, and WindowDidFinishResize needs to update is_
94 if (appWindow_)
95 appWindow_->WindowDidFinishResize();
96 }
97
88 - (void)windowDidMove:(NSNotification*)notification { 98 - (void)windowDidMove:(NSNotification*)notification {
89 if (appWindow_) 99 if (appWindow_)
90 appWindow_->WindowDidMove(); 100 appWindow_->WindowDidMove();
91 } 101 }
92 102
93 - (void)windowDidMiniaturize:(NSNotification*)notification { 103 - (void)windowDidMiniaturize:(NSNotification*)notification {
94 if (appWindow_) 104 if (appWindow_)
95 appWindow_->WindowDidMiniaturize(); 105 appWindow_->WindowDidMiniaturize();
96 } 106 }
97 107
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 // lose key window status. 842 // lose key window status.
833 if ([NSApp isActive] && ([NSApp keyWindow] == window())) 843 if ([NSApp isActive] && ([NSApp keyWindow] == window()))
834 return; 844 return;
835 845
836 content::RenderWidgetHostView* rwhv = 846 content::RenderWidgetHostView* rwhv =
837 web_contents()->GetRenderWidgetHostView(); 847 web_contents()->GetRenderWidgetHostView();
838 if (rwhv) 848 if (rwhv)
839 rwhv->SetActive(false); 849 rwhv->SetActive(false);
840 } 850 }
841 851
842 void NativeAppWindowCocoa::WindowDidResize() { 852 void NativeAppWindowCocoa::WindowDidFinishResize() {
843 // Update |is_maximized_| if needed: 853 // Update |is_maximized_| if needed:
844 // - Exit maximized state if resized. 854 // - Exit maximized state if resized.
845 // - Consider us maximized if resize places us back to maximized location. 855 // - Consider us maximized if resize places us back to maximized location.
846 // This happens when returning from fullscreen. 856 // This happens when returning from fullscreen.
847 NSRect frame = [window() frame]; 857 NSRect frame = [window() frame];
848 NSRect screen = [[window() screen] visibleFrame]; 858 NSRect screen = [[window() screen] visibleFrame];
849 if (!NSEqualSizes(frame.size, screen.size)) 859 if (!NSEqualSizes(frame.size, screen.size))
850 is_maximized_ = false; 860 is_maximized_ = false;
851 else if (NSEqualPoints(frame.origin, screen.origin)) 861 else if (NSEqualPoints(frame.origin, screen.origin))
852 is_maximized_ = true; 862 is_maximized_ = true;
853 863
854 UpdateRestoredBounds(); 864 UpdateRestoredBounds();
865 }
866
867 void NativeAppWindowCocoa::WindowDidResize() {
855 shell_window_->OnNativeWindowChanged(); 868 shell_window_->OnNativeWindowChanged();
856 } 869 }
857 870
858 void NativeAppWindowCocoa::WindowDidMove() { 871 void NativeAppWindowCocoa::WindowDidMove() {
859 UpdateRestoredBounds(); 872 UpdateRestoredBounds();
860 shell_window_->OnNativeWindowChanged(); 873 shell_window_->OnNativeWindowChanged();
861 } 874 }
862 875
863 void NativeAppWindowCocoa::WindowDidMiniaturize() { 876 void NativeAppWindowCocoa::WindowDidMiniaturize() {
864 shell_window_->OnNativeWindowChanged(); 877 shell_window_->OnNativeWindowChanged();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 ShellNSWindow* NativeAppWindowCocoa::window() const { 941 ShellNSWindow* NativeAppWindowCocoa::window() const {
929 NSWindow* window = [window_controller_ window]; 942 NSWindow* window = [window_controller_ window];
930 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); 943 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]);
931 return static_cast<ShellNSWindow*>(window); 944 return static_cast<ShellNSWindow*>(window);
932 } 945 }
933 946
934 void NativeAppWindowCocoa::UpdateRestoredBounds() { 947 void NativeAppWindowCocoa::UpdateRestoredBounds() {
935 if (IsRestored(*this)) 948 if (IsRestored(*this))
936 restored_bounds_ = [window() frame]; 949 restored_bounds_ = [window() frame];
937 } 950 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698