Chromium Code Reviews| Index: ash/wm/dock/docked_window_layout_manager.cc |
| diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc |
| index 8b64ffb4a20e3a06f03390a3dbbf1fdeacec5d31..786c5e5b2666ed2ae3c3f2f0e73156c63245a4c8 100644 |
| --- a/ash/wm/dock/docked_window_layout_manager.cc |
| +++ b/ash/wm/dock/docked_window_layout_manager.cc |
| @@ -20,6 +20,7 @@ |
| #include "ash/wm/workspace_controller.h" |
| #include "base/auto_reset.h" |
| #include "base/command_line.h" |
| +#include "base/metrics/histogram.h" |
| #include "third_party/skia/include/core/SkColor.h" |
| #include "ui/aura/client/activation_client.h" |
| #include "ui/aura/client/focus_client.h" |
| @@ -248,6 +249,7 @@ DockedWindowLayoutManager::DockedWindowLayoutManager( |
| docked_width_(0), |
| alignment_(DOCKED_ALIGNMENT_NONE), |
| last_active_window_(NULL), |
| + previous_docked_windows_(0), |
| background_widget_(new DockedBackgroundWidget(dock_container_)) { |
| DCHECK(dock_container); |
| aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())-> |
| @@ -464,7 +466,10 @@ void DockedWindowLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) { |
| // If this is the last window, set alignment and maximize the workspace. |
| if (!IsAnyWindowDocked()) { |
| alignment_ = DOCKED_ALIGNMENT_NONE; |
| + int previous_docked_width = docked_width_; |
| docked_width_ = 0; |
| + if (docked_width_ != previous_docked_width) |
| + UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.Dock.Width", docked_width_, 0, 360, 72); |
|
flackr
2013/10/29 21:33:49
Create a common method for updating and/or trackin
varkha
2013/10/30 19:21:00
Done.
|
| } |
| if (last_active_window_ == child) |
| last_active_window_ = NULL; |
| @@ -577,6 +582,8 @@ void DockedWindowLayoutManager::OnWindowShowTypeChanged( |
| // Reparenting changes the source bounds for the animation if a window is |
| // visible so hide it here and show later when it is already in the desktop. |
| UndockWindow(window); |
| + UMA_HISTOGRAM_ENUMERATION("Ash.Dock.Actions", |
| + DOCKED_ACTION_MAXIMIZE, DOCKED_ACTION_COUNT); |
| } else { |
| RestoreDockedWindow(window_state); |
| } |
| @@ -615,6 +622,8 @@ void DockedWindowLayoutManager::OnWindowDestroying(aura::Window* window) { |
| } |
| if (window == last_active_window_) |
| last_active_window_ = NULL; |
| + UMA_HISTOGRAM_ENUMERATION("Ash.Dock.Actions", |
| + DOCKED_ACTION_CLOSE, DOCKED_ACTION_COUNT); |
| } |
| @@ -652,16 +661,22 @@ void DockedWindowLayoutManager::MaybeMinimizeChildrenExcept( |
| // Use a copy of children array because a call to Minimize can change order. |
| aura::Window::Windows children(dock_container_->children()); |
| aura::Window::Windows::const_reverse_iterator iter = children.rbegin(); |
| + int docked_windows = child ? 1 : 0; |
| while (iter != children.rend()) { |
| aura::Window* window(*iter++); |
| if (window == child || !IsUsedByLayout(window)) |
| continue; |
| int room_needed = GetWindowHeightCloseTo(window, 0) + kMinDockGap; |
| - if (available_room > room_needed) |
| + if (available_room > room_needed) { |
| available_room -= room_needed; |
| - else |
| - wm::GetWindowState(window)->Minimize(); |
| + docked_windows++; |
| + continue; |
| + } |
| + wm::GetWindowState(window)->Minimize(); |
| } |
| + if (docked_windows != previous_docked_windows_) |
| + UMA_HISTOGRAM_COUNTS_100("Ash.Dock.Items", docked_windows); |
|
flackr
2013/10/29 21:33:49
MaybeMinimizeChildrenExcept is only called from Re
varkha
2013/10/30 19:21:00
MaybeMinimizeChildrenExcept is called from FinishD
|
| + previous_docked_windows_ = docked_windows; |
| } |
| void DockedWindowLayoutManager::MinimizeDockedWindow( |
| @@ -670,6 +685,8 @@ void DockedWindowLayoutManager::MinimizeDockedWindow( |
| window_state->window()->Hide(); |
| if (window_state->IsActive()) |
| window_state->Deactivate(); |
| + UMA_HISTOGRAM_ENUMERATION("Ash.Dock.Actions", |
| + DOCKED_ACTION_MINIMIZE, DOCKED_ACTION_COUNT); |
| } |
| void DockedWindowLayoutManager::RestoreDockedWindow( |
| @@ -686,6 +703,8 @@ void DockedWindowLayoutManager::RestoreDockedWindow( |
| // Evict the window if it can no longer be docked because of its height. |
| if (!CanDockWindow(window, SNAP_NONE)) { |
| UndockWindow(window); |
| + UMA_HISTOGRAM_ENUMERATION("Ash.Dock.Actions", |
| + DOCKED_ACTION_EVICT, DOCKED_ACTION_COUNT); |
| return; |
| } |
| gfx::Rect bounds(window->bounds()); |
| @@ -693,6 +712,8 @@ void DockedWindowLayoutManager::RestoreDockedWindow( |
| window->SetBounds(bounds); |
| window->Show(); |
| MaybeMinimizeChildrenExcept(window); |
| + UMA_HISTOGRAM_ENUMERATION("Ash.Dock.Actions", |
| + DOCKED_ACTION_RESTORE, DOCKED_ACTION_COUNT); |
| } |
| void DockedWindowLayoutManager::OnDraggedWindowDocked(aura::Window* window) { |
| @@ -849,13 +870,15 @@ void DockedWindowLayoutManager::FanOutChildren( |
| // Docked area is shown only if there is at least one non-dragged visible |
| // docked window. |
| + int previous_docked_width = docked_width_; |
| docked_width_ = ideal_docked_width; |
| if (visible_windows->empty() || |
| (visible_windows->size() == 1 && |
| (*visible_windows)[0].window() == dragged_window_)) { |
| docked_width_ = 0; |
| } |
| - |
| + if (docked_width_ != previous_docked_width) |
| + UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.Dock.Width", docked_width_, 0, 360, 72); |
|
flackr
2013/10/29 21:33:49
It might be worth setting a higher max in case we
varkha
2013/10/30 19:21:00
Done.
|
| // Sort windows by their center positions and fan out overlapping |
| // windows. |
| std::sort(visible_windows->begin(), visible_windows->end(), |