Home | History | Annotate | Download | only in ash
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "ash/session_state_delegate_stub.h"
      6 
      7 #include "ash/shell.h"
      8 #include "ash/shell/example_factory.h"
      9 #include "base/strings/string16.h"
     10 #include "base/strings/utf_string_conversions.h"
     11 
     12 namespace ash {
     13 
     14 SessionStateDelegateStub::SessionStateDelegateStub() : screen_locked_(false) {
     15 }
     16 
     17 SessionStateDelegateStub::~SessionStateDelegateStub() {
     18 }
     19 
     20 int SessionStateDelegateStub::GetMaximumNumberOfLoggedInUsers() const {
     21   return 3;
     22 }
     23 
     24 int SessionStateDelegateStub::NumberOfLoggedInUsers() const {
     25   return 1;
     26 }
     27 
     28 bool SessionStateDelegateStub::IsActiveUserSessionStarted() const {
     29   return true;
     30 }
     31 
     32 bool SessionStateDelegateStub::CanLockScreen() const {
     33   return true;
     34 }
     35 
     36 bool SessionStateDelegateStub::IsScreenLocked() const {
     37   return screen_locked_;
     38 }
     39 
     40 bool SessionStateDelegateStub::ShouldLockScreenBeforeSuspending() const {
     41   return false;
     42 }
     43 
     44 void SessionStateDelegateStub::LockScreen() {
     45   shell::CreateLockScreen();
     46   screen_locked_ = true;
     47   Shell::GetInstance()->UpdateShelfVisibility();
     48 }
     49 
     50 void SessionStateDelegateStub::UnlockScreen() {
     51   screen_locked_ = false;
     52   Shell::GetInstance()->UpdateShelfVisibility();
     53 }
     54 
     55 bool SessionStateDelegateStub::IsUserSessionBlocked() const  {
     56   return !IsActiveUserSessionStarted() || IsScreenLocked();
     57 }
     58 
     59 const base::string16 SessionStateDelegateStub::GetUserDisplayName(
     60     MultiProfileIndex index) const {
     61   return UTF8ToUTF16("stub-user");
     62 }
     63 
     64 const std::string SessionStateDelegateStub::GetUserEmail(
     65     MultiProfileIndex index) const {
     66   return "stub-user (at) domain.com";
     67 }
     68 
     69 const std::string SessionStateDelegateStub::GetUserID(
     70     MultiProfileIndex index) const {
     71   return GetUserEmail(index);
     72 }
     73 
     74 const gfx::ImageSkia& SessionStateDelegateStub::GetUserImage(
     75     MultiProfileIndex index) const {
     76   return null_image_;
     77 }
     78 
     79 void SessionStateDelegateStub::GetLoggedInUsers(UserIdList* users) {
     80 }
     81 
     82 void SessionStateDelegateStub::SwitchActiveUser(const std::string& user_id) {
     83 }
     84 
     85 void SessionStateDelegateStub::CycleActiveUser(CycleUser cycle_user) {
     86 }
     87 
     88 void SessionStateDelegateStub::AddSessionStateObserver(
     89     ash::SessionStateObserver* observer) {
     90 }
     91 
     92 void SessionStateDelegateStub::RemoveSessionStateObserver(
     93     ash::SessionStateObserver* observer) {
     94 }
     95 
     96 bool SessionStateDelegateStub::TransferWindowToDesktopOfUser(
     97     aura::Window* window,
     98     ash::MultiProfileIndex index) {
     99   return false;
    100 }
    101 
    102 }  // namespace ash
    103