| Index: chrome/browser/ui/views/apps/native_app_window_views.cc
|
| diff --git a/chrome/browser/ui/views/apps/native_app_window_views.cc b/chrome/browser/ui/views/apps/native_app_window_views.cc
|
| index 6e0c4499977d203f8400c70ccaf61c14028804c2..e975fb7e7c7281bab3e9ce0f40e4cce359a9cdec 100644
|
| --- a/chrome/browser/ui/views/apps/native_app_window_views.cc
|
| +++ b/chrome/browser/ui/views/apps/native_app_window_views.cc
|
| @@ -12,6 +12,7 @@
|
| #include "chrome/browser/extensions/extension_host.h"
|
| #include "chrome/browser/favicon/favicon_tab_helper.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/ui/host_desktop.h"
|
| #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h"
|
| #include "chrome/browser/ui/views/extensions/shell_window_frame_view.h"
|
| #include "chrome/browser/web_applications/web_app.h"
|
| @@ -40,15 +41,19 @@
|
| #endif
|
|
|
| #if defined(USE_ASH)
|
| +#include "ash/ash_switches.h"
|
| #include "ash/screen_ash.h"
|
| #include "ash/shell.h"
|
| #include "ash/wm/custom_frame_view_ash.h"
|
| #include "ash/wm/panels/panel_frame_view.h"
|
| #include "ash/wm/window_state.h"
|
| #include "chrome/browser/ui/ash/ash_util.h"
|
| +#include "chrome/browser/ui/views/frame/app_non_client_frame_view_ash.h"
|
| +#include "chrome/browser/ui/views/frame/non_client_frame_view_switcher_ash.h"
|
| #include "ui/aura/client/aura_constants.h"
|
| #include "ui/aura/root_window.h"
|
| #include "ui/aura/window.h"
|
| +#include "ui/views/widget/native_widget_aura.h"
|
| #endif
|
|
|
| using apps::ShellWindow;
|
| @@ -182,6 +187,27 @@ void NativeAppWindowViews::InitializeDefaultWindow(
|
| init_params.wm_class_class = ShellIntegrationLinux::GetProgramClassName();
|
| #endif
|
|
|
| +#if defined(USE_ASH)
|
| + if (!frameless_ &&
|
| + ash::switches::UseSameFrameForV1AndV2Apps() &&
|
| + chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) {
|
| + // Initialize |frame_switcher_| to switch the non client frame view when
|
| + // |native_widget| is maximized. |frame_switcher_| must be initialized
|
| + // before |window_| is inited because it must set a WindowObserver on
|
| + // |native_widget| before WorkspaceLayoutManager does. This results in
|
| + // NonClientFrameViewSwitcherAsh getting notified of |native_widget|'s
|
| + // maximized state changes before WorkspaceLayoutManager and avoids an extra
|
| + // layout of the web contents when |native_widget| is maximized.
|
| + views::NativeWidgetAura* native_widget =
|
| + new views::NativeWidgetAura(window_);
|
| + frame_switcher_.reset(new NonClientFrameViewSwitcherAsh(
|
| + window_, native_widget->GetNativeView()));
|
| +
|
| + init_params.native_widget = native_widget;
|
| + init_params.context = ash::Shell::GetPrimaryRootWindow();
|
| + }
|
| +#endif
|
| +
|
| window_->Init(init_params);
|
|
|
| gfx::Rect adjusted_bounds = window_bounds;
|
| @@ -606,9 +632,14 @@ views::NonClientFrameView* NativeAppWindowViews::CreateNonClientFrameView(
|
| return new ash::PanelFrameView(widget, frame_type);
|
| }
|
| if (!frameless_) {
|
| - ash::CustomFrameViewAsh* frame = new ash::CustomFrameViewAsh();
|
| - frame->Init(widget);
|
| - return frame;
|
| + if (ash::switches::UseSameFrameForV1AndV2Apps() &&
|
| + IsMaximized()) {
|
| + return new AppNonClientFrameViewAsh(widget);
|
| + } else {
|
| + ash::CustomFrameViewAsh* frame = new ash::CustomFrameViewAsh();
|
| + frame->Init(widget);
|
| + return frame;
|
| + }
|
| }
|
| }
|
| #endif
|
|
|