Disabled transparency for header bars on the signin screen.

BUG=131242
TEST=Tested on Linux ChromeOS build


Review URL: https://chromiumcodereview.appspot.com/11673006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175779 0039d316-1c4b-4281-b951-d872f2087c98
parent 64d11dea
...@@ -791,9 +791,8 @@ int FramePainter::AdjustFrameHitCodeForMaximizedModes(int hit_code) { ...@@ -791,9 +791,8 @@ int FramePainter::AdjustFrameHitCodeForMaximizedModes(int hit_code) {
bool FramePainter::UseSoloWindowHeader() { bool FramePainter::UseSoloWindowHeader() {
aura::RootWindow* root = window_->GetRootWindow(); aura::RootWindow* root = window_->GetRootWindow();
if (!root) if (!root || root->GetProperty(internal::kIgnoreSoloWindowFramePainterPolicy))
return false; return false;
return (root->GetProperty(internal::kSoloWindowFramePainterKey) == this); return (root->GetProperty(internal::kSoloWindowFramePainterKey) == this);
} }
......
...@@ -22,6 +22,7 @@ namespace internal { ...@@ -22,6 +22,7 @@ namespace internal {
DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::internal::AlwaysOnTopController, DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::internal::AlwaysOnTopController,
kAlwaysOnTopControllerKey, kAlwaysOnTopControllerKey,
NULL); NULL);
DEFINE_WINDOW_PROPERTY_KEY(bool, kIgnoreSoloWindowFramePainterPolicy, false);
DEFINE_WINDOW_PROPERTY_KEY(bool, kIgnoredByShelfKey, false); DEFINE_WINDOW_PROPERTY_KEY(bool, kIgnoredByShelfKey, false);
DEFINE_WINDOW_PROPERTY_KEY( DEFINE_WINDOW_PROPERTY_KEY(
ui::WindowShowState, kRestoreShowStateKey, ui::SHOW_STATE_DEFAULT); ui::WindowShowState, kRestoreShowStateKey, ui::SHOW_STATE_DEFAULT);
......
...@@ -33,6 +33,11 @@ class RootWindowController; ...@@ -33,6 +33,11 @@ class RootWindowController;
extern const aura::WindowProperty<internal::AlwaysOnTopController*>* const extern const aura::WindowProperty<internal::AlwaysOnTopController*>* const
kAlwaysOnTopControllerKey; kAlwaysOnTopControllerKey;
// A property key to disable the frame painter policy for solo windows.
// It is only available for root windows.
ASH_EXPORT extern const aura::WindowProperty<bool>* const
kIgnoreSoloWindowFramePainterPolicy;
// True if the window is ignored by the shelf layout manager for purposes of // True if the window is ignored by the shelf layout manager for purposes of
// darkening the shelf. // darkening the shelf.
extern const aura::WindowProperty<bool>* const extern const aura::WindowProperty<bool>* const
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/shell_window_ids.h" #include "ash/shell_window_ids.h"
#include "ash/wm/window_animations.h" #include "ash/wm/window_animations.h"
#include "ash/wm/window_properties.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
#include "ui/aura/env.h" #include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -66,7 +68,8 @@ WebUILoginDisplayHost::WebUILoginDisplayHost(const gfx::Rect& background_bounds) ...@@ -66,7 +68,8 @@ WebUILoginDisplayHost::WebUILoginDisplayHost(const gfx::Rect& background_bounds)
is_wallpaper_loaded_(false), is_wallpaper_loaded_(false),
status_area_saved_visibility_(false), status_area_saved_visibility_(false),
crash_count_(0), crash_count_(0),
restore_path_(RESTORE_UNKNOWN) { restore_path_(RESTORE_UNKNOWN),
old_ignore_solo_window_frame_painter_policy_value_(false) {
bool is_registered = WizardController::IsDeviceRegistered(); bool is_registered = WizardController::IsDeviceRegistered();
bool zero_delay_enabled = WizardController::IsZeroDelayEnabled(); bool zero_delay_enabled = WizardController::IsZeroDelayEnabled();
bool disable_boot_animation = CommandLine::ForCurrentProcess()-> bool disable_boot_animation = CommandLine::ForCurrentProcess()->
...@@ -136,8 +139,7 @@ WebUILoginDisplayHost::WebUILoginDisplayHost(const gfx::Rect& background_bounds) ...@@ -136,8 +139,7 @@ WebUILoginDisplayHost::WebUILoginDisplayHost(const gfx::Rect& background_bounds)
} }
WebUILoginDisplayHost::~WebUILoginDisplayHost() { WebUILoginDisplayHost::~WebUILoginDisplayHost() {
if (login_window_) ResetLoginWindowAndView();
login_window_->Close();
} }
// LoginDisplayHost implementation --------------------------------------------- // LoginDisplayHost implementation ---------------------------------------------
...@@ -228,11 +230,7 @@ void WebUILoginDisplayHost::OnPreferencesChanged() { ...@@ -228,11 +230,7 @@ void WebUILoginDisplayHost::OnPreferencesChanged() {
void WebUILoginDisplayHost::OnBrowserCreated() { void WebUILoginDisplayHost::OnBrowserCreated() {
// Close lock window now so that the launched browser can receive focus. // Close lock window now so that the launched browser can receive focus.
if (login_window_) { ResetLoginWindowAndView();
login_window_->Close();
login_window_ = NULL;
login_view_ = NULL;
}
} }
void WebUILoginDisplayHost::Observe( void WebUILoginDisplayHost::Observe(
...@@ -276,48 +274,7 @@ void WebUILoginDisplayHost::Observe( ...@@ -276,48 +274,7 @@ void WebUILoginDisplayHost::Observe(
} }
void WebUILoginDisplayHost::LoadURL(const GURL& url) { void WebUILoginDisplayHost::LoadURL(const GURL& url) {
if (!login_window_) { InitLoginWindowAndView();
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
params.bounds = background_bounds();
params.show_state = ui::SHOW_STATE_FULLSCREEN;
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableNewOobe))
params.transparent = true;
params.parent =
ash::Shell::GetContainer(
ash::Shell::GetPrimaryRootWindow(),
ash::internal::kShellWindowId_LockScreenContainer);
login_window_ = new views::Widget;
login_window_->Init(params);
login_view_ = new WebUILoginView();
login_view_->Init(login_window_);
views::corewm::SetWindowVisibilityAnimationDuration(
login_window_->GetNativeView(),
base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs));
views::corewm::SetWindowVisibilityAnimationTransition(
login_window_->GetNativeView(),
views::corewm::ANIMATE_HIDE);
login_window_->SetContentsView(login_view_);
login_view_->UpdateWindowType();
// If WebUI is initialized in hidden state, show it only if we're no
// longer waiting for wallpaper animation/user images loading. Otherwise,
// always show it.
if (!initialize_webui_hidden_ ||
(!waiting_for_wallpaper_load_ && !waiting_for_user_pods_)) {
LOG(INFO) << "Login WebUI >> show login wnd on create";
login_window_->Show();
} else {
LOG(INFO) << "Login WebUI >> login wnd is hidden on create";
login_view_->set_is_hidden(true);
}
login_window_->GetNativeView()->SetName("WebUILoginView");
login_view_->OnWindowCreated();
}
// Subscribe to crash events. // Subscribe to crash events.
content::WebContentsObserver::Observe(login_view_->GetWebContents()); content::WebContentsObserver::Observe(login_view_->GetWebContents());
login_view_->LoadURL(url); login_view_->LoadURL(url);
...@@ -403,4 +360,75 @@ void WebUILoginDisplayHost::StartPostponedWebUI() { ...@@ -403,4 +360,75 @@ void WebUILoginDisplayHost::StartPostponedWebUI() {
} }
} }
void WebUILoginDisplayHost::InitLoginWindowAndView() {
if (login_window_)
return;
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
params.bounds = background_bounds();
params.show_state = ui::SHOW_STATE_FULLSCREEN;
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableNewOobe))
params.transparent = true;
params.parent =
ash::Shell::GetContainer(
ash::Shell::GetPrimaryRootWindow(),
ash::internal::kShellWindowId_LockScreenContainer);
login_window_ = new views::Widget;
login_window_->Init(params);
if (login_window_->GetNativeWindow()) {
aura::RootWindow* root = login_window_->GetNativeWindow()->GetRootWindow();
if (root) {
old_ignore_solo_window_frame_painter_policy_value_ =
root->GetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy);
root->SetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy,
true);
}
}
login_view_ = new WebUILoginView();
login_view_->Init(login_window_);
views::corewm::SetWindowVisibilityAnimationDuration(
login_window_->GetNativeView(),
base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs));
views::corewm::SetWindowVisibilityAnimationTransition(
login_window_->GetNativeView(),
views::corewm::ANIMATE_HIDE);
login_window_->SetContentsView(login_view_);
login_view_->UpdateWindowType();
// If WebUI is initialized in hidden state, show it only if we're no
// longer waiting for wallpaper animation/user images loading. Otherwise,
// always show it.
if (!initialize_webui_hidden_ ||
(!waiting_for_wallpaper_load_ && !waiting_for_user_pods_)) {
LOG(INFO) << "Login WebUI >> show login wnd on create";
login_window_->Show();
} else {
LOG(INFO) << "Login WebUI >> login wnd is hidden on create";
login_view_->set_is_hidden(true);
}
login_window_->GetNativeView()->SetName("WebUILoginView");
login_view_->OnWindowCreated();
}
void WebUILoginDisplayHost::ResetLoginWindowAndView() {
if (!login_window_)
return;
if (login_window_->GetNativeWindow()) {
aura::RootWindow* root = login_window_->GetNativeWindow()->GetRootWindow();
if (root) {
root->SetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy,
old_ignore_solo_window_frame_painter_policy_value_);
}
}
login_window_->Close();
login_window_ = NULL;
login_view_ = NULL;
}
} // namespace chromeos } // namespace chromeos
...@@ -74,6 +74,13 @@ class WebUILoginDisplayHost : public BaseLoginDisplayHost, ...@@ -74,6 +74,13 @@ class WebUILoginDisplayHost : public BaseLoginDisplayHost,
// wallpaper animation end. // wallpaper animation end.
void StartPostponedWebUI(); void StartPostponedWebUI();
// Initializes |login_window_| and |login_view_| fields if needed.
void InitLoginWindowAndView();
// Closes |login_window_| and resets |login_window_| and
// |login_view_| fields.
void ResetLoginWindowAndView();
// Container of the screen we are displaying. // Container of the screen we are displaying.
views::Widget* login_window_; views::Widget* login_window_;
...@@ -127,6 +134,10 @@ class WebUILoginDisplayHost : public BaseLoginDisplayHost, ...@@ -127,6 +134,10 @@ class WebUILoginDisplayHost : public BaseLoginDisplayHost,
std::string wizard_first_screen_name_; std::string wizard_first_screen_name_;
scoped_ptr<DictionaryValue> wizard_screen_parameters_; scoped_ptr<DictionaryValue> wizard_screen_parameters_;
// Old value of the ash::internal::kIgnoreSoloWindowFramePainterPolicy
// property of the root window for |login_window_|.
bool old_ignore_solo_window_frame_painter_policy_value_;
DISALLOW_COPY_AND_ASSIGN(WebUILoginDisplayHost); DISALLOW_COPY_AND_ASSIGN(WebUILoginDisplayHost);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment