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 <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 user_policies_[account_name] = policy_blob; | 621 user_policies_[account_name] = policy_blob; |
622 callback.Run(true); | 622 callback.Run(true); |
623 } | 623 } |
624 virtual void SetFlagsForUser(const std::string& username, | 624 virtual void SetFlagsForUser(const std::string& username, |
625 const std::vector<std::string>& flags) OVERRIDE { | 625 const std::vector<std::string>& flags) OVERRIDE { |
626 } | 626 } |
627 | 627 |
628 static void StoreFileInBackground(const base::FilePath& path, | 628 static void StoreFileInBackground(const base::FilePath& path, |
629 const std::string& data) { | 629 const std::string& data) { |
630 const int size = static_cast<int>(data.size()); | 630 const int size = static_cast<int>(data.size()); |
631 if (!file_util::CreateDirectory(path.DirName()) || | 631 if (!base::CreateDirectory(path.DirName()) || |
632 file_util::WriteFile(path, data.data(), size) != size) { | 632 file_util::WriteFile(path, data.data(), size) != size) { |
633 LOG(WARNING) << "Failed to write policy key to " << path.value(); | 633 LOG(WARNING) << "Failed to write policy key to " << path.value(); |
634 } | 634 } |
635 } | 635 } |
636 | 636 |
637 private: | 637 private: |
638 ObserverList<Observer> observers_; | 638 ObserverList<Observer> observers_; |
639 std::string device_policy_; | 639 std::string device_policy_; |
640 std::map<std::string, std::string> user_policies_; | 640 std::map<std::string, std::string> user_policies_; |
641 | 641 |
642 DISALLOW_COPY_AND_ASSIGN(SessionManagerClientStubImpl); | 642 DISALLOW_COPY_AND_ASSIGN(SessionManagerClientStubImpl); |
643 }; | 643 }; |
644 | 644 |
645 SessionManagerClient::SessionManagerClient() { | 645 SessionManagerClient::SessionManagerClient() { |
646 } | 646 } |
647 | 647 |
648 SessionManagerClient::~SessionManagerClient() { | 648 SessionManagerClient::~SessionManagerClient() { |
649 } | 649 } |
650 | 650 |
651 SessionManagerClient* SessionManagerClient::Create( | 651 SessionManagerClient* SessionManagerClient::Create( |
652 DBusClientImplementationType type) { | 652 DBusClientImplementationType type) { |
653 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 653 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
654 return new SessionManagerClientImpl(); | 654 return new SessionManagerClientImpl(); |
655 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 655 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
656 return new SessionManagerClientStubImpl(); | 656 return new SessionManagerClientStubImpl(); |
657 } | 657 } |
658 | 658 |
659 } // namespace chromeos | 659 } // namespace chromeos |
OLD | NEW |