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

Side by Side Diff: chrome/browser/window_sizer.h

Issue 160246: Reposition and/or resize window if it becomes off-screen.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « chrome/browser/views/chrome_views_delegate.cc ('k') | chrome/browser/window_sizer.cc » ('j') | 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 #ifndef CHROME_BROWSER_WINDOW_SIZER_H_ 5 #ifndef CHROME_BROWSER_WINDOW_SIZER_H_
6 #define CHROME_BROWSER_WINDOW_SIZER_H_ 6 #define CHROME_BROWSER_WINDOW_SIZER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // An interface implemented by an object that can retrieve state from either a 82 // An interface implemented by an object that can retrieve state from either a
83 // persistent store or an existing window. 83 // persistent store or an existing window.
84 class StateProvider { 84 class StateProvider {
85 public: 85 public:
86 virtual ~StateProvider() { } 86 virtual ~StateProvider() { }
87 87
88 // Retrieve the persisted bounds of the window. Returns true if there was 88 // Retrieve the persisted bounds of the window. Returns true if there was
89 // persisted data to retrieve state information, false otherwise. 89 // persisted data to retrieve state information, false otherwise.
90 virtual bool GetPersistentState(gfx::Rect* bounds, 90 virtual bool GetPersistentState(gfx::Rect* bounds,
91 bool* maximized) const = 0; 91 bool* maximized,
92 gfx::Rect* work_area) const = 0;
92 93
93 // Retrieve the bounds of the most recent window of the matching type. 94 // Retrieve the bounds of the most recent window of the matching type.
94 // Returns true if there was a last active window to retrieve state 95 // Returns true if there was a last active window to retrieve state
95 // information from, false otherwise. 96 // information from, false otherwise.
96 virtual bool GetLastActiveWindowState(gfx::Rect* bounds) const = 0; 97 virtual bool GetLastActiveWindowState(gfx::Rect* bounds) const = 0;
97 }; 98 };
98 99
99 // Determines the position, size and maximized state for a window as it is 100 // Determines the position, size and maximized state for a window as it is
100 // created. This function uses several strategies to figure out optimal size 101 // created. This function uses several strategies to figure out optimal size
101 // and placement, first looking for an existing active window, then falling 102 // and placement, first looking for an existing active window, then falling
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 void GetDefaultWindowBounds(gfx::Rect* default_bounds) const; 156 void GetDefaultWindowBounds(gfx::Rect* default_bounds) const;
156 157
157 // Returns true if the specified position is "offscreen" for the given edge, 158 // Returns true if the specified position is "offscreen" for the given edge,
158 // meaning that it's outside all work areas in the direction of that edge. 159 // meaning that it's outside all work areas in the direction of that edge.
159 bool PositionIsOffscreen(int position, Edge edge) const; 160 bool PositionIsOffscreen(int position, Edge edge) const;
160 161
161 // Adjusts |bounds| to be visible onscreen, biased toward the work area of the 162 // Adjusts |bounds| to be visible onscreen, biased toward the work area of the
162 // monitor containing |other_bounds|. Despite the name, this doesn't 163 // monitor containing |other_bounds|. Despite the name, this doesn't
163 // guarantee the bounds are fully contained within this monitor's work rect; 164 // guarantee the bounds are fully contained within this monitor's work rect;
164 // it just tried to ensure the edges are visible on _some_ work rect. 165 // it just tried to ensure the edges are visible on _some_ work rect.
166 // If |saved_work_area| is non-empty, it is used to determine whether the
167 // monitor cofiguration has changed. If it has, bounds are repositioned and
168 // resized if necessary to make them completely contained in the current work
169 // area.
165 void AdjustBoundsToBeVisibleOnMonitorContaining( 170 void AdjustBoundsToBeVisibleOnMonitorContaining(
166 const gfx::Rect& other_bounds, 171 const gfx::Rect& other_bounds,
172 const gfx::Rect& saved_work_area,
167 gfx::Rect* bounds) const; 173 gfx::Rect* bounds) const;
168 174
169 // Providers for persistent storage and monitor metrics. 175 // Providers for persistent storage and monitor metrics.
170 StateProvider* state_provider_; 176 StateProvider* state_provider_;
171 MonitorInfoProvider* monitor_info_provider_; 177 MonitorInfoProvider* monitor_info_provider_;
172 178
173 DISALLOW_EVIL_CONSTRUCTORS(WindowSizer); 179 DISALLOW_EVIL_CONSTRUCTORS(WindowSizer);
174 }; 180 };
175 181
176 #endif // CHROME_BROWSER_WINDOW_SIZER_H_ 182 #endif // CHROME_BROWSER_WINDOW_SIZER_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/chrome_views_delegate.cc ('k') | chrome/browser/window_sizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698