Index: ash/wm/dock/docked_window_resizer.cc |
diff --git a/ash/wm/dock/docked_window_resizer.cc b/ash/wm/dock/docked_window_resizer.cc |
index 28d043848b298463ceae29a7f7289faed357b3df..1217abfd850b8737fa3a9b22d9eee605efa57041 100644 |
--- a/ash/wm/dock/docked_window_resizer.cc |
+++ b/ash/wm/dock/docked_window_resizer.cc |
@@ -21,6 +21,7 @@ |
#include "ash/wm/workspace/workspace_window_resizer.h" |
#include "base/command_line.h" |
#include "base/memory/weak_ptr.h" |
+#include "base/metrics/histogram.h" |
#include "ui/aura/client/aura_constants.h" |
#include "ui/aura/client/window_tree_client.h" |
#include "ui/aura/env.h" |
@@ -161,6 +162,7 @@ const gfx::Point& DockedWindowResizer::GetInitialLocation() const { |
DockedWindowResizer::DockedWindowResizer(WindowResizer* next_window_resizer, |
const Details& details) |
: details_(details), |
+ last_docked_action_(base::Time::Now()), |
next_window_resizer_(next_window_resizer), |
dock_layout_(NULL), |
initial_dock_layout_(NULL), |
@@ -262,6 +264,7 @@ void DockedWindowResizer::FinishedDragging() { |
window_state->ClearRestoreBounds(); |
// Check if the window needs to be docked or returned to workspace. |
+ DockedAction action = DOCKED_ACTION_CANCEL; |
aura::Window* dock_container = Shell::GetContainer( |
window->GetRootWindow(), |
kShellWindowId_DockedContainer); |
@@ -269,6 +272,7 @@ void DockedWindowResizer::FinishedDragging() { |
is_docked_ != (window->parent() == dock_container)) { |
if (is_docked_) { |
wm::ReparentChildWithTransientChildren(dock_container, window); |
+ action = DOCKED_ACTION_DOCK; |
} else if (window->parent()->id() == kShellWindowId_DockedContainer) { |
// Reparent the window back to workspace. |
// We need to be careful to give ParentWindowWithContext a location in |
@@ -282,8 +286,26 @@ void DockedWindowResizer::FinishedDragging() { |
aura::client::ParentWindowWithContext(window, window, near_last_location); |
if (window->parent() != previous_parent) |
wm::ReparentTransientChildrenOfChild(window->parent(), window); |
+ action = was_docked_ ? DOCKED_ACTION_UNDOCK : DOCKED_ACTION_CANCEL; |
} |
+ } else { |
+ // Docked state was not changed but still need to record a UMA action. |
+ if (is_resized && is_docked_ && was_docked_) |
+ action = DOCKED_ACTION_RESIZE; |
+ else if (is_docked_ && was_docked_) |
+ action = DOCKED_ACTION_REORDER; |
+ else if (is_docked_ && !was_docked_) |
+ action = DOCKED_ACTION_DOCK; |
+ else |
+ action = DOCKED_ACTION_CANCEL; |
flackr
2013/10/29 21:33:49
As with the time between use below, I don't think
varkha
2013/10/30 19:21:00
Done.
|
} |
+ if (action != DOCKED_ACTION_CANCEL) { |
+ base::Time time_now = base::Time::Now(); |
+ UMA_HISTOGRAM_LONG_TIMES_100("Ash.Dock.TimeBetweenUse", |
+ time_now - last_docked_action_); |
flackr
2013/10/29 21:33:49
Doesn't DockedWindowResizer::FinishDragging get ca
varkha
2013/10/30 19:21:00
Done.
|
+ last_docked_action_ = time_now; |
+ } |
+ UMA_HISTOGRAM_ENUMERATION("Ash.Dock.Actions", action, DOCKED_ACTION_COUNT); |
dock_layout_->FinishDragging(); |
// If we started the drag in one root window and moved into another root |