OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" | 5 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | |
10 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 9 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
11 | 10 |
12 namespace policy { | 11 namespace policy { |
13 | 12 |
14 StubEnterpriseInstallAttributes::StubEnterpriseInstallAttributes() | 13 StubEnterpriseInstallAttributes::StubEnterpriseInstallAttributes() |
15 : EnterpriseInstallAttributes(NULL) { | 14 : EnterpriseInstallAttributes(NULL) { |
16 device_locked_ = true; | 15 device_locked_ = true; |
17 } | 16 } |
18 | 17 |
19 void StubEnterpriseInstallAttributes::SetDomain(const std::string& domain) { | 18 void StubEnterpriseInstallAttributes::SetDomain(const std::string& domain) { |
20 registration_domain_ = domain; | 19 registration_domain_ = domain; |
21 } | 20 } |
22 | 21 |
23 void StubEnterpriseInstallAttributes::SetRegistrationUser( | 22 void StubEnterpriseInstallAttributes::SetRegistrationUser( |
24 const std::string& user) { | 23 const std::string& user) { |
25 registration_user_ = user; | 24 registration_user_ = user; |
26 } | 25 } |
27 | 26 |
28 void StubEnterpriseInstallAttributes::SetDeviceId(const std::string& id) { | 27 void StubEnterpriseInstallAttributes::SetDeviceId(const std::string& id) { |
29 registration_device_id_ = id; | 28 registration_device_id_ = id; |
30 } | 29 } |
31 | 30 |
32 void StubEnterpriseInstallAttributes::SetMode(DeviceMode mode) { | 31 void StubEnterpriseInstallAttributes::SetMode(DeviceMode mode) { |
33 registration_mode_ = mode; | 32 registration_mode_ = mode; |
34 } | 33 } |
35 | 34 |
36 ScopedStubEnterpriseInstallAttributes::ScopedStubEnterpriseInstallAttributes( | |
37 const std::string& domain, | |
38 const std::string& registration_user, | |
39 const std::string& device_id, | |
40 DeviceMode mode) { | |
41 StubEnterpriseInstallAttributes* attributes = | |
42 new StubEnterpriseInstallAttributes(); | |
43 attributes->SetDomain(domain); | |
44 attributes->SetRegistrationUser(registration_user); | |
45 attributes->SetDeviceId(device_id); | |
46 attributes->SetMode(mode); | |
47 BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting(attributes); | |
48 } | |
49 | |
50 ScopedStubEnterpriseInstallAttributes:: | |
51 ~ScopedStubEnterpriseInstallAttributes() { | |
52 BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting(NULL); | |
53 } | |
54 | |
55 } // namespace policy | 35 } // namespace policy |
OLD | NEW |