1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78

ash / public / cpp / session / session_controller_client.h [blame]

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_PUBLIC_CPP_SESSION_SESSION_CONTROLLER_CLIENT_H_
#define ASH_PUBLIC_CPP_SESSION_SESSION_CONTROLLER_CLIENT_H_

#include "ash/public/cpp/ash_public_export.h"
#include "ash/public/cpp/session/session_controller.h"
#include "ash/public/cpp/session/session_types.h"
#include "base/files/file_path.h"
#include "components/account_id/account_id.h"

class AccountId;
class PrefService;

namespace ash {

class ASH_PUBLIC_EXPORT SessionControllerClient {
 public:
  // Requests to lock screen.
  virtual void RequestLockScreen() = 0;

  // Requests to dismiss the lock screen.
  virtual void RequestHideLockScreen() = 0;

  // Requests signing out all users, ending the current session.
  virtual void RequestSignOut() = 0;

  // Requests to restart the system for OS update.
  virtual void RequestRestartForUpdate() = 0;

  // Attempts to restart the chrome browser.
  virtual void AttemptRestartChrome() = 0;

  // Switch to the active user with `account_id` (if the user has already signed
  // in).
  virtual void SwitchActiveUser(const AccountId& account_id) = 0;

  // Switch the active user to the next or previous user.
  virtual void CycleActiveUser(CycleUserDirection direction) = 0;

  // Show the multi-profile login UI to add another user to this session.
  virtual void ShowMultiProfileLogin() = 0;

  // Emits the ash-initialized upstart signal to start Chrome OS tasks that
  // expect that Ash is listening to D-Bus signals they emit.
  virtual void EmitAshInitialized() = 0;

  // Returns the sign-in screen pref service if available.
  virtual PrefService* GetSigninScreenPrefService() = 0;

  // Returns the pref service for the given user if available.
  virtual PrefService* GetUserPrefService(const AccountId& account_id) = 0;

  // Returns the profile path for `account_id` or empty if one does not exist.
  virtual base::FilePath GetProfilePath(const AccountId& account_id) = 0;

  // Returns a tuple of whether
  // <IsVcBackgroundSupported, IsVcBackgroundAllowedByEnterprise>.
  // TODO(b/333767964): this is only a temporary solution. Having a function
  // here for each project does not sound ideal; this should be replaced with
  // more general approach.
  virtual std::tuple<bool, bool> IsEligibleForSeaPen(
      const AccountId& account_id) = 0;

  // Return the number of users that have previously logged in on the device.
  // Returns nullopt in the event where we cannot query the number of existing
  // users, for instance, when `UserManager` is uninitialized.
  virtual std::optional<int> GetExistingUsersCount() const = 0;

 protected:
  virtual ~SessionControllerClient() = default;
};

}  // namespace ash

#endif  // ASH_PUBLIC_CPP_SESSION_SESSION_CONTROLLER_CLIENT_H_