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

Unified Diff: ash/wm/screen_dimmer.cc

Issue 2336653002: Ports SystemModalContainerLayoutManager to ash/common (Closed)
Patch Set: merge again Created 4 years, 3 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/screen_dimmer.h ('k') | ash/wm/screen_pinning_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/screen_dimmer.cc
diff --git a/ash/wm/screen_dimmer.cc b/ash/wm/screen_dimmer.cc
index e232bea33fd8a825a67dc67d00a4631d7448786e..25bf266cf552570abeb854288931d0f9d882d323 100644
--- a/ash/wm/screen_dimmer.cc
+++ b/ash/wm/screen_dimmer.cc
@@ -5,17 +5,14 @@
#include "ash/wm/screen_dimmer.h"
#include "ash/aura/wm_window_aura.h"
+#include "ash/common/wm/container_finder.h"
#include "ash/common/wm/window_dimmer.h"
#include "ash/common/wm_shell.h"
+#include "ash/common/wm_window.h"
#include "ash/common/wm_window_user_data.h"
-#include "ash/shell.h"
-#include "base/time/time.h"
-#include "ui/aura/window_event_dispatcher.h"
+#include "base/memory/ptr_util.h"
+#include "ui/aura/window.h"
#include "ui/aura/window_property.h"
-#include "ui/compositor/layer.h"
-#include "ui/compositor/scoped_layer_animation_settings.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/size.h"
DECLARE_WINDOW_PROPERTY_TYPE(ash::ScreenDimmer*);
@@ -26,19 +23,28 @@ DEFINE_OWNED_WINDOW_PROPERTY_KEY(ScreenDimmer, kScreenDimmerKey, nullptr);
// Opacity when it's dimming the entire screen.
const float kDimmingLayerOpacityForRoot = 0.4f;
+// Id used to indicate the root window.
const int kRootWindowMagicId = -100;
-std::vector<aura::Window*> GetAllContainers(int container_id) {
+std::vector<WmWindow*> GetAllContainers(int container_id) {
return container_id == kRootWindowMagicId
- ? Shell::GetAllRootWindows()
- : Shell::GetContainersFromAllRootWindows(container_id, nullptr);
+ ? WmShell::Get()->GetAllRootWindows()
+ : wm::GetContainersFromAllRootWindows(container_id);
+}
+
+WmWindow* FindContainer(int container_id) {
+ WmWindow* primary = WmShell::Get()->GetPrimaryRootWindow();
+ return container_id == kRootWindowMagicId
+ ? primary
+ : primary->GetChildByShellWindowId(container_id);
}
} // namespace
// static
ScreenDimmer* ScreenDimmer::GetForContainer(int container_id) {
- aura::Window* primary_container = FindContainer(container_id);
+ aura::Window* primary_container =
+ WmWindowAura::GetAuraWindow(FindContainer(container_id));
ScreenDimmer* dimmer = primary_container->GetProperty(kScreenDimmerKey);
if (!dimmer) {
dimmer = new ScreenDimmer(container_id);
@@ -76,16 +82,10 @@ void ScreenDimmer::SetDimming(bool should_dim) {
Update(should_dim);
}
-ScreenDimmer* ScreenDimmer::FindForTest(int container_id) {
- return FindContainer(container_id)->GetProperty(kScreenDimmerKey);
-}
-
// static
-aura::Window* ScreenDimmer::FindContainer(int container_id) {
- aura::Window* primary = Shell::GetPrimaryRootWindow();
- return container_id == kRootWindowMagicId
- ? primary
- : primary->GetChildById(container_id);
+ScreenDimmer* ScreenDimmer::FindForTest(int container_id) {
+ return WmWindowAura::GetAuraWindow(FindContainer(container_id))
+ ->GetProperty(kScreenDimmerKey);
}
void ScreenDimmer::OnRootWindowAdded(WmWindow* root_window) {
@@ -93,8 +93,7 @@ void ScreenDimmer::OnRootWindowAdded(WmWindow* root_window) {
}
void ScreenDimmer::Update(bool should_dim) {
- for (aura::Window* aura_container : GetAllContainers(container_id_)) {
- WmWindow* container = WmWindowAura::Get(aura_container);
+ for (WmWindow* container : GetAllContainers(container_id_)) {
WindowDimmer* window_dimmer = window_dimmers_->Get(container);
if (should_dim) {
if (!window_dimmer) {
« no previous file with comments | « ash/wm/screen_dimmer.h ('k') | ash/wm/screen_pinning_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698