summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/wm/screen_dimmer.cc9
-rw-r--r--ash/wm/screen_dimmer.h3
-rw-r--r--ash/wm/screen_dimmer_unittest.cc27
-rw-r--r--chrome/browser/ui/webui/chromeos/login/oobe_ui.cc21
-rw-r--r--chrome/browser/ui/webui/chromeos/login/oobe_ui.h2
5 files changed, 60 insertions, 2 deletions
diff --git a/ash/wm/screen_dimmer.cc b/ash/wm/screen_dimmer.cc
index 6c74888..559faaf 100644
--- a/ash/wm/screen_dimmer.cc
+++ b/ash/wm/screen_dimmer.cc
@@ -53,7 +53,10 @@ ScreenDimmer* ScreenDimmer::GetForRoot() {
}
ScreenDimmer::ScreenDimmer(int container_id)
- : container_id_(container_id), target_opacity_(0.5f), is_dimming_(false) {
+ : container_id_(container_id),
+ target_opacity_(0.5f),
+ is_dimming_(false),
+ at_bottom_(false) {
Shell::GetInstance()->AddShellObserver(this);
}
@@ -93,6 +96,10 @@ void ScreenDimmer::Update(bool should_dim) {
dim = new DimWindow(container);
dim->SetDimOpacity(target_opacity_);
}
+ if (at_bottom_)
+ dim->parent()->StackChildAtBottom(dim);
+ else
+ dim->parent()->StackChildAtTop(dim);
dim->Show();
} else {
if (dim) {
diff --git a/ash/wm/screen_dimmer.h b/ash/wm/screen_dimmer.h
index 6d26e68..9d8779e 100644
--- a/ash/wm/screen_dimmer.h
+++ b/ash/wm/screen_dimmer.h
@@ -41,6 +41,8 @@ class ASH_EXPORT ScreenDimmer : ShellObserver {
// Dim or undim the layers.
void SetDimming(bool should_dim);
+ void set_at_bottom(bool at_bottom) { at_bottom_ = at_bottom; }
+
bool is_dimming() const { return is_dimming_; }
// Find a ScreenDimmer in the container, or nullptr if it does not exist.
@@ -63,6 +65,7 @@ class ASH_EXPORT ScreenDimmer : ShellObserver {
// Are we currently dimming the screen?
bool is_dimming_;
+ bool at_bottom_;
DISALLOW_COPY_AND_ASSIGN(ScreenDimmer);
};
diff --git a/ash/wm/screen_dimmer_unittest.cc b/ash/wm/screen_dimmer_unittest.cc
index 9b1bdc6..084105e 100644
--- a/ash/wm/screen_dimmer_unittest.cc
+++ b/ash/wm/screen_dimmer_unittest.cc
@@ -10,7 +10,8 @@
#include "ash/wm/dim_window.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/aura/window_event_dispatcher.h"
+//#include "ui/aura/window_event_dispatcher.h"
+#include "ui/aura/test/test_windows.h"
#include "ui/compositor/layer.h"
namespace ash {
@@ -86,5 +87,29 @@ TEST_F(ScreenDimmerTest, RootDimmer) {
EXPECT_EQ(nullptr, ScreenDimmer::FindForTest(-1));
}
+TEST_F(ScreenDimmerTest, DimAtBottom) {
+ ScreenDimmer* root_dimmer = ScreenDimmer::GetForRoot();
+ aura::Window* root_window = Shell::GetPrimaryRootWindow();
+ scoped_ptr<aura::Window> window(
+ aura::test::CreateTestWindowWithId(1, root_window));
+ root_dimmer->SetDimming(true);
+ std::vector<aura::Window*>::const_iterator dim_iter =
+ std::find(root_window->children().begin(), root_window->children().end(),
+ GetDimWindow());
+ ASSERT_TRUE(dim_iter != root_window->children().end());
+ // Dim layer is at top.
+ EXPECT_EQ(*dim_iter, *root_window->children().rbegin());
+
+ root_dimmer->SetDimming(false);
+ root_dimmer->set_at_bottom(true);
+ root_dimmer->SetDimming(true);
+
+ dim_iter = std::find(root_window->children().begin(),
+ root_window->children().end(), GetDimWindow());
+ ASSERT_TRUE(dim_iter != root_window->children().end());
+ // Dom layer is at the bottom.
+ EXPECT_EQ(*dim_iter, *root_window->children().begin());
+}
+
} // namespace test
} // namespace ash
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
index 70fa6ee..d34af39 100644
--- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
+#include "ash/shell_window_ids.h"
+#include "ash/wm/screen_dimmer.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -381,6 +383,9 @@ OobeUI::OobeUI(content::WebUI* web_ui, const GURL& url)
OobeUI::~OobeUI() {
core_handler_->SetDelegate(nullptr);
network_dropdown_handler_->RemoveObserver(error_screen_handler_);
+ ash::ScreenDimmer::GetForContainer(
+ ash::kShellWindowId_LockScreenContainersContainer)
+ ->SetDimming(false);
}
CoreOobeActor* OobeUI::GetCoreOobeActor() {
@@ -539,6 +544,12 @@ void OobeUI::InitializeScreenMaps() {
screen_names_[SCREEN_OOBE_HOST_PAIRING] = kScreenHostPairing;
screen_names_[SCREEN_DEVICE_DISABLED] = kScreenDeviceDisabled;
+ dim_overlay_screen_ids_.push_back(SCREEN_CONFIRM_PASSWORD);
+ dim_overlay_screen_ids_.push_back(SCREEN_GAIA_SIGNIN);
+ dim_overlay_screen_ids_.push_back(SCREEN_OOBE_ENROLLMENT);
+ dim_overlay_screen_ids_.push_back(SCREEN_PASSWORD_CHANGED);
+ dim_overlay_screen_ids_.push_back(SCREEN_USER_IMAGE_PICKER);
+
screen_ids_.clear();
for (size_t i = 0; i < screen_names_.size(); ++i)
screen_ids_[screen_names_[i]] = static_cast<Screen>(i);
@@ -634,7 +645,17 @@ void OobeUI::OnCurrentScreenChanged(const std::string& screen) {
previous_screen_ = current_screen_;
DCHECK(screen_ids_.count(screen))
<< "Screen should be registered in InitializeScreenMaps()";
+ LOG(ERROR) << "OnCurrentScreenChanged:" << screen;
Screen new_screen = screen_ids_[screen];
+
+ bool should_dim =
+ std::find(dim_overlay_screen_ids_.begin(), dim_overlay_screen_ids_.end(),
+ new_screen) != dim_overlay_screen_ids_.end();
+ ash::ScreenDimmer* screen_dimmer = ash::ScreenDimmer::GetForContainer(
+ ash::kShellWindowId_LockScreenContainersContainer);
+ screen_dimmer->set_at_bottom(true);
+ screen_dimmer->SetDimming(should_dim);
+
FOR_EACH_OBSERVER(Observer,
observer_list_,
OnCurrentScreenChanged(current_screen_, new_screen));
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.h b/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
index 72e8568..d710683 100644
--- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
+++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
@@ -246,6 +246,8 @@ class OobeUI : public OobeDisplay,
// Maps screen ids to JS screen names.
std::vector<std::string> screen_names_;
+ std::vector<Screen> dim_overlay_screen_ids_;
+
// Flag that indicates whether JS part is fully loaded and ready to accept
// calls.
bool ready_;