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

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

Issue 15774005: chromeos: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/fake_gsm_sms_client.cc ('k') | chromeos/dbus/gsm_sms_client_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chromeos/dbus/fake_session_manager_client.h" 5 #include "chromeos/dbus/fake_session_manager_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 void FakeSessionManagerClient::RequestUnlockScreen() { 70 void FakeSessionManagerClient::RequestUnlockScreen() {
71 } 71 }
72 72
73 void FakeSessionManagerClient::NotifyLockScreenDismissed() { 73 void FakeSessionManagerClient::NotifyLockScreenDismissed() {
74 notify_lock_screen_dismissed_call_count_++; 74 notify_lock_screen_dismissed_call_count_++;
75 } 75 }
76 76
77 void FakeSessionManagerClient::RetrieveActiveSessions( 77 void FakeSessionManagerClient::RetrieveActiveSessions(
78 const ActiveSessionsCallback& callback) { 78 const ActiveSessionsCallback& callback) {
79 MessageLoop::current()->PostTask(FROM_HERE, 79 base::MessageLoop::current()->PostTask(
80 base::Bind(callback, 80 FROM_HERE, base::Bind(callback, user_sessions_, true));
81 user_sessions_,
82 true));
83 } 81 }
84 82
85 void FakeSessionManagerClient::RetrieveDevicePolicy( 83 void FakeSessionManagerClient::RetrieveDevicePolicy(
86 const RetrievePolicyCallback& callback) { 84 const RetrievePolicyCallback& callback) {
87 MessageLoop::current()->PostTask(FROM_HERE, 85 base::MessageLoop::current()->PostTask(FROM_HERE,
88 base::Bind(callback, device_policy_)); 86 base::Bind(callback, device_policy_));
89 } 87 }
90 88
91 void FakeSessionManagerClient::RetrievePolicyForUser( 89 void FakeSessionManagerClient::RetrievePolicyForUser(
92 const std::string& username, 90 const std::string& username,
93 const RetrievePolicyCallback& callback) { 91 const RetrievePolicyCallback& callback) {
94 MessageLoop::current()->PostTask( 92 base::MessageLoop::current()->PostTask(
95 FROM_HERE, base::Bind(callback, user_policies_[username])); 93 FROM_HERE, base::Bind(callback, user_policies_[username]));
96 } 94 }
97 95
98 void FakeSessionManagerClient::RetrieveDeviceLocalAccountPolicy( 96 void FakeSessionManagerClient::RetrieveDeviceLocalAccountPolicy(
99 const std::string& account_id, 97 const std::string& account_id,
100 const RetrievePolicyCallback& callback) { 98 const RetrievePolicyCallback& callback) {
101 MessageLoop::current()->PostTask( 99 base::MessageLoop::current()->PostTask(
102 FROM_HERE, 100 FROM_HERE,
103 base::Bind(callback, device_local_account_policy_[account_id])); 101 base::Bind(callback, device_local_account_policy_[account_id]));
104 } 102 }
105 103
106 void FakeSessionManagerClient::StoreDevicePolicy( 104 void FakeSessionManagerClient::StoreDevicePolicy(
107 const std::string& policy_blob, 105 const std::string& policy_blob,
108 const StorePolicyCallback& callback) { 106 const StorePolicyCallback& callback) {
109 device_policy_ = policy_blob; 107 device_policy_ = policy_blob;
110 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true)); 108 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
111 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true)); 109 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
112 } 110 }
113 111
114 void FakeSessionManagerClient::StorePolicyForUser( 112 void FakeSessionManagerClient::StorePolicyForUser(
115 const std::string& username, 113 const std::string& username,
116 const std::string& policy_blob, 114 const std::string& policy_blob,
117 const std::string& policy_key, 115 const std::string& policy_key,
118 const StorePolicyCallback& callback) { 116 const StorePolicyCallback& callback) {
119 user_policies_[username] = policy_blob; 117 user_policies_[username] = policy_blob;
120 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true)); 118 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
121 } 119 }
122 120
123 void FakeSessionManagerClient::StoreDeviceLocalAccountPolicy( 121 void FakeSessionManagerClient::StoreDeviceLocalAccountPolicy(
124 const std::string& account_id, 122 const std::string& account_id,
125 const std::string& policy_blob, 123 const std::string& policy_blob,
126 const StorePolicyCallback& callback) { 124 const StorePolicyCallback& callback) {
127 device_local_account_policy_[account_id] = policy_blob; 125 device_local_account_policy_[account_id] = policy_blob;
128 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true)); 126 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
129 } 127 }
130 128
131 const std::string& FakeSessionManagerClient::device_policy() const { 129 const std::string& FakeSessionManagerClient::device_policy() const {
132 return device_policy_; 130 return device_policy_;
133 } 131 }
134 132
135 void FakeSessionManagerClient::set_device_policy( 133 void FakeSessionManagerClient::set_device_policy(
136 const std::string& policy_blob) { 134 const std::string& policy_blob) {
137 device_policy_ = policy_blob; 135 device_policy_ = policy_blob;
138 } 136 }
(...skipping 22 matching lines...) Expand all
161 const std::string& account_id, 159 const std::string& account_id,
162 const std::string& policy_blob) { 160 const std::string& policy_blob) {
163 device_local_account_policy_[account_id] = policy_blob; 161 device_local_account_policy_[account_id] = policy_blob;
164 } 162 }
165 163
166 void FakeSessionManagerClient::OnPropertyChangeComplete(bool success) { 164 void FakeSessionManagerClient::OnPropertyChangeComplete(bool success) {
167 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(success)); 165 FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(success));
168 } 166 }
169 167
170 } // namespace chromeos 168 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_gsm_sms_client.cc ('k') | chromeos/dbus/gsm_sms_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698