OLD | NEW |
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/browser_window_state.h" | 5 #include "chrome/browser/ui/browser_window_state.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // Save to the session storage service, used when reloading a past session. | 129 // Save to the session storage service, used when reloading a past session. |
130 // Note that we don't want to be the ones who cause lazy initialization of | 130 // Note that we don't want to be the ones who cause lazy initialization of |
131 // the session service. This function gets called during initial window | 131 // the session service. This function gets called during initial window |
132 // showing, and we don't want to bring in the session service this early. | 132 // showing, and we don't want to bring in the session service this early. |
133 SessionService* session_service = | 133 SessionService* session_service = |
134 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); | 134 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); |
135 if (session_service) | 135 if (session_service) |
136 session_service->SetWindowBounds(browser->session_id(), bounds, show_state); | 136 session_service->SetWindowBounds(browser->session_id(), bounds, show_state); |
137 } | 137 } |
138 | 138 |
| 139 void SaveWindowWorkspace(const Browser* browser, int workspace_id) { |
| 140 SessionService* session_service = |
| 141 SessionServiceFactory::GetForProfileIfExisting(browser->profile()); |
| 142 if (session_service) |
| 143 session_service->SetWindowWorkspace(browser->session_id(), workspace_id); |
| 144 } |
| 145 |
139 void GetSavedWindowBoundsAndShowState(const Browser* browser, | 146 void GetSavedWindowBoundsAndShowState(const Browser* browser, |
140 gfx::Rect* bounds, | 147 gfx::Rect* bounds, |
141 ui::WindowShowState* show_state) { | 148 ui::WindowShowState* show_state) { |
142 DCHECK(browser); | 149 DCHECK(browser); |
143 DCHECK(bounds); | 150 DCHECK(bounds); |
144 DCHECK(show_state); | 151 DCHECK(show_state); |
145 *bounds = browser->override_bounds(); | 152 *bounds = browser->override_bounds(); |
146 WindowSizer::GetBrowserWindowBoundsAndShowState(browser->app_name(), | 153 WindowSizer::GetBrowserWindowBoundsAndShowState(browser->app_name(), |
147 *bounds, | 154 *bounds, |
148 browser, | 155 browser, |
(...skipping 12 matching lines...) Expand all Loading... |
161 } | 168 } |
162 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { | 169 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { |
163 std::string str = | 170 std::string str = |
164 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); | 171 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); |
165 int x, y; | 172 int x, y; |
166 if (ParseCommaSeparatedIntegers(str, &x, &y)) | 173 if (ParseCommaSeparatedIntegers(str, &x, &y)) |
167 bounds->set_origin(gfx::Point(x, y)); | 174 bounds->set_origin(gfx::Point(x, y)); |
168 } | 175 } |
169 } | 176 } |
170 | 177 |
| 178 void GetSavedWindowWorkspace(const Browser* browser, int* workspace_id) { |
| 179 DCHECK(browser); |
| 180 DCHECK(workspace_id); |
| 181 *workspace_id = browser->initial_workspace(); |
| 182 |
| 183 // TODO(thomasanderson): add command line option for initial workspace |
| 184 } |
| 185 |
171 } // namespace chrome | 186 } // namespace chrome |
OLD | NEW |