Index: athena/wm/window_manager_impl.cc |
diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc |
index 3e6e3904f63c3010949e1e95bfaf866ddf3bb69b..07d94253e33078f7f7f7647bde794080343f0d75 100644 |
--- a/athena/wm/window_manager_impl.cc |
+++ b/athena/wm/window_manager_impl.cc |
@@ -16,8 +16,10 @@ |
#include "athena/wm/window_overview_mode.h" |
#include "base/bind.h" |
#include "base/logging.h" |
+#include "ui/aura/client/aura_constants.h" |
#include "ui/aura/layout_manager.h" |
#include "ui/aura/window.h" |
+#include "ui/aura/window_delegate.h" |
#include "ui/compositor/closure_animation_observer.h" |
#include "ui/compositor/scoped_layer_animation_settings.h" |
#include "ui/gfx/display.h" |
@@ -40,6 +42,16 @@ void SetWindowState(aura::Window* window, |
window->SetTransform(transform); |
} |
+// Tests whether the given window can be maximized |
+bool CanWindowMaximize(aura::Window* window) { |
+ bool can_maximize = window->GetProperty(aura::client::kCanMaximizeKey); |
+ aura::WindowDelegate* delegate = window->delegate(); |
+ bool has_no_maximum_bound = |
+ delegate ? delegate->GetMaximumSize().IsEmpty() : true; |
oshima
2014/10/23 01:05:46
nit: how about
bool no_max_size = !delegate || de
afakhry
2014/10/24 02:09:45
Acknowledged.
|
+ |
+ return (can_maximize && has_no_maximum_bound); |
+} |
+ |
} // namespace |
class AthenaContainerLayoutManager : public aura::LayoutManager { |
@@ -138,6 +150,9 @@ void AthenaContainerLayoutManager::OnWindowRemovedFromLayout( |
void AthenaContainerLayoutManager::OnChildWindowVisibilityChanged( |
aura::Window* child, |
bool visible) { |
+ if(visible && CanWindowMaximize(child)) |
oshima
2014/10/23 01:05:46
nit: you need {} in this case
afakhry
2014/10/24 02:09:45
Acknowledged.
|
+ child->SetBounds(gfx::Screen::GetNativeScreen()-> |
+ GetPrimaryDisplay().work_area()); |
} |
void AthenaContainerLayoutManager::SetChildBounds( |
@@ -304,7 +319,11 @@ void WindowManagerImpl::OnSelectWindow(aura::Window* window) { |
// resized. |
const gfx::Size work_area = |
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().size(); |
- if (window->GetTargetBounds().size() != work_area) { |
+ |
+ // Resize to the screen bounds only if the window is maximize-able, and |
+ // is not already maximized |
+ if (window->GetTargetBounds().size() != work_area && |
+ CanWindowMaximize(window)) { |
const gfx::Rect& window_bounds = window->bounds(); |
const gfx::Rect desired_bounds(work_area); |
gfx::Transform transform; |