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

Side by Side Diff: ash/common/wm/workspace/workspace_window_resizer.cc

Issue 2063333002: mash: Move all ash UMA metrics to //ash/common/metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/wm_user_metrics_action.h ('k') | ash/common/wm_shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/wm/workspace/workspace_window_resizer.h" 5 #include "ash/common/wm/workspace/workspace_window_resizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/common/metrics/user_metrics_action.h"
12 #include "ash/common/shell_window_ids.h" 13 #include "ash/common/shell_window_ids.h"
13 #include "ash/common/wm/default_window_resizer.h" 14 #include "ash/common/wm/default_window_resizer.h"
14 #include "ash/common/wm/dock/docked_window_layout_manager.h" 15 #include "ash/common/wm/dock/docked_window_layout_manager.h"
15 #include "ash/common/wm/dock/docked_window_resizer.h" 16 #include "ash/common/wm/dock/docked_window_resizer.h"
16 #include "ash/common/wm/panels/panel_window_resizer.h" 17 #include "ash/common/wm/panels/panel_window_resizer.h"
17 #include "ash/common/wm/window_positioning_utils.h" 18 #include "ash/common/wm/window_positioning_utils.h"
18 #include "ash/common/wm/window_state.h" 19 #include "ash/common/wm/window_state.h"
19 #include "ash/common/wm/wm_event.h" 20 #include "ash/common/wm/wm_event.h"
20 #include "ash/common/wm/wm_screen_util.h" 21 #include "ash/common/wm/wm_screen_util.h"
21 #include "ash/common/wm/wm_user_metrics_action.h"
22 #include "ash/common/wm/workspace/phantom_window_controller.h" 22 #include "ash/common/wm/workspace/phantom_window_controller.h"
23 #include "ash/common/wm/workspace/two_step_edge_cycler.h" 23 #include "ash/common/wm/workspace/two_step_edge_cycler.h"
24 #include "ash/common/wm_lookup.h" 24 #include "ash/common/wm_lookup.h"
25 #include "ash/common/wm_root_window_controller.h" 25 #include "ash/common/wm_root_window_controller.h"
26 #include "ash/common/wm_shell.h" 26 #include "ash/common/wm_shell.h"
27 #include "ash/common/wm_window.h" 27 #include "ash/common/wm_window.h"
28 #include "base/memory/ptr_util.h" 28 #include "base/memory/ptr_util.h"
29 #include "base/memory/weak_ptr.h" 29 #include "base/memory/weak_ptr.h"
30 #include "ui/base/hit_test.h" 30 #include "ui/base/hit_test.h"
31 #include "ui/compositor/layer.h" 31 #include "ui/compositor/layer.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 details().restore_bounds.IsEmpty() ? initial_bounds 414 details().restore_bounds.IsEmpty() ? initial_bounds
415 : details().restore_bounds); 415 : details().restore_bounds);
416 } 416 }
417 if (!dock_layout_->is_dragged_window_docked()) { 417 if (!dock_layout_->is_dragged_window_docked()) {
418 // TODO(oshima): Add event source type to WMEvent and move 418 // TODO(oshima): Add event source type to WMEvent and move
419 // metrics recording inside WindowState::OnWMEvent. 419 // metrics recording inside WindowState::OnWMEvent.
420 const wm::WMEvent event(snap_type_ == SNAP_LEFT 420 const wm::WMEvent event(snap_type_ == SNAP_LEFT
421 ? wm::WM_EVENT_SNAP_LEFT 421 ? wm::WM_EVENT_SNAP_LEFT
422 : wm::WM_EVENT_SNAP_RIGHT); 422 : wm::WM_EVENT_SNAP_RIGHT);
423 window_state()->OnWMEvent(&event); 423 window_state()->OnWMEvent(&event);
424 shell_->RecordUserMetricsAction( 424 shell_->RecordUserMetricsAction(snap_type_ == SNAP_LEFT
425 snap_type_ == SNAP_LEFT 425 ? UMA_DRAG_MAXIMIZE_LEFT
426 ? wm::WmUserMetricsAction::DRAG_MAXIMIZE_LEFT 426 : UMA_DRAG_MAXIMIZE_RIGHT);
427 : wm::WmUserMetricsAction::DRAG_MAXIMIZE_RIGHT);
428 snapped = true; 427 snapped = true;
429 } 428 }
430 } 429 }
431 430
432 if (!snapped) { 431 if (!snapped) {
433 if (window_state()->IsSnapped()) { 432 if (window_state()->IsSnapped()) {
434 // Keep the window snapped if the user resizes the window such that the 433 // Keep the window snapped if the user resizes the window such that the
435 // window has valid bounds for a snapped window. Always unsnap the window 434 // window has valid bounds for a snapped window. Always unsnap the window
436 // if the user dragged the window via the caption area because doing this 435 // if the user dragged the window via the caption area because doing this
437 // is slightly less confusing. 436 // is slightly less confusing.
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 DCHECK(snapped_type == wm::WINDOW_STATE_TYPE_LEFT_SNAPPED || 1015 DCHECK(snapped_type == wm::WINDOW_STATE_TYPE_LEFT_SNAPPED ||
1017 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); 1016 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED);
1018 gfx::Rect snapped_bounds = wm::GetDisplayWorkAreaBoundsInParent(GetTarget()); 1017 gfx::Rect snapped_bounds = wm::GetDisplayWorkAreaBoundsInParent(GetTarget());
1019 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) 1018 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED)
1020 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); 1019 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width());
1021 snapped_bounds.set_width(bounds_in_parent.width()); 1020 snapped_bounds.set_width(bounds_in_parent.width());
1022 return bounds_in_parent == snapped_bounds; 1021 return bounds_in_parent == snapped_bounds;
1023 } 1022 }
1024 1023
1025 } // namespace ash 1024 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/wm_user_metrics_action.h ('k') | ash/common/wm_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698