summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-02 08:21:56 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-02 08:21:56 +0000
commitad2f5dff805493bf49ddd6634682bae4cf1dab87 (patch)
treec18f4bc3bc64dcbd028cc6939e08ac758ded68a0 /ash
parentf20cde9492f4431c27a55642c646af144c2001d1 (diff)
downloadchromium_src-ad2f5dff805493bf49ddd6634682bae4cf1dab87.zip
chromium_src-ad2f5dff805493bf49ddd6634682bae4cf1dab87.tar.gz
chromium_src-ad2f5dff805493bf49ddd6634682bae4cf1dab87.tar.bz2
Create Launcher after shell is initialized because this is how chromeos build works.
Make sure login happens after ash is created. BUG=none Review URL: https://chromiumcodereview.appspot.com/16305009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209649 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/shelf/shelf_widget.cc2
-rw-r--r--ash/shell.cc10
-rw-r--r--ash/shell/content_client/shell_browser_main_parts.cc4
-rw-r--r--ash/shell/window_watcher_unittest.cc6
-rw-r--r--ash/test/ash_test_helper.cc6
-rw-r--r--ash/test/test_session_state_delegate.cc24
-rw-r--r--ash/test/test_session_state_delegate.h2
7 files changed, 37 insertions, 17 deletions
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc
index 7387cde..223d034 100644
--- a/ash/shelf/shelf_widget.cc
+++ b/ash/shelf/shelf_widget.cc
@@ -518,9 +518,7 @@ void ShelfWidget::CreateLauncher() {
launcher_->SetVisible(
shell->session_state_delegate()->IsActiveUserSessionStarted());
-
shelf_layout_manager_->LayoutShelf();
-
Show();
}
diff --git a/ash/shell.cc b/ash/shell.cc
index 3f451df..5dec24f 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -849,11 +849,7 @@ SystemTray* Shell::GetPrimarySystemTray() {
LauncherDelegate* Shell::GetLauncherDelegate() {
if (!launcher_delegate_) {
- if (!launcher_model_)
- launcher_model_.reset(new LauncherModel);
- // Attempt to create the Launcher. This may fail if the application is not
- // ready to create it yet, in which case the app is responsible for calling
- // ash::Shell::CreateLauncher() when ready.
+ launcher_model_.reset(new LauncherModel);
launcher_delegate_.reset(
delegate_->CreateLauncherDelegate(launcher_model_.get()));
}
@@ -893,6 +889,10 @@ void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) {
root->ShowRootWindow();
// Activate new root for testing.
active_root_window_ = root;
+
+ // Create a launcher if a user is already logged.
+ if (Shell::GetInstance()->session_state_delegate()->NumberOfLoggedInUsers())
+ controller->shelf()->CreateLauncher();
}
void Shell::DoInitialWorkspaceAnimation() {
diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc
index 940384d..ee89ebb 100644
--- a/ash/shell/content_client/shell_browser_main_parts.cc
+++ b/ash/shell/content_client/shell_browser_main_parts.cc
@@ -9,6 +9,7 @@
#include "ash/shell.h"
#include "ash/shell/shell_delegate_impl.h"
#include "ash/shell/window_watcher.h"
+#include "ash/system/user/login_status.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/i18n/icu_util.h"
@@ -121,6 +122,9 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() {
ash::Shell::CreateInstance(delegate_);
ash::Shell::GetInstance()->set_browser_context(browser_context_.get());
+ ash::Shell::GetInstance()->CreateLauncher();
+ ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(
+ user::LOGGED_IN_USER);
window_watcher_.reset(new ash::shell::WindowWatcher);
gfx::Screen* screen = Shell::GetInstance()->GetScreen();
diff --git a/ash/shell/window_watcher_unittest.cc b/ash/shell/window_watcher_unittest.cc
index e35ba62..dfc7e6b 100644
--- a/ash/shell/window_watcher_unittest.cc
+++ b/ash/shell/window_watcher_unittest.cc
@@ -7,6 +7,7 @@
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/shell/shell_delegate_impl.h"
+#include "ash/system/user/login_status.h"
#include "ash/test/ash_test_base.h"
#include "ui/aura/root_window.h"
@@ -22,8 +23,11 @@ TEST_F(WindowWatcherTest, ShellDeleteInstance) {
shell::ShellDelegateImpl* delegate = new ash::shell::ShellDelegateImpl;
Shell::CreateInstance(delegate);
-
Shell::GetPrimaryRootWindow()->ShowRootWindow();
+ Shell::GetInstance()->CreateLauncher();
+ Shell::GetInstance()->UpdateAfterLoginStatusChange(
+ user::LOGGED_IN_USER);
+
window_watcher.reset(new ash::shell::WindowWatcher);
delegate->SetWatcher(window_watcher.get());
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc
index 39d1090..84d28c5 100644
--- a/ash/test/ash_test_helper.cc
+++ b/ash/test/ash_test_helper.cc
@@ -8,6 +8,7 @@
#include "ash/shell.h"
#include "ash/test/display_manager_test_api.h"
#include "ash/test/shell_test_api.h"
+#include "ash/test/test_session_state_delegate.h"
#include "ash/test/test_shell_delegate.h"
#include "base/run_loop.h"
#include "ui/aura/env.h"
@@ -61,10 +62,13 @@ void AshTestHelper::SetUp() {
ash::Shell::CreateInstance(test_shell_delegate_);
Shell* shell = Shell::GetInstance();
+ test_shell_delegate_->test_session_state_delegate()->
+ SetActiveUserSessionStarted(true);
+ test_shell_delegate_->test_session_state_delegate()->SetHasActiveUser(true);
+
test::DisplayManagerTestApi(shell->display_manager()).
DisableChangeDisplayUponHostResize();
ShellTestApi(shell).DisableOutputConfiguratorAnimation();
-
}
void AshTestHelper::TearDown() {
diff --git a/ash/test/test_session_state_delegate.cc b/ash/test/test_session_state_delegate.cc
index a8ee01e..7af9e3c 100644
--- a/ash/test/test_session_state_delegate.cc
+++ b/ash/test/test_session_state_delegate.cc
@@ -4,6 +4,8 @@
#include "ash/test/test_session_state_delegate.h"
+#include "ash/shell.h"
+#include "ash/system/user/login_status.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
@@ -11,8 +13,8 @@ namespace ash {
namespace test {
TestSessionStateDelegate::TestSessionStateDelegate()
- : has_active_user_(true),
- active_user_session_started_(true),
+ : has_active_user_(false),
+ active_user_session_started_(false),
can_lock_screen_(true),
screen_locked_(false),
logged_in_users_(1) {
@@ -55,13 +57,19 @@ void TestSessionStateDelegate::SetHasActiveUser(bool has_active_user) {
has_active_user_ = has_active_user;
if (!has_active_user)
active_user_session_started_ = false;
+ else
+ Shell::GetInstance()->ShowLauncher();
}
void TestSessionStateDelegate::SetActiveUserSessionStarted(
bool active_user_session_started) {
active_user_session_started_ = active_user_session_started;
- if (active_user_session_started)
+ if (active_user_session_started) {
has_active_user_ = true;
+ Shell::GetInstance()->CreateLauncher();
+ Shell::GetInstance()->UpdateAfterLoginStatusChange(
+ user::LOGGED_IN_USER);
+ }
}
void TestSessionStateDelegate::SetCanLockScreen(bool can_lock_screen) {
@@ -69,12 +77,12 @@ void TestSessionStateDelegate::SetCanLockScreen(bool can_lock_screen) {
}
const base::string16 TestSessionStateDelegate::GetUserDisplayName(
- ash::MultiProfileIndex index) const {
+ MultiProfileIndex index) const {
return UTF8ToUTF16("Über tray Über tray Über tray Über tray");
}
const std::string TestSessionStateDelegate::GetUserEmail(
- ash::MultiProfileIndex index) const {
+ MultiProfileIndex index) const {
switch (index) {
case 0: return "first@tray";
case 1: return "second@tray";
@@ -84,7 +92,7 @@ const std::string TestSessionStateDelegate::GetUserEmail(
}
const gfx::ImageSkia& TestSessionStateDelegate::GetUserImage(
- ash::MultiProfileIndex index) const {
+ MultiProfileIndex index) const {
return null_image_;
}
@@ -96,11 +104,11 @@ void TestSessionStateDelegate::SwitchActiveUser(const std::string& email) {
}
void TestSessionStateDelegate::AddSessionStateObserver(
- ash::SessionStateObserver* observer) {
+ SessionStateObserver* observer) {
}
void TestSessionStateDelegate::RemoveSessionStateObserver(
- ash::SessionStateObserver* observer) {
+ SessionStateObserver* observer) {
}
} // namespace test
diff --git a/ash/test/test_session_state_delegate.h b/ash/test/test_session_state_delegate.h
index 17062d5..f9466ff 100644
--- a/ash/test/test_session_state_delegate.h
+++ b/ash/test/test_session_state_delegate.h
@@ -42,6 +42,8 @@ class TestSessionStateDelegate : public SessionStateDelegate {
virtual void RemoveSessionStateObserver(
ash::SessionStateObserver* observer) OVERRIDE;
+ // TODO(oshima): Use state machine instead of using boolean variables.
+
// Updates the internal state that indicates whether a session is in progress
// and there is an active user. If |has_active_user| is |false|,
// |active_user_session_started_| is reset to |false| as well (see below for