Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3040)

Unified Diff: athena/wm/window_manager_impl.cc

Issue 668513003: Selecting an app window from the overview mode maximizes the window only if it's maximizable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « athena/activity/activity_widget_delegate.cc ('k') | athena/wm/window_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/wm/window_manager_impl.cc
diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc
index c8c1caccc01060c1261b40e0ef2a0682aaaba28a..1392133b5c1b84c244922b150e83c84cb9a65b35 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(const aura::Window* const window) {
+ const aura::WindowDelegate* delegate = window->delegate();
+ const bool no_max_size =
+ !delegate || delegate->GetMaximumSize().IsEmpty();
+ return no_max_size &&
+ window->GetProperty(aura::client::kCanMaximizeKey) &&
+ window->GetProperty(aura::client::kCanResizeKey);
+}
+
} // namespace
class AthenaContainerLayoutManager : public aura::LayoutManager {
@@ -88,12 +100,12 @@ void AthenaContainerLayoutManager::OnWindowResized() {
if (is_splitview) {
if (window == instance->split_view_controller_->left_window())
window->SetBounds(gfx::Rect(split_size));
- else if (window == instance->split_view_controller_->right_window())
+ else if (window == instance->split_view_controller_->right_window()) {
window->SetBounds(
gfx::Rect(gfx::Point(split_size.width(), 0), split_size));
- else
- window->SetBounds(gfx::Rect(work_area));
- } else {
+ } else if (CanWindowMaximize(window))
+ window->SetBounds(gfx::Rect(work_area));
+ } else if (CanWindowMaximize(window)) {
window->SetBounds(gfx::Rect(work_area));
}
}
@@ -119,6 +131,14 @@ void AthenaContainerLayoutManager::OnWindowRemovedFromLayout(
void AthenaContainerLayoutManager::OnChildWindowVisibilityChanged(
aura::Window* child,
bool visible) {
+ if (visible && CanWindowMaximize(child)) {
+ // Make sure we're resizing a window that actually exists in the window list
+ // to avoid resizing the divider in the split mode.
+ if(instance->window_list_provider_->IsWindowInList(child)) {
+ child->SetBounds(
+ gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area());
+ }
+ }
}
void AthenaContainerLayoutManager::SetChildBounds(
@@ -291,7 +311,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;
« no previous file with comments | « athena/activity/activity_widget_delegate.cc ('k') | athena/wm/window_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698