Chromium Code Reviews| 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..5244320ec60fd7dd50e7e24c109c39178e5a4524 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,26 @@ 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 |
| + // |window_| is maximized. |frame_switcher_| must be initialized before |
| + // |window_| is inited because it must be notified of changes in |
| + // ash::wm::WindowShowState before WorkspaceLayoutManager. This |
| + // notification order avoids an extra layout whenever |window_| is |
| + // maximized. |
| + views::NativeWidgetAura* native_widget = |
|
James Cook
2013/10/02 21:07:55
Why do you need to introduce a new native widget h
pkotwicz
2013/10/03 20:45:35
I have added a better comment.
The reason is that
|
| + 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 +631,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 |