Chromium Code Reviews| Index: chrome/browser/ui/views/frame/browser_frame_aura.cc |
| diff --git a/chrome/browser/ui/views/frame/browser_frame_aura.cc b/chrome/browser/ui/views/frame/browser_frame_aura.cc |
| index 764e95b5d6a15431b838c9ceef87a95023cc48b8..799a98882deb4a1d808badc1d90bf550ad74b311 100644 |
| --- a/chrome/browser/ui/views/frame/browser_frame_aura.cc |
| +++ b/chrome/browser/ui/views/frame/browser_frame_aura.cc |
| @@ -24,6 +24,7 @@ |
| #if defined(USE_ASH) |
| #include "ash/wm/property_util.h" |
| +#include "ash/wm/window_util.h" |
| #endif |
| #if !defined(OS_CHROMEOS) |
| @@ -110,6 +111,12 @@ BrowserFrameAura::BrowserFrameAura(BrowserFrame* browser_frame, |
| GetNativeWindow(), |
| ash::WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_NO); |
| } |
| + // Mark this window as automatically position managed if no initial |
| + // bounds were given or we are not in restore mode. Otherwise this will be |
| + // done after the window got shown. |
|
sky
2012/10/22 16:40:50
How about:
Turn on auto window management if we do
Mr4D (OOO till 08-26)
2012/10/22 20:27:23
Done.
|
| + if (!browser_view->browser()->bounds_overridden() && |
| + !browser_view->browser()->is_session_restore()) |
| + SetWindowAutoManaged(); |
| #endif |
| } |
| @@ -161,8 +168,13 @@ void BrowserFrameAura::OnWindowTargetVisibilityChanged(bool visible) { |
| // RestoreFocus() when we become visible, which results in the web contents |
| // being asked to focus, which places focus either in the web contents or in |
| // the location bar as appropriate. |
| - if (visible) |
| + if (visible) { |
| + // If the window is able to get automatically managed, it can be marked now |
|
sky
2012/10/22 16:40:50
How about:
Once the window has been shown we know
Mr4D (OOO till 08-26)
2012/10/22 20:27:23
Done.
|
| + // for all use cases (since the workspace is now properly set up). |
| + SetWindowAutoManaged(); |
| + |
| browser_view_->RestoreFocus(); |
| + } |
| views::NativeWidgetAura::OnWindowTargetVisibilityChanged(visible); |
| } |
| @@ -220,3 +232,11 @@ NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( |
| BrowserFrameAura::~BrowserFrameAura() { |
| } |
| + |
| +void BrowserFrameAura::SetWindowAutoManaged() { |
| +#if defined(USE_ASH) |
| + if (browser_view_->browser()->type() != Browser::TYPE_POPUP || |
| + browser_view_->browser()->is_app()) |
| + ash::wm::SetWindowPositionManaged(GetNativeWindow(), true); |
| +#endif |
| +} |