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

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

Issue 12218078: Implement a policy to autologin a public account. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove NotificationWatcher from content/ Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chromeos/dbus/fake_session_manager_client.h"
6
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/message_loop.h"
10 #include "base/string_util.h"
11
12 namespace chromeos {
13
14 FakeSessionManagerClient::FakeSessionManagerClient() {
15 }
16
17 FakeSessionManagerClient::~FakeSessionManagerClient() {
18 }
19
20 void FakeSessionManagerClient::AddObserver(Observer* observer) {
21 observers_.AddObserver(observer);
22 }
23
24 void FakeSessionManagerClient::RemoveObserver(Observer* observer) {
25 observers_.RemoveObserver(observer);
26 }
27
28 bool FakeSessionManagerClient::HasObserver(Observer* observer) {
29 return observers_.HasObserver(observer);
30 }
31
32 void FakeSessionManagerClient::EmitLoginPromptReady() {
33 }
34
35 void FakeSessionManagerClient::EmitLoginPromptVisible() {
36 }
37
38 void FakeSessionManagerClient::RestartJob(int pid,
39 const std::string& command_line) {
40 }
41
42 void FakeSessionManagerClient::RestartEntd() {
43 }
44
45 void FakeSessionManagerClient::StartSession(const std::string& user_email) {
46 }
47
48 void FakeSessionManagerClient::StopSession() {
49 }
50
51 void FakeSessionManagerClient::StartDeviceWipe() {
52 }
53
54 void FakeSessionManagerClient::RequestLockScreen() {
55 }
56
57 void FakeSessionManagerClient::NotifyLockScreenShown() {
58 }
59
60 void FakeSessionManagerClient::RequestUnlockScreen() {
61 }
62
63 void FakeSessionManagerClient::NotifyLockScreenDismissed() {
64 }
65
66 void FakeSessionManagerClient::RetrieveDevicePolicy(
67 const RetrievePolicyCallback& callback) {
68 MessageLoop::current()->PostTask(FROM_HERE,
69 base::Bind(callback, device_policy_));
70 }
71
72 void FakeSessionManagerClient::RetrieveUserPolicy(
73 const RetrievePolicyCallback& callback) {
74 MessageLoop::current()->PostTask(FROM_HERE,
75 base::Bind(callback, user_policy_));
76 }
77
78 void FakeSessionManagerClient::RetrieveDeviceLocalAccountPolicy(
79 const std::string& account_id,
80 const RetrievePolicyCallback& callback) {
81 MessageLoop::current()->PostTask(
82 FROM_HERE,
83 base::Bind(callback, device_local_account_policy_[account_id]));
84 }
85
86 void FakeSessionManagerClient::StoreDevicePolicy(const std::string& policy_blob,
87 const StorePolicyCallback& callback) {
Mattias Nissler (ping if slow) 2013/03/11 16:26:59 nit: indentation
dconnelly 2013/03/11 17:34:32 Done.
88 device_policy_ = policy_blob;
89 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
90 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
91 }
92
93 void FakeSessionManagerClient::StoreUserPolicy(const std::string& policy_blob,
94 const StorePolicyCallback& callback) {
Mattias Nissler (ping if slow) 2013/03/11 16:26:59 nit: indentation
dconnelly 2013/03/11 17:34:32 Done.
95 user_policy_ = policy_blob;
96 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
97 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
Mattias Nissler (ping if slow) 2013/03/11 16:26:59 This shouldn't send PropertyChangeComplete, that s
dconnelly 2013/03/11 17:34:32 Done.
98 }
99
100 void FakeSessionManagerClient::StoreDeviceLocalAccountPolicy(
101 const std::string& account_id,
102 const std::string& policy_blob,
103 const StorePolicyCallback& callback) {
104 device_local_account_policy_[account_id] = policy_blob;
105 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
106 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
Mattias Nissler (ping if slow) 2013/03/11 16:26:59 ditto
dconnelly 2013/03/11 17:34:32 Done.
107 }
108
109 const std::string& FakeSessionManagerClient::device_policy() const {
110 return device_policy_;
111 }
112
113 void FakeSessionManagerClient::set_device_policy(
114 const std::string& policy_blob) {
115 device_policy_ = policy_blob;
116 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
Mattias Nissler (ping if slow) 2013/03/11 16:26:59 Not sure this is a good idea for existing tests, i
dconnelly 2013/03/11 17:34:32 Done.
117 }
118
119 const std::string& FakeSessionManagerClient::user_policy() const {
120 return user_policy_;
121 }
122
123 void FakeSessionManagerClient::set_user_policy(const std::string& policy_blob) {
124 user_policy_ = policy_blob;
125 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
Mattias Nissler (ping if slow) 2013/03/11 16:26:59 only for device policy again
dconnelly 2013/03/11 17:34:32 Done.
126 }
127
128 const std::string& FakeSessionManagerClient::device_local_account_policy(
129 const std::string& account_id) const {
130 std::map<std::string, std::string>::const_iterator entry =
131 device_local_account_policy_.find(account_id);
132 return entry != device_local_account_policy_.end() ? entry->second
133 : EmptyString();
134 }
135
136 void FakeSessionManagerClient::set_device_local_account_policy(
137 const std::string& account_id,
138 const std::string& policy_blob) {
139 device_local_account_policy_[account_id] = policy_blob;
140 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
Mattias Nissler (ping if slow) 2013/03/11 16:26:59 ditto
dconnelly 2013/03/11 17:34:32 Done.
141 }
142
143 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698