Chromium Code Reviews| Index: chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc |
| diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc |
| index 8535c131c8a4b7993968358e439958d7c54eab6f..805c46e084ec1d1a7df6c147cd17735d8b956149 100644 |
| --- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc |
| +++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc |
| @@ -118,6 +118,19 @@ ChromeNativeAppWindowViewsAura::ChromeNativeAppWindowViewsAura() { |
| ChromeNativeAppWindowViewsAura::~ChromeNativeAppWindowViewsAura() { |
| } |
| +void ChromeNativeAppWindowViewsAura::InitializeWindow( |
| + AppWindow* app_window, |
| + const AppWindow::CreateParams& create_params) { |
| + ChromeNativeAppWindowViews::InitializeWindow(app_window, create_params); |
| +#if defined(OS_CHROMEOS) |
| + // Restore docked state on Chrome OS and ignore it elsewhere. |
| + if (create_params.state == ui::SHOW_STATE_DOCKED) { |
| + widget()->GetNativeWindow()->SetProperty(aura::client::kShowStateKey, |
| + create_params.state); |
| + } |
| +#endif |
| +} |
| + |
| void ChromeNativeAppWindowViewsAura::OnBeforeWidgetInit( |
| const AppWindow::CreateParams& create_params, |
| views::Widget::InitParams* init_params, |
| @@ -151,7 +164,11 @@ void ChromeNativeAppWindowViewsAura::OnBeforePanelWidgetInit( |
| views::Widget* widget) { |
| ChromeNativeAppWindowViews::OnBeforePanelWidgetInit(init_params, widget); |
| - if (ash::Shell::HasInstance()) { |
| + typedef AppWindow::BoundsSpecification BoundsSpecification; |
|
oshima
2015/04/23 17:26:06
using BoundsSpecification = AppWindow::BoundsSpeci
varkha
2015/04/24 16:17:33
Done. Here and elsewhere.
|
| + bool position_specified = |
| + init_params->bounds.x() != BoundsSpecification::kUnspecifiedPosition && |
| + init_params->bounds.y() != BoundsSpecification::kUnspecifiedPosition; |
| + if (ash::Shell::HasInstance() && !position_specified) { |
| // Open a new panel on the target root. |
| init_params->bounds = ash::ScreenUtil::ConvertRectToScreen( |
| ash::Shell::GetTargetRootWindow(), gfx::Rect(GetPreferredSize())); |
| @@ -223,6 +240,10 @@ ui::WindowShowState ChromeNativeAppWindowViewsAura::GetRestoredState() const { |
| } |
| return ui::SHOW_STATE_FULLSCREEN; |
| } |
| + if (widget()->GetNativeWindow()->GetProperty(aura::client::kShowStateKey) == |
| + ui::SHOW_STATE_DOCKED) { |
| + return ui::SHOW_STATE_DOCKED; |
| + } |
| } |
| // Whitelist states to return so that invalid and transient states |
| // are not saved and used to restore windows when they are recreated. |
| @@ -235,6 +256,7 @@ ui::WindowShowState ChromeNativeAppWindowViewsAura::GetRestoredState() const { |
| case ui::SHOW_STATE_DEFAULT: |
| case ui::SHOW_STATE_MINIMIZED: |
| case ui::SHOW_STATE_INACTIVE: |
| + case ui::SHOW_STATE_DOCKED: |
| case ui::SHOW_STATE_END: |
| return ui::SHOW_STATE_NORMAL; |
| } |