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

Unified Diff: ash/common/wm/workspace/workspace_layout_manager.cc

Issue 2234033002: mash: Remove WorkspaceLayoutManagerDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove WmRootWindowControllerObserver::OnFullscreenStateChanged; use ShellObserver. 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
Index: ash/common/wm/workspace/workspace_layout_manager.cc
diff --git a/ash/common/wm/workspace/workspace_layout_manager.cc b/ash/common/wm/workspace/workspace_layout_manager.cc
index e1a19c7f1765990432d44a3fbb2766a4fd59ac28..3ea9ddba4b2c59a5efc7c9fa798d98844451d804 100644
--- a/ash/common/wm/workspace/workspace_layout_manager.cc
+++ b/ash/common/wm/workspace/workspace_layout_manager.cc
@@ -8,6 +8,8 @@
#include "ash/common/ash_switches.h"
#include "ash/common/session/session_state_delegate.h"
+#include "ash/common/shelf/wm_shelf.h"
+#include "ash/common/shell_window_ids.h"
#include "ash/common/wm/always_on_top_controller.h"
#include "ash/common/wm/fullscreen_window_finder.h"
#include "ash/common/wm/window_positioner.h"
@@ -15,7 +17,6 @@
#include "ash/common/wm/wm_event.h"
#include "ash/common/wm/wm_screen_util.h"
#include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h"
-#include "ash/common/wm/workspace/workspace_layout_manager_delegate.h"
#include "ash/common/wm_root_window_controller.h"
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
@@ -27,14 +28,11 @@
namespace ash {
-WorkspaceLayoutManager::WorkspaceLayoutManager(
- WmWindow* window,
- std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate)
+WorkspaceLayoutManager::WorkspaceLayoutManager(WmWindow* window)
: window_(window),
root_window_(window->GetRootWindow()),
root_window_controller_(root_window_->GetRootWindowController()),
shell_(window_->GetShell()),
- delegate_(std::move(delegate)),
work_area_in_parent_(wm::GetDisplayWorkAreaBounds(window_)),
is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr) {
shell_->AddShellObserver(this);
@@ -58,10 +56,6 @@ WorkspaceLayoutManager::~WorkspaceLayoutManager() {
shell_->RemoveShellObserver(this);
}
-void WorkspaceLayoutManager::DeleteDelegate() {
- delegate_.reset();
-}
-
void WorkspaceLayoutManager::SetMaximizeBackdropDelegate(
std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate) {
backdrop_delegate_.reset(delegate.release());
@@ -192,22 +186,6 @@ void WorkspaceLayoutManager::OnWorkAreaChanged() {
backdrop_delegate_->OnDisplayWorkAreaInsetsChanged();
}
-void WorkspaceLayoutManager::OnFullscreenStateChanged(bool is_fullscreen) {
- if (is_fullscreen_ == is_fullscreen)
- return;
-
- is_fullscreen_ = is_fullscreen;
- if (WmShell::Get()->IsPinned()) {
- // If this is in pinned mode, then this event does not trigger the
- // always-on-top state change, because it is kept disabled regardless of
- // the fullscreen state change.
- return;
- }
-
- UpdateAlwaysOnTop(is_fullscreen_ ? wm::GetWindowForFullscreenMode(window_)
- : nullptr);
-}
-
//////////////////////////////////////////////////////////////////////////////
// WorkspaceLayoutManager, aura::WindowObserver implementation:
@@ -306,6 +284,23 @@ void WorkspaceLayoutManager::OnPostWindowStateTypeChange(
//////////////////////////////////////////////////////////////////////////////
// WorkspaceLayoutManager, ShellObserver implementation:
+void WorkspaceLayoutManager::OnFullscreenStateChanged(bool is_fullscreen,
+ WmWindow* root_window) {
+ if (root_window != root_window_ || is_fullscreen_ == is_fullscreen)
+ return;
+
+ is_fullscreen_ = is_fullscreen;
+ if (WmShell::Get()->IsPinned()) {
+ // If this is in pinned mode, then this event does not trigger the
+ // always-on-top state change, because it is kept disabled regardless of
+ // the fullscreen state change.
+ return;
+ }
+
+ UpdateAlwaysOnTop(is_fullscreen_ ? wm::GetWindowForFullscreenMode(window_)
+ : nullptr);
+}
+
void WorkspaceLayoutManager::OnPinnedStateChanged(WmWindow* pinned_window) {
if (!WmShell::Get()->IsPinned() && is_fullscreen_) {
// On exiting from pinned mode, if the workspace is still in fullscreen
@@ -345,8 +340,8 @@ void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange(
}
void WorkspaceLayoutManager::UpdateShelfVisibility() {
- if (delegate_)
- delegate_->UpdateShelfVisibility();
+ if (root_window_controller_->HasShelf())
+ root_window_controller_->GetShelf()->UpdateVisibilityState();
}
void WorkspaceLayoutManager::UpdateFullscreenState() {
@@ -355,11 +350,11 @@ void WorkspaceLayoutManager::UpdateFullscreenState() {
// only windows in the default workspace container will go fullscreen but
// this should really be tracked by the RootWindowController since
// technically any container could get a fullscreen window.
- if (!delegate_)
+ if (window_->GetShellWindowId() != kShellWindowId_DefaultContainer)
return;
bool is_fullscreen = wm::GetWindowForFullscreenMode(window_) != nullptr;
if (is_fullscreen != is_fullscreen_) {
- delegate_->OnFullscreenStateChanged(is_fullscreen);
+ WmShell::Get()->NotifyFullscreenStateChanged(is_fullscreen, root_window_);
is_fullscreen_ = is_fullscreen;
}
}
« no previous file with comments | « ash/common/wm/workspace/workspace_layout_manager.h ('k') | ash/common/wm/workspace/workspace_layout_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698