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

Side by Side Diff: chrome/browser/cocoa/browser_window_controller.mm

Issue 115818: Add shift-zoom to maximize.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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
« no previous file with comments | « no previous file | 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/mac_util.h" 5 #include "base/mac_util.h"
6 #include "base/sys_string_conversions.h" 6 #include "base/sys_string_conversions.h"
7 #include "chrome/app/chrome_dll_resource.h" // IDC_* 7 #include "chrome/app/chrome_dll_resource.h" // IDC_*
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/browser_list.h" 9 #include "chrome/browser/browser_list.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 224 }
225 225
226 // Called when the user clicks the zoom button (or selects it from the Window 226 // Called when the user clicks the zoom button (or selects it from the Window
227 // menu). Zoom to the appropriate size based on the content. Make sure we 227 // menu). Zoom to the appropriate size based on the content. Make sure we
228 // enforce a minimum width to ensure websites with small intrinsic widths 228 // enforce a minimum width to ensure websites with small intrinsic widths
229 // (such as google.com) don't end up with a wee window. Enforce a max width 229 // (such as google.com) don't end up with a wee window. Enforce a max width
230 // that leaves room for icons on the right side. Use the full (usable) height 230 // that leaves room for icons on the right side. Use the full (usable) height
231 // regardless. 231 // regardless.
232 - (NSRect)windowWillUseStandardFrame:(NSWindow*)window 232 - (NSRect)windowWillUseStandardFrame:(NSWindow*)window
233 defaultFrame:(NSRect)frame { 233 defaultFrame:(NSRect)frame {
234 // If the shift key is down, maximize. Hopefully this should make the
235 // "switchers" happy.
236 if ([[[NSApplication sharedApplication] currentEvent] modifierFlags] &
237 NSShiftKeyMask) {
238 // |frame| isn't the full screen rect, and I'm not sure why. It should be.
stuartmorgan 2009/05/27 16:05:07 This comment should probably go, since frame isn't
239 return [[window screen] visibleFrame];
240 }
241
234 const int kMinimumIntrinsicWidth = 700; 242 const int kMinimumIntrinsicWidth = 700;
235 const int kScrollbarWidth = 16; 243 const int kScrollbarWidth = 16;
236 const int kSpaceForIcons = 50; 244 const int kSpaceForIcons = 50;
237 const NSSize screenSize = [[window screen] visibleFrame].size; 245 const NSSize screenSize = [[window screen] visibleFrame].size;
238 // Always leave room on the right for icons. 246 // Always leave room on the right for icons.
239 const int kMaxWidth = screenSize.width - kSpaceForIcons; 247 const int kMaxWidth = screenSize.width - kSpaceForIcons;
240 248
241 TabContents* contents = browser_->tabstrip_model()->GetSelectedTabContents(); 249 TabContents* contents = browser_->tabstrip_model()->GetSelectedTabContents();
242 if (contents) { 250 if (contents) {
243 int intrinsicWidth = contents->view()->preferred_width() + kScrollbarWidth; 251 int intrinsicWidth = contents->view()->preferred_width() + kScrollbarWidth;
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 else if ([event deltaY] < -0.5) 700 else if ([event deltaY] < -0.5)
693 ; // TODO(pinkerton): figure out page-down 701 ; // TODO(pinkerton): figure out page-down
694 702
695 // Ensure the command is valid first (ExecuteCommand() won't do that) and 703 // Ensure the command is valid first (ExecuteCommand() won't do that) and
696 // then make it so. 704 // then make it so.
697 if (browser_->command_updater()->IsCommandEnabled(command)) 705 if (browser_->command_updater()->IsCommandEnabled(command))
698 browser_->ExecuteCommand(command); 706 browser_->ExecuteCommand(command);
699 } 707 }
700 708
701 @end 709 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698