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

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer.cc

Issue 424463002: Makes a window that has been resized to maximized bounds, then maximized and then restored shrink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Maximizes a window that has been resized to maximized bounds (added a test) Created 6 years, 4 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/window_sizer/window_sizer.h" 5 #include "chrome/browser/ui/window_sizer/window_sizer.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 scoped_ptr<StateProvider> state_provider( 217 scoped_ptr<StateProvider> state_provider(
218 new DefaultStateProvider(app_name, browser)); 218 new DefaultStateProvider(app_name, browser));
219 scoped_ptr<TargetDisplayProvider> target_display_provider( 219 scoped_ptr<TargetDisplayProvider> target_display_provider(
220 new DefaultTargetDisplayProvider); 220 new DefaultTargetDisplayProvider);
221 const WindowSizer sizer(state_provider.Pass(), 221 const WindowSizer sizer(state_provider.Pass(),
222 target_display_provider.Pass(), 222 target_display_provider.Pass(),
223 browser); 223 browser);
224 sizer.DetermineWindowBoundsAndShowState(specified_bounds, 224 sizer.DetermineWindowBoundsAndShowState(specified_bounds,
225 window_bounds, 225 window_bounds,
226 show_state); 226 show_state);
227 if (*show_state == ui::SHOW_STATE_DEFAULT) {
msw 2014/07/30 05:46:37 Can you add unit tests for this new behavior, simi
varkha 2014/07/30 21:03:15 Done.
228 gfx::Display display = sizer.GetTargetDisplay(*window_bounds);
229 if (*window_bounds == display.work_area()) {
230 *show_state = ui::SHOW_STATE_MAXIMIZED;
231 sizer.GetDefaultWindowBounds(display, window_bounds);
msw 2014/07/30 05:46:37 Why do you need to set |window_bounds| to the defa
varkha 2014/07/30 21:03:15 Yes, the bounds returned here become the restore b
232 }
233 }
227 } 234 }
228 235
229 /////////////////////////////////////////////////////////////////////////////// 236 ///////////////////////////////////////////////////////////////////////////////
230 // WindowSizer, private: 237 // WindowSizer, private:
231 238
232 void WindowSizer::DetermineWindowBoundsAndShowState( 239 void WindowSizer::DetermineWindowBoundsAndShowState(
233 const gfx::Rect& specified_bounds, 240 const gfx::Rect& specified_bounds,
234 gfx::Rect* bounds, 241 gfx::Rect* bounds,
235 ui::WindowShowState* show_state) const { 242 ui::WindowShowState* show_state) const {
236 DCHECK(bounds); 243 DCHECK(bounds);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 442
436 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) 443 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized))
437 return ui::SHOW_STATE_MAXIMIZED; 444 return ui::SHOW_STATE_MAXIMIZED;
438 445
439 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) 446 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT)
440 return browser_->initial_show_state(); 447 return browser_->initial_show_state();
441 448
442 // Otherwise we use the default which can be overridden later on. 449 // Otherwise we use the default which can be overridden later on.
443 return ui::SHOW_STATE_DEFAULT; 450 return ui::SHOW_STATE_DEFAULT;
444 } 451 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698