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

Unified Diff: ash/shelf/shelf_layout_manager.cc

Issue 2243513004: mash: Partially migrate WorkspaceController to ash common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 4 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/shelf/shelf_layout_manager.h ('k') | ash/shelf/shelf_widget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_layout_manager.cc
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index ba25161f0dfb774a87381a75981d3c666fb6054a..d0f49d3672bb82e40889c8cb684dbb25febbcfb3 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -26,7 +26,6 @@
#include "ash/common/wm_window.h"
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_layout_manager_observer.h"
-#include "ash/wm/workspace_controller.h"
#include "base/auto_reset.h"
#include "base/i18n/rtl.h"
#include "ui/compositor/layer.h"
@@ -144,7 +143,6 @@ class ShelfLayoutManager::RootWindowControllerObserverImpl
ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf_widget)
: updating_bounds_(false),
shelf_widget_(shelf_widget),
- workspace_controller_(NULL),
window_overlaps_shelf_(false),
mouse_over_shelf_when_auto_hide_timer_started_(false),
gesture_drag_status_(GESTURE_DRAG_NONE),
@@ -174,7 +172,6 @@ ShelfLayoutManager::~ShelfLayoutManager() {
void ShelfLayoutManager::PrepareForShutdown() {
in_shutdown_ = true;
- set_workspace_controller(nullptr);
// Stop observing changes to avoid updating a partially destructed shelf.
WmShell::Get()->RemoveActivationObserver(this);
}
@@ -228,9 +225,10 @@ ShelfVisibilityState ShelfLayoutManager::CalculateShelfVisibility() {
}
void ShelfLayoutManager::UpdateVisibilityState() {
- // Bail out early when there is no |workspace_controller_|, which happens
- // during shutdown after PrepareForShutdown. Also bail before a shelf exists.
- if (!workspace_controller_ || !shelf_widget_->shelf())
+ WmWindow* shelf_window = WmLookup::Get()->GetWindowForWidget(shelf_widget_);
+ WmRootWindowController* controller = shelf_window->GetRootWindowController();
James Cook 2016/08/12 01:52:50 optional: I liked the old name better, |controller
msw 2016/08/12 04:01:57 Acknowledged; I'll leave it as-is.
+ // Bail out early before the shelf is initialized or after it is destroyed.
+ if (!controller || !shelf_widget_->shelf() || in_shutdown_)
return;
if (state_.is_screen_locked || state_.is_adding_user_screen) {
@@ -241,7 +239,7 @@ void ShelfLayoutManager::UpdateVisibilityState() {
// TODO(zelidrag): Verify shelf drag animation still shows on the device
// when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN.
wm::WorkspaceWindowState window_state(
- workspace_controller_->GetWindowState());
+ controller->GetWorkspaceWindowState());
switch (window_state) {
case wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN: {
if (IsShelfHiddenForFullscreen()) {
@@ -465,15 +463,14 @@ ShelfLayoutManager::TargetBounds::TargetBounds()
ShelfLayoutManager::TargetBounds::~TargetBounds() {}
void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) {
- if (!shelf_widget_->GetNativeView())
- return;
-
State state;
state.visibility_state = visibility_state;
state.auto_hide_state = CalculateAutoHideState(visibility_state);
- state.window_state = workspace_controller_
- ? workspace_controller_->GetWindowState()
- : wm::WORKSPACE_WINDOW_STATE_DEFAULT;
+
+ WmWindow* shelf_window = WmLookup::Get()->GetWindowForWidget(shelf_widget_);
+ WmRootWindowController* controller = shelf_window->GetRootWindowController();
+ state.window_state = controller ? controller->GetWorkspaceWindowState()
+ : wm::WORKSPACE_WINDOW_STATE_DEFAULT;
// Preserve the log in screen states.
state.is_adding_user_screen = state_.is_adding_user_screen;
state.is_screen_locked = state_.is_screen_locked;
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/shelf/shelf_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698