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

Unified Diff: ash/wm/drag_details.cc

Issue 121153003: Prevents panels attached to shelf from docking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prevents panels attached to shelf from docking (comments) Created 6 years, 11 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
Index: ash/wm/drag_details.cc
diff --git a/ash/wm/drag_details.cc b/ash/wm/drag_details.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5dab7f8c2d9979d5af05f37a6e2d9997ca5f51da
--- /dev/null
+++ b/ash/wm/drag_details.cc
@@ -0,0 +1,75 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
oshima 2014/01/10 02:28:52 ditto
varkha 2014/01/10 06:13:07 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/wm/drag_details.h"
+
+#include "ash/wm/window_resizer.h"
+#include "ui/aura/window.h"
+#include "ui/base/hit_test.h"
+
+namespace ash {
+
+namespace {
+
+int GetSizeChangeDirectionForWindowComponent(int window_component) {
+ int size_change_direction = WindowResizer::kBoundsChangeDirection_None;
+ switch (window_component) {
+ case HTTOPLEFT:
+ case HTTOPRIGHT:
+ case HTBOTTOMLEFT:
+ case HTBOTTOMRIGHT:
+ case HTGROWBOX:
+ case HTCAPTION:
+ size_change_direction |=
+ WindowResizer::kBoundsChangeDirection_Horizontal |
+ WindowResizer::kBoundsChangeDirection_Vertical;
+ break;
+ case HTTOP:
+ case HTBOTTOM:
+ size_change_direction |= WindowResizer::kBoundsChangeDirection_Vertical;
+ break;
+ case HTRIGHT:
+ case HTLEFT:
+ size_change_direction |= WindowResizer::kBoundsChangeDirection_Horizontal;
+ break;
+ default:
+ break;
+ }
+ return size_change_direction;
+}
+
+} // namespace
+
+DragDetails::DragDetails(aura::Window* window,
+ const gfx::Point& location,
+ int window_component,
+ aura::client::WindowMoveSource source)
+ : initial_bounds_in_parent(window->bounds()),
+ restore_bounds(gfx::Rect()),
oshima 2014/01/10 02:28:52 I believe you don't need this.
varkha 2014/01/10 06:13:07 Done.
+ initial_location_in_parent(location),
+ initial_opacity(window->layer()->opacity()),
+ window_component(window_component),
+ bounds_change(
+ WindowResizer::GetBoundsChangeForWindowComponent(window_component)),
+ position_change_direction(
+ WindowResizer::GetPositionChangeDirectionForWindowComponent(
+ window_component)),
+ size_change_direction(
+ GetSizeChangeDirectionForWindowComponent(window_component)),
+ is_resizable(bounds_change != WindowResizer::kBoundsChangeDirection_None),
+ source(source),
+ should_attach_to_shelf(window->type() == ui::wm::WINDOW_TYPE_PANEL &&
+ wm::GetWindowState(window)->panel_attached()),
+ window_resizer(NULL) {
+ wm::WindowState* window_state = wm::GetWindowState(window);
+ if (window_state->IsNormalShowState() &&
+ window_state->HasRestoreBounds() &&
+ window_component == HTCAPTION)
+ restore_bounds = window_state->GetRestoreBoundsInScreen();
+}
+
+DragDetails::~DragDetails() {
+}
+
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698