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

Side by Side Diff: ash/common/wm/drag_details.cc

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « ash/common/wm/drag_details.h ('k') | ash/common/wm/focus_rules.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/common/wm/drag_details.h"
6
7 #include "ash/common/wm/window_resizer.h"
8 #include "ash/common/wm_window.h"
9 #include "ash/public/cpp/window_properties.h"
10 #include "ui/aura/window.h"
11 #include "ui/base/hit_test.h"
12 #include "ui/compositor/layer.h"
13
14 namespace ash {
15
16 namespace {
17
18 int GetSizeChangeDirectionForWindowComponent(int window_component) {
19 int size_change_direction = WindowResizer::kBoundsChangeDirection_None;
20 switch (window_component) {
21 case HTTOPLEFT:
22 case HTTOPRIGHT:
23 case HTBOTTOMLEFT:
24 case HTBOTTOMRIGHT:
25 case HTGROWBOX:
26 case HTCAPTION:
27 size_change_direction |=
28 WindowResizer::kBoundsChangeDirection_Horizontal |
29 WindowResizer::kBoundsChangeDirection_Vertical;
30 break;
31 case HTTOP:
32 case HTBOTTOM:
33 size_change_direction |= WindowResizer::kBoundsChangeDirection_Vertical;
34 break;
35 case HTRIGHT:
36 case HTLEFT:
37 size_change_direction |= WindowResizer::kBoundsChangeDirection_Horizontal;
38 break;
39 default:
40 break;
41 }
42 return size_change_direction;
43 }
44
45 } // namespace
46
47 DragDetails::DragDetails(WmWindow* window,
48 const gfx::Point& location,
49 int window_component,
50 aura::client::WindowMoveSource source)
51 : initial_state_type(window->GetWindowState()->GetStateType()),
52 initial_bounds_in_parent(window->GetBounds()),
53 initial_location_in_parent(location),
54 // When drag starts, we might be in the middle of a window opacity
55 // animation, on drag completion we must set the opacity to the target
56 // opacity rather than the current opacity (crbug.com/687003).
57 initial_opacity(window->GetLayer()->GetTargetOpacity()),
58 window_component(window_component),
59 bounds_change(
60 WindowResizer::GetBoundsChangeForWindowComponent(window_component)),
61 position_change_direction(
62 WindowResizer::GetPositionChangeDirectionForWindowComponent(
63 window_component)),
64 size_change_direction(
65 GetSizeChangeDirectionForWindowComponent(window_component)),
66 is_resizable(bounds_change != WindowResizer::kBoundsChangeDirection_None),
67 source(source),
68 should_attach_to_shelf(
69 window->GetType() == ui::wm::WINDOW_TYPE_PANEL &&
70 window->aura_window()->GetProperty(kPanelAttachedKey)) {
71 wm::WindowState* window_state = window->GetWindowState();
72 if ((window_state->IsNormalOrSnapped() || window_state->IsDocked()) &&
73 window_state->HasRestoreBounds() && window_component == HTCAPTION) {
74 restore_bounds = window_state->GetRestoreBoundsInScreen();
75 }
76 }
77
78 DragDetails::~DragDetails() {}
79
80 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/drag_details.h ('k') | ash/common/wm/focus_rules.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698