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/extensions/api/app_window/app_window_api.h" | 5 #include "chrome/browser/extensions/api/app_window/app_window_api.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/app_mode/app_mode_utils.h" | 10 #include "chrome/browser/app_mode/app_mode_utils.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 if (options->max_width.get()) | 204 if (options->max_width.get()) |
205 maximum_size.set_width(*options->max_width); | 205 maximum_size.set_width(*options->max_width); |
206 if (options->max_height.get()) | 206 if (options->max_height.get()) |
207 maximum_size.set_height(*options->max_height); | 207 maximum_size.set_height(*options->max_height); |
208 | 208 |
209 if (options->hidden.get()) | 209 if (options->hidden.get()) |
210 create_params.hidden = *options->hidden.get(); | 210 create_params.hidden = *options->hidden.get(); |
211 | 211 |
212 if (options->resizable.get()) | 212 if (options->resizable.get()) |
213 create_params.resizable = *options->resizable.get(); | 213 create_params.resizable = *options->resizable.get(); |
| 214 |
| 215 if (options->type != extensions::api::app_window::WINDOW_TYPE_PANEL) { |
| 216 switch (options->state) { |
| 217 case extensions::api::app_window::STATE_NONE: |
| 218 case extensions::api::app_window::STATE_NORMAL: |
| 219 break; |
| 220 case extensions::api::app_window::STATE_FULLSCREEN: |
| 221 create_params.state = ShellWindow::CreateParams::STATE_FULLSCREEN; |
| 222 break; |
| 223 case extensions::api::app_window::STATE_MAXIMIZED: |
| 224 create_params.state = ShellWindow::CreateParams::STATE_MAXIMIZED; |
| 225 break; |
| 226 case extensions::api::app_window::STATE_MINIMIZED: |
| 227 create_params.state = ShellWindow::CreateParams::STATE_MINIMIZED; |
| 228 break; |
| 229 } |
| 230 } |
214 } | 231 } |
215 | 232 |
216 create_params.creator_process_id = | 233 create_params.creator_process_id = |
217 render_view_host_->GetProcess()->GetID(); | 234 render_view_host_->GetProcess()->GetID(); |
218 | 235 |
219 ShellWindow* shell_window = | 236 ShellWindow* shell_window = |
220 ShellWindow::Create(profile(), GetExtension(), url, create_params); | 237 ShellWindow::Create(profile(), GetExtension(), url, create_params); |
221 | 238 |
222 if (chrome::ShouldForceFullscreenApp()) | 239 if (chrome::ShouldForceFullscreenApp()) |
223 shell_window->GetBaseWindow()->SetFullscreen(true); | 240 shell_window->Fullscreen(); |
224 | 241 |
225 content::RenderViewHost* created_view = | 242 content::RenderViewHost* created_view = |
226 shell_window->web_contents()->GetRenderViewHost(); | 243 shell_window->web_contents()->GetRenderViewHost(); |
227 int view_id = MSG_ROUTING_NONE; | 244 int view_id = MSG_ROUTING_NONE; |
228 if (create_params.creator_process_id == created_view->GetProcess()->GetID()) | 245 if (create_params.creator_process_id == created_view->GetProcess()->GetID()) |
229 view_id = created_view->GetRoutingID(); | 246 view_id = created_view->GetRoutingID(); |
230 | 247 |
231 base::DictionaryValue* result = new base::DictionaryValue; | 248 base::DictionaryValue* result = new base::DictionaryValue; |
232 result->Set("viewId", base::Value::CreateIntegerValue(view_id)); | 249 result->Set("viewId", base::Value::CreateIntegerValue(view_id)); |
233 result->Set("injectTitlebar", | 250 result->Set("injectTitlebar", |
(...skipping 11 matching lines...) Expand all Loading... |
245 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) { | 262 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) { |
246 new DevToolsRestorer(this, created_view); | 263 new DevToolsRestorer(this, created_view); |
247 return true; | 264 return true; |
248 } | 265 } |
249 | 266 |
250 SendResponse(true); | 267 SendResponse(true); |
251 return true; | 268 return true; |
252 } | 269 } |
253 | 270 |
254 } // namespace extensions | 271 } // namespace extensions |
OLD | NEW |