Index: ui/aura_shell/shell.cc |
diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc |
index 406215edf0c8b29e878f604d4eda60f520fb529d..862d497981adff4661f46bedd7d1a419c6cc982e 100644 |
--- a/ui/aura_shell/shell.cc |
+++ b/ui/aura_shell/shell.cc |
@@ -4,6 +4,8 @@ |
#include "ui/aura_shell/shell.h" |
+#include <algorithm> |
+ |
#include "base/bind.h" |
#include "base/command_line.h" |
#include "ui/aura/aura_switches.h" |
@@ -281,6 +283,31 @@ void Shell::ToggleAppList() { |
app_list_->SetVisible(!app_list_->IsVisible()); |
} |
+// Returns true if the screen is locked. |
+bool Shell::IsScreenLocked() const { |
+ const aura::Window* lock_screen_container = GetContainer( |
+ internal::kShellWindowId_LockScreenContainer); |
+ const aura::Window::Windows& lock_screen_windows = |
+ lock_screen_container->children(); |
+ aura::Window::Windows::const_iterator lock_screen_it = |
+ std::find_if(lock_screen_windows.begin(), lock_screen_windows.end(), |
+ std::mem_fun(&aura::Window::IsVisible)); |
+ if (lock_screen_it != lock_screen_windows.end()) |
+ return true; |
+ |
+ const aura::Window* lock_modal_container = GetContainer( |
Ben Goodger (Google)
2011/12/11 21:54:05
I don't believe it's possible to return true from
mazda
2011/12/12 04:53:33
This returns true in the line 240 of shell_unittes
|
+ internal::kShellWindowId_LockModalContainer); |
+ const aura::Window::Windows& lock_modal_windows = |
+ lock_modal_container->children(); |
+ aura::Window::Windows::const_iterator lock_modal_it = |
+ std::find_if(lock_modal_windows.begin(), lock_modal_windows.end(), |
+ std::mem_fun(&aura::Window::IsVisible)); |
+ if (lock_modal_it != lock_modal_windows.end()) |
+ return true; |
+ |
+ return false; |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// Shell, private: |