| Index: chrome/browser/extensions/api/app_window/app_window_api.cc
|
| diff --git a/chrome/browser/extensions/api/app_window/app_window_api.cc b/chrome/browser/extensions/api/app_window/app_window_api.cc
|
| index 1f726db950869721bfeacc309dadf83f108de687..a421b95693e10f5f59a31a11000188533bc8c576 100644
|
| --- a/chrome/browser/extensions/api/app_window/app_window_api.cc
|
| +++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
|
| @@ -24,6 +24,13 @@
|
| #include "googleurl/src/gurl.h"
|
| #include "ui/gfx/rect.h"
|
|
|
| +#if defined(USE_ASH)
|
| +#include "ash/shell.h"
|
| +#include "ash/wm/property_util.h"
|
| +#include "ui/aura/root_window.h"
|
| +#include "ui/aura/window.h"
|
| +#endif
|
| +
|
| namespace app_window = extensions::api::app_window;
|
| namespace Create = app_window::Create;
|
|
|
| @@ -101,6 +108,11 @@ bool AppWindowCreateFunction::RunImpl() {
|
| // with a hack in AppWindowCustomBindings::GetView().
|
| ShellWindow::CreateParams create_params;
|
| app_window::CreateWindowOptions* options = params->options.get();
|
| +#if defined(USE_ASH)
|
| + bool force_maximize = ash::Shell::IsForcedMaximizeMode();
|
| +#else
|
| + bool force_maximize = false;
|
| +#endif
|
| if (options) {
|
| if (options->id.get()) {
|
| // TODO(mek): use URL if no id specified?
|
| @@ -227,12 +239,35 @@ bool AppWindowCreateFunction::RunImpl() {
|
| create_params.state = ShellWindow::CreateParams::STATE_MINIMIZED;
|
| break;
|
| }
|
| + } else {
|
| + force_maximize = false;
|
| }
|
| }
|
|
|
| create_params.creator_process_id =
|
| render_view_host_->GetProcess()->GetID();
|
|
|
| + // Rather then maximizing the window after it was created, we maximize it
|
| + // immediately - that way the initial presentation is much smoother (no odd
|
| + // rectangles are shown temporarily in the added space). Note that suppressing
|
| + // animations does not help to remove the shown artifacts.
|
| +#if USE_ASH
|
| + if (force_maximize && !create_params.maximum_size.IsEmpty()) {
|
| + // Check that the application is able to fill the monitor - if not don't
|
| + // maximize.
|
| + // TODO(skuhne): In case of multi monitor usage we should find out in
|
| + // advance on which monitor the window will be displayed (or be happy with
|
| + // a temporary bad frame upon creation).
|
| + gfx::Size size = ash::Shell::GetPrimaryRootWindow()->bounds().size();
|
| + if (size.width() > create_params.maximum_size.width() ||
|
| + size.height() > create_params.maximum_size.height())
|
| + force_maximize = false;
|
| + }
|
| + #endif
|
| +
|
| + if (force_maximize)
|
| + create_params.state = ShellWindow::CreateParams::STATE_MAXIMIZED;
|
| +
|
| ShellWindow* shell_window =
|
| ShellWindow::Create(profile(), GetExtension(), url, create_params);
|
|
|
|
|