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" |
11 #include "chrome/browser/devtools/devtools_window.h" | 11 #include "chrome/browser/devtools/devtools_window.h" |
12 #include "chrome/browser/extensions/shell_window_registry.h" | 12 #include "chrome/browser/extensions/shell_window_registry.h" |
13 #include "chrome/browser/extensions/window_controller.h" | 13 #include "chrome/browser/extensions/window_controller.h" |
14 #include "chrome/browser/ui/extensions/native_app_window.h" | 14 #include "chrome/browser/ui/extensions/native_app_window.h" |
15 #include "chrome/browser/ui/extensions/shell_window.h" | 15 #include "chrome/browser/ui/extensions/shell_window.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/extensions/api/app_window.h" | 17 #include "chrome/common/extensions/api/app_window.h" |
18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
19 #include "content/public/browser/notification_types.h" | 19 #include "content/public/browser/notification_types.h" |
20 #include "content/public/browser/render_process_host.h" | 20 #include "content/public/browser/render_process_host.h" |
21 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
23 #include "content/public/common/url_constants.h" | 23 #include "content/public/common/url_constants.h" |
24 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
26 | 26 |
27 #if defined(USE_ASH) | |
28 #include "ash/shell.h" | |
29 #endif | |
30 | |
27 namespace app_window = extensions::api::app_window; | 31 namespace app_window = extensions::api::app_window; |
28 namespace Create = app_window::Create; | 32 namespace Create = app_window::Create; |
29 | 33 |
30 namespace extensions { | 34 namespace extensions { |
31 | 35 |
32 namespace app_window_constants { | 36 namespace app_window_constants { |
33 const char kInvalidWindowId[] = | 37 const char kInvalidWindowId[] = |
34 "The window id can not be more than 256 characters long."; | 38 "The window id can not be more than 256 characters long."; |
35 } | 39 } |
36 | 40 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 if (options->max_height.get()) | 210 if (options->max_height.get()) |
207 maximum_size.set_height(*options->max_height); | 211 maximum_size.set_height(*options->max_height); |
208 | 212 |
209 if (options->hidden.get()) | 213 if (options->hidden.get()) |
210 create_params.hidden = *options->hidden.get(); | 214 create_params.hidden = *options->hidden.get(); |
211 | 215 |
212 if (options->resizable.get()) | 216 if (options->resizable.get()) |
213 create_params.resizable = *options->resizable.get(); | 217 create_params.resizable = *options->resizable.get(); |
214 | 218 |
215 if (options->type != extensions::api::app_window::WINDOW_TYPE_PANEL) { | 219 if (options->type != extensions::api::app_window::WINDOW_TYPE_PANEL) { |
220 #if defined(USE_ASH) | |
221 if (ash::Shell::IsForcedMaximizeMode()) | |
222 create_params.state = ShellWindow::CreateParams::STATE_MAXIMIZED; | |
223 else | |
James Cook
2013/04/22 22:15:46
This feels awkward. Is there some other way to wri
Mr4D (OOO till 08-26)
2013/04/23 04:41:28
Well - I "improved" it, but now it is distributed
| |
224 #endif | |
216 switch (options->state) { | 225 switch (options->state) { |
217 case extensions::api::app_window::STATE_NONE: | 226 case extensions::api::app_window::STATE_NONE: |
218 case extensions::api::app_window::STATE_NORMAL: | 227 case extensions::api::app_window::STATE_NORMAL: |
219 break; | 228 break; |
220 case extensions::api::app_window::STATE_FULLSCREEN: | 229 case extensions::api::app_window::STATE_FULLSCREEN: |
221 create_params.state = ShellWindow::CreateParams::STATE_FULLSCREEN; | 230 create_params.state = ShellWindow::CreateParams::STATE_FULLSCREEN; |
222 break; | 231 break; |
223 case extensions::api::app_window::STATE_MAXIMIZED: | 232 case extensions::api::app_window::STATE_MAXIMIZED: |
224 create_params.state = ShellWindow::CreateParams::STATE_MAXIMIZED; | 233 create_params.state = ShellWindow::CreateParams::STATE_MAXIMIZED; |
225 break; | 234 break; |
226 case extensions::api::app_window::STATE_MINIMIZED: | 235 case extensions::api::app_window::STATE_MINIMIZED: |
227 create_params.state = ShellWindow::CreateParams::STATE_MINIMIZED; | 236 create_params.state = ShellWindow::CreateParams::STATE_MINIMIZED; |
228 break; | 237 break; |
229 } | 238 } |
230 } | 239 } |
240 } else { | |
241 #if defined(USE_ASH) | |
242 if (ash::Shell::IsForcedMaximizeMode()) | |
243 create_params.state = ShellWindow::CreateParams::STATE_MAXIMIZED; | |
244 #endif | |
231 } | 245 } |
232 | 246 |
233 create_params.creator_process_id = | 247 create_params.creator_process_id = |
234 render_view_host_->GetProcess()->GetID(); | 248 render_view_host_->GetProcess()->GetID(); |
235 | 249 |
236 ShellWindow* shell_window = | 250 ShellWindow* shell_window = |
237 ShellWindow::Create(profile(), GetExtension(), url, create_params); | 251 ShellWindow::Create(profile(), GetExtension(), url, create_params); |
238 | 252 |
239 if (chrome::ShouldForceFullscreenApp()) | 253 if (chrome::ShouldForceFullscreenApp()) |
240 shell_window->Fullscreen(); | 254 shell_window->Fullscreen(); |
(...skipping 21 matching lines...) Expand all Loading... | |
262 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) { | 276 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) { |
263 new DevToolsRestorer(this, created_view); | 277 new DevToolsRestorer(this, created_view); |
264 return true; | 278 return true; |
265 } | 279 } |
266 | 280 |
267 SendResponse(true); | 281 SendResponse(true); |
268 return true; | 282 return true; |
269 } | 283 } |
270 | 284 |
271 } // namespace extensions | 285 } // namespace extensions |
OLD | NEW |