OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/session_manager_client.h" | 5 #include "chromeos/dbus/session_manager_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 virtual void RetrieveDevicePolicy( | 611 virtual void RetrieveDevicePolicy( |
612 const RetrievePolicyCallback& callback) OVERRIDE { | 612 const RetrievePolicyCallback& callback) OVERRIDE { |
613 base::FilePath owner_key_path; | 613 base::FilePath owner_key_path; |
614 if (!PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_path)) { | 614 if (!PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_path)) { |
615 callback.Run(""); | 615 callback.Run(""); |
616 return; | 616 return; |
617 } | 617 } |
618 base::FilePath device_policy_path = | 618 base::FilePath device_policy_path = |
619 owner_key_path.DirName().AppendASCII("stub_device_policy"); | 619 owner_key_path.DirName().AppendASCII("stub_device_policy"); |
620 base::PostTaskAndReplyWithResult( | 620 base::PostTaskAndReplyWithResult( |
621 base::WorkerPool::GetTaskRunner(false), | 621 base::WorkerPool::GetTaskRunner(false).get(), |
622 FROM_HERE, | 622 FROM_HERE, |
623 base::Bind(&GetFileContent, device_policy_path), | 623 base::Bind(&GetFileContent, device_policy_path), |
624 callback); | 624 callback); |
625 } | 625 } |
626 virtual void RetrievePolicyForUser( | 626 virtual void RetrievePolicyForUser( |
627 const std::string& username, | 627 const std::string& username, |
628 const RetrievePolicyCallback& callback) OVERRIDE { | 628 const RetrievePolicyCallback& callback) OVERRIDE { |
629 base::PostTaskAndReplyWithResult( | 629 base::PostTaskAndReplyWithResult( |
630 base::WorkerPool::GetTaskRunner(false), | 630 base::WorkerPool::GetTaskRunner(false).get(), |
631 FROM_HERE, | 631 FROM_HERE, |
632 base::Bind(&GetFileContent, GetUserFilePath(username, "stub_policy")), | 632 base::Bind(&GetFileContent, GetUserFilePath(username, "stub_policy")), |
633 callback); | 633 callback); |
634 } | 634 } |
635 virtual std::string BlockingRetrievePolicyForUser( | 635 virtual std::string BlockingRetrievePolicyForUser( |
636 const std::string& username) OVERRIDE { | 636 const std::string& username) OVERRIDE { |
637 return GetFileContent(GetUserFilePath(username, "stub_policy")); | 637 return GetFileContent(GetUserFilePath(username, "stub_policy")); |
638 } | 638 } |
639 virtual void RetrieveDeviceLocalAccountPolicy( | 639 virtual void RetrieveDeviceLocalAccountPolicy( |
640 const std::string& account_name, | 640 const std::string& account_name, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 | 737 |
738 SessionManagerClient* SessionManagerClient::Create( | 738 SessionManagerClient* SessionManagerClient::Create( |
739 DBusClientImplementationType type) { | 739 DBusClientImplementationType type) { |
740 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 740 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
741 return new SessionManagerClientImpl(); | 741 return new SessionManagerClientImpl(); |
742 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 742 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
743 return new SessionManagerClientStubImpl(); | 743 return new SessionManagerClientStubImpl(); |
744 } | 744 } |
745 | 745 |
746 } // namespace chromeos | 746 } // namespace chromeos |
OLD | NEW |