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

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

Issue 8584001: Remove unused "maximized" parameter from WindowSizer::GetBrowserWindowBounds(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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/panels/panel.cc ('k') | chrome/browser/ui/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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_UI_WINDOW_SIZER_H_ 5 #ifndef CHROME_BROWSER_UI_WINDOW_SIZER_H_
6 #define CHROME_BROWSER_UI_WINDOW_SIZER_H_ 6 #define CHROME_BROWSER_UI_WINDOW_SIZER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 // An interface implemented by an object that can retrieve state from either a 79 // An interface implemented by an object that can retrieve state from either a
80 // persistent store or an existing window. 80 // persistent store or an existing window.
81 class StateProvider { 81 class StateProvider {
82 public: 82 public:
83 virtual ~StateProvider() {} 83 virtual ~StateProvider() {}
84 84
85 // Retrieve the persisted bounds of the window. Returns true if there was 85 // Retrieve the persisted bounds of the window. Returns true if there was
86 // persisted data to retrieve state information, false otherwise. 86 // persisted data to retrieve state information, false otherwise.
87 virtual bool GetPersistentState(gfx::Rect* bounds, 87 virtual bool GetPersistentState(gfx::Rect* bounds,
88 bool* maximized,
89 gfx::Rect* work_area) const = 0; 88 gfx::Rect* work_area) const = 0;
90 89
91 // Retrieve the bounds of the most recent window of the matching type. 90 // Retrieve the bounds of the most recent window of the matching type.
92 // Returns true if there was a last active window to retrieve state 91 // Returns true if there was a last active window to retrieve state
93 // information from, false otherwise. 92 // information from, false otherwise.
94 virtual bool GetLastActiveWindowState(gfx::Rect* bounds) const = 0; 93 virtual bool GetLastActiveWindowState(gfx::Rect* bounds) const = 0;
95 }; 94 };
96 95
97 // Determines the position, size and maximized state for a window as it is 96 // Determines the position and size for a window as it is created. This
98 // created. This function uses several strategies to figure out optimal size 97 // function uses several strategies to figure out optimal size and placement,
99 // and placement, first looking for an existing active window, then falling 98 // first looking for an existing active window, then falling back to persisted
100 // back to persisted data from a previous session, finally utilizing a default 99 // data from a previous session, finally utilizing a default
101 // algorithm. If |specified_bounds| are non-empty, this value is returned 100 // algorithm. If |specified_bounds| are non-empty, this value is returned
102 // instead. For use only in testing. 101 // instead. For use only in testing.
103 //
104 // NOTE: |maximized| is only set if we're restoring a saved maximized window.
105 // When creating a new window based on an existing active window, standard
106 // Windows behavior is to have it always be nonmaximized, even if the existing
107 // window is maximized.
108 void DetermineWindowBounds(const gfx::Rect& specified_bounds, 102 void DetermineWindowBounds(const gfx::Rect& specified_bounds,
109 gfx::Rect* bounds, 103 gfx::Rect* bounds) const;
110 bool* maximized) const;
111 104
112 // Determines the size, position and maximized state for the browser window. 105 // Determines the size, position and maximized state for the browser window.
113 // See documentation for DetermineWindowBounds above. Normally, 106 // See documentation for DetermineWindowBounds above. Normally,
114 // |window_bounds| is calculated by calling GetLastActiveWindowState(). To 107 // |window_bounds| is calculated by calling GetLastActiveWindowState(). To
115 // explicitly specify a particular window to base the bounds on, pass in a 108 // explicitly specify a particular window to base the bounds on, pass in a
116 // non-NULL value for |browser|. 109 // non-NULL value for |browser|.
117 static void GetBrowserWindowBounds(const std::string& app_name, 110 static void GetBrowserWindowBounds(const std::string& app_name,
118 const gfx::Rect& specified_bounds, 111 const gfx::Rect& specified_bounds,
119 const Browser* browser, 112 const Browser* browser,
120 gfx::Rect* window_bounds, 113 gfx::Rect* window_bounds);
121 bool* maximized);
122 114
123 // Returns the default origin for popups of the given size. 115 // Returns the default origin for popups of the given size.
124 static gfx::Point GetDefaultPopupOrigin(const gfx::Size& size); 116 static gfx::Point GetDefaultPopupOrigin(const gfx::Size& size);
125 117
126 // How much horizontal and vertical offset there is between newly 118 // How much horizontal and vertical offset there is between newly
127 // opened windows. This value may be different on each platform. 119 // opened windows. This value may be different on each platform.
128 static const int kWindowTilePixels; 120 static const int kWindowTilePixels;
129 121
130 private: 122 private:
131 // The edge of the screen to check for out-of-bounds. 123 // The edge of the screen to check for out-of-bounds.
132 enum Edge { TOP, LEFT, BOTTOM, RIGHT }; 124 enum Edge { TOP, LEFT, BOTTOM, RIGHT };
133 125
134 // Gets the size and placement of the last window. Returns true if this data 126 // Gets the size and placement of the last window. Returns true if this data
135 // is valid, false if there is no last window and the application should 127 // is valid, false if there is no last window and the application should
136 // restore saved state from preferences using RestoreWindowPosition. 128 // restore saved state from preferences using RestoreWindowPosition.
137 bool GetLastWindowBounds(gfx::Rect* bounds) const; 129 bool GetLastWindowBounds(gfx::Rect* bounds) const;
138 130
139 // Gets the size and placement of the last window in the last session, saved 131 // Gets the size and placement of the last window in the last session, saved
140 // in local state preferences. Returns true if local state exists containing 132 // in local state preferences. Returns true if local state exists containing
141 // this information, false if this information does not exist and a default 133 // this information, false if this information does not exist and a default
142 // size should be used. 134 // size should be used.
143 bool GetSavedWindowBounds(gfx::Rect* bounds, bool* maximized) const; 135 bool GetSavedWindowBounds(gfx::Rect* bounds) const;
144 136
145 // Gets the default window position and size if there is no last window and 137 // Gets the default window position and size if there is no last window and
146 // no saved window placement in prefs. This function determines the default 138 // no saved window placement in prefs. This function determines the default
147 // size based on monitor size, etc. 139 // size based on monitor size, etc.
148 void GetDefaultWindowBounds(gfx::Rect* default_bounds) const; 140 void GetDefaultWindowBounds(gfx::Rect* default_bounds) const;
149 141
150 // Returns true if the specified position is "offscreen" for the given edge, 142 // Returns true if the specified position is "offscreen" for the given edge,
151 // meaning that it's outside all work areas in the direction of that edge. 143 // meaning that it's outside all work areas in the direction of that edge.
152 bool PositionIsOffscreen(int position, Edge edge) const; 144 bool PositionIsOffscreen(int position, Edge edge) const;
153 145
(...skipping 11 matching lines...) Expand all
165 gfx::Rect* bounds) const; 157 gfx::Rect* bounds) const;
166 158
167 // Providers for persistent storage and monitor metrics. 159 // Providers for persistent storage and monitor metrics.
168 StateProvider* state_provider_; 160 StateProvider* state_provider_;
169 MonitorInfoProvider* monitor_info_provider_; 161 MonitorInfoProvider* monitor_info_provider_;
170 162
171 DISALLOW_COPY_AND_ASSIGN(WindowSizer); 163 DISALLOW_COPY_AND_ASSIGN(WindowSizer);
172 }; 164 };
173 165
174 #endif // CHROME_BROWSER_UI_WINDOW_SIZER_H_ 166 #endif // CHROME_BROWSER_UI_WINDOW_SIZER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel.cc ('k') | chrome/browser/ui/window_sizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698