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

Unified 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. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/fake_session_manager_client.cc
diff --git a/chromeos/dbus/fake_session_manager_client.cc b/chromeos/dbus/fake_session_manager_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d78e55d4110b593b9f7a36acf77cbad48c31afb7
--- /dev/null
+++ b/chromeos/dbus/fake_session_manager_client.cc
@@ -0,0 +1,108 @@
+// 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.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chromeos/dbus/fake_session_manager_client.h"
+
+#include "base/bind.h"
+#include "base/message_loop.h"
+#include "base/string_util.h"
+
+namespace chromeos {
+
+FakeSessionManagerClient::FakeSessionManagerClient() {}
+
+FakeSessionManagerClient::~FakeSessionManagerClient() {}
+
+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.
+ observers_.AddObserver(observer);
+}
+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.
+ observers_.RemoveObserver(observer);
+}
+bool FakeSessionManagerClient::HasObserver(Observer* observer) OVERRIDE {
+ return observers_.HasObserver(observer);
+}
+void FakeSessionManagerClient::EmitLoginPromptReady() OVERRIDE {}
+void FakeSessionManagerClient::EmitLoginPromptVisible() OVERRIDE {}
+void FakeSessionManagerClient::RestartJob(
+ int pid, const std::string& command_line) OVERRIDE {}
+void FakeSessionManagerClient::RestartEntd() OVERRIDE {}
+void FakeSessionManagerClient::StartSession(
+ const std::string& user_email) OVERRIDE {}
+void FakeSessionManagerClient::StopSession() OVERRIDE {}
+void FakeSessionManagerClient::StartDeviceWipe() OVERRIDE {}
+void FakeSessionManagerClient::RequestLockScreen() OVERRIDE {}
+void FakeSessionManagerClient::NotifyLockScreenShown() OVERRIDE {}
+void FakeSessionManagerClient::RequestUnlockScreen() OVERRIDE {}
+void FakeSessionManagerClient::NotifyLockScreenDismissed() OVERRIDE {}
+void FakeSessionManagerClient::RetrieveDevicePolicy(
+ const RetrievePolicyCallback& callback) OVERRIDE {
+ 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.
+ base::Bind(callback, device_policy_));
+}
+void FakeSessionManagerClient::RetrieveUserPolicy(
+ const RetrievePolicyCallback& callback) OVERRIDE {
+ MessageLoop::current()->PostTask(FROM_HERE,
+ base::Bind(callback, user_policy_));
+}
+void FakeSessionManagerClient::RetrieveDeviceLocalAccountPolicy(
+ const std::string& account_id,
+ const RetrievePolicyCallback& callback) OVERRIDE {
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(callback, device_local_account_policy_[account_id]));
+}
+void FakeSessionManagerClient::StoreDevicePolicy(const std::string& policy_blob,
+ const StorePolicyCallback& callback) OVERRIDE {
+ device_policy_ = policy_blob;
+ MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
+ FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
+}
+void FakeSessionManagerClient::StoreUserPolicy(const std::string& policy_blob,
+ const StorePolicyCallback& callback) OVERRIDE {
+ user_policy_ = policy_blob;
+ MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
+ FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
+}
+void FakeSessionManagerClient::StoreDeviceLocalAccountPolicy(
+ const std::string& account_id,
+ const std::string& policy_blob,
+ const StorePolicyCallback& callback) OVERRIDE {
+ device_local_account_policy_[account_id] = policy_blob;
+ MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, true));
+ FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
+}
+
+const std::string& FakeSessionManagerClient::device_policy() const {
+ return device_policy_;
+}
+void FakeSessionManagerClient::set_device_policy(
+ const std::string& policy_blob) {
+ device_policy_ = policy_blob;
+ FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
+}
+
+const std::string& FakeSessionManagerClient::user_policy() const {
+ return user_policy_;
+}
+void FakeSessionManagerClient::set_user_policy(const std::string& policy_blob) {
+ user_policy_ = policy_blob;
+ FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
+}
+
+const std::string& FakeSessionManagerClient::device_local_account_policy(
+ const std::string& account_id) const {
+ std::map<std::string, std::string>::const_iterator entry =
+ device_local_account_policy_.find(account_id);
+ return entry != device_local_account_policy_.end() ? entry->second
+ : EmptyString();
+}
+void FakeSessionManagerClient::set_device_local_account_policy(
+ const std::string& account_id,
+ const std::string& policy_blob) {
+ device_local_account_policy_[account_id] = policy_blob;
+ FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
+}
+
+} // namespace chromeos
« 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
This is Rietveld 408576698