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

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: r3b@$3 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
« no previous file with comments | « chromeos/dbus/fake_session_manager_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
87 const std::string& policy_blob,
88 const StorePolicyCallback& callback) {
89 device_policy_ = policy_blob;
90 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
91 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
92 }
93
94 void FakeSessionManagerClient::StoreUserPolicy(
95 const std::string& policy_blob,
96 const StorePolicyCallback& callback) {
97 user_policy_ = policy_blob;
98 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
99 }
100
101 void FakeSessionManagerClient::StoreDeviceLocalAccountPolicy(
102 const std::string& account_id,
103 const std::string& policy_blob,
104 const StorePolicyCallback& callback) {
105 device_local_account_policy_[account_id] = policy_blob;
106 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
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 }
117
118 const std::string& FakeSessionManagerClient::user_policy() const {
119 return user_policy_;
120 }
121
122 void FakeSessionManagerClient::set_user_policy(const std::string& policy_blob) {
123 user_policy_ = policy_blob;
124 }
125
126 const std::string& FakeSessionManagerClient::device_local_account_policy(
127 const std::string& account_id) const {
128 std::map<std::string, std::string>::const_iterator entry =
129 device_local_account_policy_.find(account_id);
130 return entry != device_local_account_policy_.end() ? entry->second
131 : EmptyString();
132 }
133
134 void FakeSessionManagerClient::set_device_local_account_policy(
135 const std::string& account_id,
136 const std::string& policy_blob) {
137 device_local_account_policy_[account_id] = policy_blob;
138 }
139
140 void FakeSessionManagerClient::OnPropertyChangeComplete(bool success) {
141 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(success));
142 }
143
144 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_session_manager_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698