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

Unified Diff: ash/wm/dock/docked_window_layout_manager.cc

Issue 594383002: Change behaviour of the Alt-] and Alt-[ keys so that it cycles through SnapLeft/SnapRight to DockLe… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@event
Patch Set: Add uma events, change toggle->cycle Created 6 years, 2 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
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.h ('k') | ash/wm/lock_window_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9eb4a12a986353d1fcce26060c6eee2e7981059d..5445551c371def86dd4d5011ff682246e00b2d32 100644
--- a/ash/wm/dock/docked_window_layout_manager.cc
+++ b/ash/wm/dock/docked_window_layout_manager.cc
@@ -416,6 +416,8 @@ DockedWindowLayoutManager::DockedWindowLayoutManager(
WORKSPACE_WINDOW_STATE_FULL_SCREEN),
docked_width_(0),
alignment_(DOCKED_ALIGNMENT_NONE),
+ preferred_alignment_(DOCKED_ALIGNMENT_NONE),
+ event_source_(DOCKED_ACTION_SOURCE_UNKNOWN),
last_active_window_(NULL),
last_action_time_(base::Time::Now()),
background_widget_(new DockedBackgroundWidget(dock_container_)) {
@@ -637,7 +639,7 @@ bool DockedWindowLayoutManager::CanDockWindow(
bool DockedWindowLayoutManager::IsDockedAlignmentValid(
DockedAlignment alignment) const {
- ShelfAlignment shelf_alignment = shelf_ ? shelf->alignment() :
+ ShelfAlignment shelf_alignment = shelf_ ? shelf_->alignment() :
SHELF_ALIGNMENT_BOTTOM;
if ((alignment == DOCKED_ALIGNMENT_LEFT &&
shelf_alignment == SHELF_ALIGNMENT_LEFT) ||
@@ -692,13 +694,18 @@ void DockedWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
// A window can be added without proper bounds when window is moved to another
// display via API or due to display configuration change, so the alignment
// is set based on which edge is closer in the new display.
- if (alignment_ == DOCKED_ALIGNMENT_NONE)
- alignment_ = GetEdgeNearestWindow(child);
+ if (alignment_ == DOCKED_ALIGNMENT_NONE) {
+ alignment_ = preferred_alignment_ != DOCKED_ALIGNMENT_NONE ?
+ preferred_alignment_ : GetEdgeNearestWindow(child);
+ }
MaybeMinimizeChildrenExcept(child);
child->AddObserver(this);
wm::GetWindowState(child)->AddObserver(this);
Relayout();
UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED);
+
+ if (event_source_ != DOCKED_ACTION_SOURCE_UNKNOWN)
varkha 2014/10/03 17:07:26 I think it is better to always record the UMA acti
varkha 2014/10/03 17:13:50 As we talked offline this won't be possible (the d
dtapuska 2014/10/03 17:17:15 Done.
+ RecordUmaAction(DOCKED_ACTION_DOCK, event_source_);
}
void DockedWindowLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
@@ -848,12 +855,16 @@ void DockedWindowLayoutManager::OnPreWindowStateTypeChange(
if (window != dragged_window_) {
UndockWindow(window);
if (window_state->IsMaximizedOrFullscreen())
- RecordUmaAction(DOCKED_ACTION_MAXIMIZE, DOCKED_ACTION_SOURCE_UNKNOWN);
+ RecordUmaAction(DOCKED_ACTION_MAXIMIZE, event_source_);
+ else
+ RecordUmaAction(DOCKED_ACTION_UNDOCK, event_source_);
}
} else if (window_state->IsMinimized()) {
MinimizeDockedWindow(window_state);
} else if (old_type == wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED) {
RestoreDockedWindow(window_state);
+ } else if (old_type == wm::WINDOW_STATE_TYPE_MINIMIZED) {
+ NOTREACHED() << "Minimized window in docked layout manager";
}
}
@@ -892,7 +903,7 @@ void DockedWindowLayoutManager::OnWindowDestroying(aura::Window* window) {
}
if (window == last_active_window_)
last_active_window_ = NULL;
- RecordUmaAction(DOCKED_ACTION_CLOSE, DOCKED_ACTION_SOURCE_UNKNOWN);
+ RecordUmaAction(DOCKED_ACTION_CLOSE, event_source_);
}
@@ -959,7 +970,7 @@ void DockedWindowLayoutManager::MinimizeDockedWindow(
window_state->window()->Hide();
if (window_state->IsActive())
window_state->Deactivate();
- RecordUmaAction(DOCKED_ACTION_MINIMIZE, DOCKED_ACTION_SOURCE_UNKNOWN);
+ RecordUmaAction(DOCKED_ACTION_MINIMIZE, event_source_);
}
void DockedWindowLayoutManager::RestoreDockedWindow(
@@ -976,7 +987,7 @@ void DockedWindowLayoutManager::RestoreDockedWindow(
// Evict the window if it can no longer be docked because of its height.
if (!CanDockWindow(window, DOCKED_ALIGNMENT_NONE)) {
window_state->Restore();
- RecordUmaAction(DOCKED_ACTION_EVICT, DOCKED_ACTION_SOURCE_UNKNOWN);
+ RecordUmaAction(DOCKED_ACTION_EVICT, event_source_);
return;
}
gfx::Rect bounds(window->bounds());
@@ -984,7 +995,7 @@ void DockedWindowLayoutManager::RestoreDockedWindow(
window->SetBounds(bounds);
window->Show();
MaybeMinimizeChildrenExcept(window);
- RecordUmaAction(DOCKED_ACTION_RESTORE, DOCKED_ACTION_SOURCE_UNKNOWN);
+ RecordUmaAction(DOCKED_ACTION_RESTORE, event_source_);
}
void DockedWindowLayoutManager::RecordUmaAction(DockedAction action,
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager.h ('k') | ash/wm/lock_window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698