diff options
-rw-r--r-- | ash/launcher/launcher.cc | 5 | ||||
-rw-r--r-- | ash/launcher/launcher.h | 2 | ||||
-rw-r--r-- | ash/shell.cc | 8 | ||||
-rw-r--r-- | ash/shell.h | 3 | ||||
-rw-r--r-- | ash/shell/shell_delegate_impl.cc | 4 | ||||
-rw-r--r-- | ash/shell/shell_delegate_impl.h | 1 | ||||
-rw-r--r-- | ash/shell_delegate.h | 3 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.cc | 4 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.h | 1 | ||||
-rw-r--r-- | chrome/browser/ui/views/ash/chrome_shell_delegate.cc | 16 | ||||
-rw-r--r-- | chrome/browser/ui/views/ash/chrome_shell_delegate.h | 1 |
11 files changed, 47 insertions, 1 deletions
diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc index 8475097..954da7e 100644 --- a/ash/launcher/launcher.cc +++ b/ash/launcher/launcher.cc @@ -136,7 +136,6 @@ Launcher::Launcher(aura::Window* window_container, // The launcher should not take focus when it is initially shown. widget_->set_focus_on_creation(false); widget_->SetContentsView(delegate_view_); - widget_->Show(); widget_->GetNativeView()->SetName("LauncherView"); } @@ -217,6 +216,10 @@ bool Launcher::IsShowingOverflowBubble() const { return launcher_view_->IsShowingOverflowBubble(); } +void Launcher::SetVisible(bool visible) const { + delegate_view_->SetVisible(visible); +} + views::View* Launcher::GetAppListButtonView() const { return launcher_view_->GetAppListButtonView(); } diff --git a/ash/launcher/launcher.h b/ash/launcher/launcher.h index 8ee093a..3b5cbc6 100644 --- a/ash/launcher/launcher.h +++ b/ash/launcher/launcher.h @@ -80,6 +80,8 @@ class ASH_EXPORT Launcher : public internal::BackgroundAnimatorDelegate { bool IsShowingOverflowBubble() const; + void SetVisible(bool visible) const; + views::View* GetAppListButtonView() const; // Only to be called for testing. Retrieves the LauncherView. diff --git a/ash/shell.cc b/ash/shell.cc index 77678e0..9663ff9 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -604,9 +604,17 @@ void Shell::CreateLauncher() { if (panel_layout_manager_) panel_layout_manager_->SetLauncher(launcher_.get()); + if (delegate()) + launcher_->SetVisible(delegate()->IsSessionStarted()); launcher_->widget()->Show(); } +void Shell::ShowLauncher() { + if (!launcher_.get()) + return; + launcher_->SetVisible(true); +} + void Shell::AddShellObserver(ShellObserver* observer) { observers_.AddObserver(observer); } diff --git a/ash/shell.h b/ash/shell.h index f2fad34..be066b6 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -239,6 +239,9 @@ class ASH_EXPORT Shell : aura::CursorDelegate { // Initializes |launcher_|. Does nothing if it's already initialized. void CreateLauncher(); + // Show launcher view if it was created hidden (before session has started). + void ShowLauncher(); + // Adds/removes observer. void AddShellObserver(ShellObserver* observer); void RemoveShellObserver(ShellObserver* observer); diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index 9accbd6..f32d55a 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc @@ -35,6 +35,10 @@ bool ShellDelegateImpl::IsUserLoggedIn() { return true; } +bool ShellDelegateImpl::IsSessionStarted() { + return true; +} + void ShellDelegateImpl::LockScreen() { ash::shell::CreateLockScreen(); locked_ = true; diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h index 2216c92d..0dd1aa4 100644 --- a/ash/shell/shell_delegate_impl.h +++ b/ash/shell/shell_delegate_impl.h @@ -22,6 +22,7 @@ class ShellDelegateImpl : public ash::ShellDelegate { void SetWatcher(WindowWatcher* watcher); virtual bool IsUserLoggedIn() OVERRIDE; + virtual bool IsSessionStarted() OVERRIDE; virtual void LockScreen() OVERRIDE; virtual void UnlockScreen() OVERRIDE; virtual bool IsScreenLocked() const OVERRIDE; diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index 02389fa..887b246 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h @@ -46,6 +46,9 @@ class ASH_EXPORT ShellDelegate { // Returns true if user has logged in. virtual bool IsUserLoggedIn() = 0; + // Returns true if we're logged in and browser has been started + virtual bool IsSessionStarted() = 0; + // Invoked when a user locks the screen. virtual void LockScreen() = 0; diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index cf5ccd3..ec0e40b 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -29,6 +29,10 @@ bool TestShellDelegate::IsUserLoggedIn() { return true; } +bool TestShellDelegate::IsSessionStarted() { + return true; +} + void TestShellDelegate::LockScreen() { locked_ = true; } diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h index b929822..6b97fee 100644 --- a/ash/test/test_shell_delegate.h +++ b/ash/test/test_shell_delegate.h @@ -18,6 +18,7 @@ class TestShellDelegate : public ShellDelegate { // Overridden from ShellDelegate: virtual bool IsUserLoggedIn() OVERRIDE; + virtual bool IsSessionStarted() OVERRIDE; virtual void LockScreen() OVERRIDE; virtual void UnlockScreen() OVERRIDE; virtual bool IsScreenLocked() const OVERRIDE; diff --git a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc index 7840c53..0b2434c 100644 --- a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc @@ -75,6 +75,10 @@ ChromeShellDelegate::ChromeShellDelegate() this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, content::NotificationService::AllSources()); + registrar_.Add( + this, + chrome::NOTIFICATION_SESSION_STARTED, + content::NotificationService::AllSources()); #endif } @@ -99,6 +103,15 @@ bool ChromeShellDelegate::IsUserLoggedIn() { #endif } + // Returns true if we're logged in and browser has been started +bool ChromeShellDelegate::IsSessionStarted() { +#if defined(OS_CHROMEOS) + return chromeos::UserManager::Get()->IsSessionStarted(); +#else + return true; +#endif +} + void ChromeShellDelegate::LockScreen() { #if defined(OS_CHROMEOS) if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession) && @@ -336,6 +349,9 @@ void ChromeShellDelegate::Observe(int type, case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: ash::Shell::GetInstance()->CreateLauncher(); break; + case chrome::NOTIFICATION_SESSION_STARTED: + ash::Shell::GetInstance()->ShowLauncher(); + break; default: NOTREACHED() << "Unexpected notification " << type; } diff --git a/chrome/browser/ui/views/ash/chrome_shell_delegate.h b/chrome/browser/ui/views/ash/chrome_shell_delegate.h index c1afb14..7479272 100644 --- a/chrome/browser/ui/views/ash/chrome_shell_delegate.h +++ b/chrome/browser/ui/views/ash/chrome_shell_delegate.h @@ -31,6 +31,7 @@ class ChromeShellDelegate : public ash::ShellDelegate, // ash::ShellDelegate overrides; virtual bool IsUserLoggedIn() OVERRIDE; + virtual bool IsSessionStarted() OVERRIDE; virtual void LockScreen() OVERRIDE; virtual void UnlockScreen() OVERRIDE; virtual bool IsScreenLocked() const OVERRIDE; |