Chromium Code Reviews

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: split out FakeSessionManagerClient Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
bartfab (slow) 2013/02/25 16:51:23 Since this is a new file, it should be (c) 2013.
dconnelly 2013/02/26 18:04:15 Done.
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/message_loop.h"
9 #include "base/string_util.h"
10
11 namespace chromeos {
12
13 FakeSessionManagerClient::FakeSessionManagerClient() {}
14
15 FakeSessionManagerClient::~FakeSessionManagerClient() {}
16
17 void FakeSessionManagerClient::AddObserver(Observer* observer) OVERRIDE {
bartfab (slow) 2013/02/25 16:51:23 You should only be specifying OVERRIDE in declarat
dconnelly 2013/02/26 18:04:15 Done.
18 observers_.AddObserver(observer);
19 }
20 void FakeSessionManagerClient::RemoveObserver(Observer* observer) OVERRIDE {
bartfab (slow) 2013/02/25 16:51:23 Since these methods moved to a proper source file
dconnelly 2013/02/26 18:04:15 Done.
21 observers_.RemoveObserver(observer);
22 }
23 bool FakeSessionManagerClient::HasObserver(Observer* observer) OVERRIDE {
24 return observers_.HasObserver(observer);
25 }
26 void FakeSessionManagerClient::EmitLoginPromptReady() OVERRIDE {}
27 void FakeSessionManagerClient::EmitLoginPromptVisible() OVERRIDE {}
28 void FakeSessionManagerClient::RestartJob(
29 int pid, const std::string& command_line) OVERRIDE {}
30 void FakeSessionManagerClient::RestartEntd() OVERRIDE {}
31 void FakeSessionManagerClient::StartSession(
32 const std::string& user_email) OVERRIDE {}
33 void FakeSessionManagerClient::StopSession() OVERRIDE {}
34 void FakeSessionManagerClient::StartDeviceWipe() OVERRIDE {}
35 void FakeSessionManagerClient::RequestLockScreen() OVERRIDE {}
36 void FakeSessionManagerClient::NotifyLockScreenShown() OVERRIDE {}
37 void FakeSessionManagerClient::RequestUnlockScreen() OVERRIDE {}
38 void FakeSessionManagerClient::NotifyLockScreenDismissed() OVERRIDE {}
39 void FakeSessionManagerClient::RetrieveDevicePolicy(
40 const RetrievePolicyCallback& callback) OVERRIDE {
41 MessageLoop::current()->PostTask(FROM_HERE,
bartfab (slow) 2013/02/25 16:51:23 #include "base/location.h" for this
dconnelly 2013/02/26 18:04:15 Done.
42 base::Bind(callback, device_policy_));
43 }
44 void FakeSessionManagerClient::RetrieveUserPolicy(
45 const RetrievePolicyCallback& callback) OVERRIDE {
46 MessageLoop::current()->PostTask(FROM_HERE,
47 base::Bind(callback, user_policy_));
48 }
49 void FakeSessionManagerClient::RetrieveDeviceLocalAccountPolicy(
50 const std::string& account_id,
51 const RetrievePolicyCallback& callback) OVERRIDE {
52 MessageLoop::current()->PostTask(
53 FROM_HERE,
54 base::Bind(callback, device_local_account_policy_[account_id]));
55 }
56 void FakeSessionManagerClient::StoreDevicePolicy(const std::string& policy_blob,
57 const StorePolicyCallback& callback) OVERRIDE {
58 device_policy_ = policy_blob;
59 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
60 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
61 }
62 void FakeSessionManagerClient::StoreUserPolicy(const std::string& policy_blob,
63 const StorePolicyCallback& callback) OVERRIDE {
64 user_policy_ = policy_blob;
65 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
66 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
67 }
68 void FakeSessionManagerClient::StoreDeviceLocalAccountPolicy(
69 const std::string& account_id,
70 const std::string& policy_blob,
71 const StorePolicyCallback& callback) OVERRIDE {
72 device_local_account_policy_[account_id] = policy_blob;
73 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
74 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
75 }
76
77 const std::string& FakeSessionManagerClient::device_policy() const {
78 return device_policy_;
79 }
80 void FakeSessionManagerClient::set_device_policy(
81 const std::string& policy_blob) {
82 device_policy_ = policy_blob;
83 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
84 }
85
86 const std::string& FakeSessionManagerClient::user_policy() const {
87 return user_policy_;
88 }
89 void FakeSessionManagerClient::set_user_policy(const std::string& policy_blob) {
90 user_policy_ = policy_blob;
91 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
92 }
93
94 const std::string& FakeSessionManagerClient::device_local_account_policy(
95 const std::string& account_id) const {
96 std::map<std::string, std::string>::const_iterator entry =
97 device_local_account_policy_.find(account_id);
98 return entry != device_local_account_policy_.end() ? entry->second
99 : EmptyString();
100 }
101 void FakeSessionManagerClient::set_device_local_account_policy(
102 const std::string& account_id,
103 const std::string& policy_blob) {
104 device_local_account_policy_[account_id] = policy_blob;
105 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
106 }
107
108 } // namespace chromeos
OLDNEW
« chromeos/dbus/fake_session_manager_client.h ('K') | « chromeos/dbus/fake_session_manager_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine