Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chromeos/dbus/fake_session_manager_client.h

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_ 6 #define CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "chromeos/dbus/session_manager_client.h" 15 #include "chromeos/dbus/session_manager_client.h"
16 #include "components/user_manager/user_id.h"
16 17
17 namespace chromeos { 18 namespace chromeos {
18 19
19 // A fake implementation of session_manager. Accepts policy blobs to be set and 20 // A fake implementation of session_manager. Accepts policy blobs to be set and
20 // returns them unmodified. 21 // returns them unmodified.
21 class FakeSessionManagerClient : public SessionManagerClient { 22 class FakeSessionManagerClient : public SessionManagerClient {
22 public: 23 public:
23 FakeSessionManagerClient(); 24 FakeSessionManagerClient();
24 ~FakeSessionManagerClient() override; 25 ~FakeSessionManagerClient() override;
25 26
26 // SessionManagerClient overrides 27 // SessionManagerClient overrides
27 void Init(dbus::Bus* bus) override; 28 void Init(dbus::Bus* bus) override;
28 void SetStubDelegate(StubDelegate* delegate) override; 29 void SetStubDelegate(StubDelegate* delegate) override;
29 void AddObserver(Observer* observer) override; 30 void AddObserver(Observer* observer) override;
30 void RemoveObserver(Observer* observer) override; 31 void RemoveObserver(Observer* observer) override;
31 bool HasObserver(const Observer* observer) const override; 32 bool HasObserver(const Observer* observer) const override;
32 bool IsScreenLocked() const override; 33 bool IsScreenLocked() const override;
33 void EmitLoginPromptVisible() override; 34 void EmitLoginPromptVisible() override;
34 void RestartJob(int pid, const std::string& command_line) override; 35 void RestartJob(int pid, const std::string& command_line) override;
35 void StartSession(const std::string& user_email) override; 36 void StartSession(const user_manager::UserID& user_id) override;
36 void StopSession() override; 37 void StopSession() override;
37 void NotifySupervisedUserCreationStarted() override; 38 void NotifySupervisedUserCreationStarted() override;
38 void NotifySupervisedUserCreationFinished() override; 39 void NotifySupervisedUserCreationFinished() override;
39 void StartDeviceWipe() override; 40 void StartDeviceWipe() override;
40 void RequestLockScreen() override; 41 void RequestLockScreen() override;
41 void NotifyLockScreenShown() override; 42 void NotifyLockScreenShown() override;
42 void NotifyLockScreenDismissed() override; 43 void NotifyLockScreenDismissed() override;
43 void RetrieveActiveSessions(const ActiveSessionsCallback& callback) override; 44 void RetrieveActiveSessions(const ActiveSessionsCallback& callback) override;
44 void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) override; 45 void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) override;
45 void RetrievePolicyForUser(const std::string& username, 46 void RetrievePolicyForUser(const user_manager::UserID& user_id,
46 const RetrievePolicyCallback& callback) override; 47 const RetrievePolicyCallback& callback) override;
47 std::string BlockingRetrievePolicyForUser( 48 std::string BlockingRetrievePolicyForUser(
48 const std::string& username) override; 49 const user_manager::UserID& user_id) override;
49 void RetrieveDeviceLocalAccountPolicy( 50 void RetrieveDeviceLocalAccountPolicy(
50 const std::string& account_id, 51 const std::string& account_id,
51 const RetrievePolicyCallback& callback) override; 52 const RetrievePolicyCallback& callback) override;
52 void StoreDevicePolicy(const std::string& policy_blob, 53 void StoreDevicePolicy(const std::string& policy_blob,
53 const StorePolicyCallback& callback) override; 54 const StorePolicyCallback& callback) override;
54 void StorePolicyForUser(const std::string& username, 55 void StorePolicyForUser(const user_manager::UserID& user_id,
55 const std::string& policy_blob, 56 const std::string& policy_blob,
56 const StorePolicyCallback& callback) override; 57 const StorePolicyCallback& callback) override;
57 void StoreDeviceLocalAccountPolicy( 58 void StoreDeviceLocalAccountPolicy(
58 const std::string& account_id, 59 const std::string& account_id,
59 const std::string& policy_blob, 60 const std::string& policy_blob,
60 const StorePolicyCallback& callback) override; 61 const StorePolicyCallback& callback) override;
61 void SetFlagsForUser(const std::string& username, 62 void SetFlagsForUser(const user_manager::UserID& user_id,
62 const std::vector<std::string>& flags) override; 63 const std::vector<std::string>& flags) override;
63 void GetServerBackedStateKeys(const StateKeysCallback& callback) override; 64 void GetServerBackedStateKeys(const StateKeysCallback& callback) override;
64 65
65 const std::string& device_policy() const; 66 const std::string& device_policy() const;
66 void set_device_policy(const std::string& policy_blob); 67 void set_device_policy(const std::string& policy_blob);
67 68
68 const std::string& user_policy(const std::string& username) const; 69 const std::string& user_policy(const user_manager::UserID& user_id) const;
69 void set_user_policy(const std::string& username, 70 void set_user_policy(const user_manager::UserID& user_id,
70 const std::string& policy_blob); 71 const std::string& policy_blob);
71 72
72 const std::string& device_local_account_policy( 73 const std::string& device_local_account_policy(
73 const std::string& account_id) const; 74 const std::string& account_id) const;
74 void set_device_local_account_policy(const std::string& account_id, 75 void set_device_local_account_policy(const std::string& account_id,
75 const std::string& policy_blob); 76 const std::string& policy_blob);
76 77
77 // Notify observers about a property change completion. 78 // Notify observers about a property change completion.
78 void OnPropertyChangeComplete(bool success); 79 void OnPropertyChangeComplete(bool success);
79 80
(...skipping 13 matching lines...) Expand all
93 return notify_lock_screen_shown_call_count_; 94 return notify_lock_screen_shown_call_count_;
94 } 95 }
95 96
96 // Returns how many times LockScreenDismissed() was called. 97 // Returns how many times LockScreenDismissed() was called.
97 int notify_lock_screen_dismissed_call_count() const { 98 int notify_lock_screen_dismissed_call_count() const {
98 return notify_lock_screen_dismissed_call_count_; 99 return notify_lock_screen_dismissed_call_count_;
99 } 100 }
100 101
101 private: 102 private:
102 std::string device_policy_; 103 std::string device_policy_;
103 std::map<std::string, std::string> user_policies_; 104 std::map<user_manager::UserID, std::string> user_policies_;
104 std::map<std::string, std::string> device_local_account_policy_; 105 std::map<std::string, std::string> device_local_account_policy_;
105 ObserverList<Observer> observers_; 106 ObserverList<Observer> observers_;
106 SessionManagerClient::ActiveSessionsMap user_sessions_; 107 SessionManagerClient::ActiveSessionsMap user_sessions_;
107 std::vector<std::string> server_backed_state_keys_; 108 std::vector<std::string> server_backed_state_keys_;
108 109
109 int start_device_wipe_call_count_; 110 int start_device_wipe_call_count_;
110 int notify_lock_screen_shown_call_count_; 111 int notify_lock_screen_shown_call_count_;
111 int notify_lock_screen_dismissed_call_count_; 112 int notify_lock_screen_dismissed_call_count_;
112 113
113 DISALLOW_COPY_AND_ASSIGN(FakeSessionManagerClient); 114 DISALLOW_COPY_AND_ASSIGN(FakeSessionManagerClient);
114 }; 115 };
115 116
116 } // namespace chromeos 117 } // namespace chromeos
117 118
118 #endif // CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_ 119 #endif // CHROMEOS_DBUS_FAKE_SESSION_MANAGER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698