Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_INSTALL_ATTRIBUTES_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_INSTALL_ATTRIBUTES_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_INSTALL_ATTRIBUTES_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_INSTALL_ATTRIBUTES_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/chromeos/settings/install_attributes.h" | 11 #include "chrome/browser/chromeos/settings/install_attributes.h" |
| 12 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 12 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 | 15 |
| 16 // This class allows tests to set specific configurations for testing. | 16 // This class allows tests to set specific configurations for testing. |
| 17 class StubInstallAttributes : public InstallAttributes { | 17 class StubInstallAttributes : public InstallAttributes { |
| 18 public: | 18 public: |
| 19 StubInstallAttributes(); | 19 StubInstallAttributes(); |
| 20 | 20 |
| 21 // Setup as not-yet enrolled. | 21 // Setup as not-yet enrolled. |
| 22 void Clear(); | 22 void Clear(); |
| 23 | 23 |
| 24 // Setup as consumer device. (Clears existing configuration.) | 24 // Setup as consumer device. (Clears existing configuration.) |
| 25 void SetConsumer(); | 25 void SetConsumer(); |
| 26 | 26 |
| 27 // Setup as enterprise enrolled. (Clears existing configuration.) | 27 // Setup as enterprise enrolled. (Clears existing configuration.) |
| 28 void SetEnterprise(const std::string& domain, const std::string& device_id); | 28 void SetEnterprise(const std::string& domain, const std::string& device_id); |
|
Thiemo Nagel
2017/03/21 13:44:22
Nit: Maybe rename to something with Cloud to make
Roman Sorokin (ftl)
2017/03/22 15:19:25
Make sense!
| |
| 29 | 29 |
| 30 // Setup as Active Directory enterprise enrolled. (Clears existing | |
| 31 // configuration.) | |
| 32 void SetActiveDirectoryEnterprise(const std::string& realm); | |
|
Thiemo Nagel
2017/03/21 13:44:22
For better or worse, AD install attributes contain
Roman Sorokin (ftl)
2017/03/22 15:19:25
Done.
| |
| 33 | |
| 30 private: | 34 private: |
| 31 DISALLOW_COPY_AND_ASSIGN(StubInstallAttributes); | 35 DISALLOW_COPY_AND_ASSIGN(StubInstallAttributes); |
| 32 }; | 36 }; |
| 33 | 37 |
| 34 // Helper class to set install attributes in the scope of a test. | 38 // Helper class to set install attributes in the scope of a test. |
| 35 class ScopedStubInstallAttributes { | 39 class ScopedStubInstallAttributes { |
| 36 public: | 40 public: |
| 37 ~ScopedStubInstallAttributes(); | 41 ~ScopedStubInstallAttributes(); |
| 38 | 42 |
| 39 // Factory for empty (unset) ScopedStubInstallAttributes. | 43 // Factory for empty (unset) ScopedStubInstallAttributes. |
| 40 static ScopedStubInstallAttributes CreateUnset(); | 44 static ScopedStubInstallAttributes CreateUnset(); |
| 41 | 45 |
| 42 // Factory for consumer-type ScopedStubInstallAttributes. | 46 // Factory for consumer-type ScopedStubInstallAttributes. |
| 43 static ScopedStubInstallAttributes CreateConsumer(); | 47 static ScopedStubInstallAttributes CreateConsumer(); |
| 44 | 48 |
| 45 // Factory for enterprise-type ScopedStubInstallAttributes. | 49 // Factory for enterprise-type ScopedStubInstallAttributes. |
| 46 static ScopedStubInstallAttributes CreateEnterprise( | 50 static ScopedStubInstallAttributes CreateEnterprise( |
| 47 const std::string& domain, | 51 const std::string& domain, |
| 48 const std::string& device_id); | 52 const std::string& device_id); |
| 49 | 53 |
| 54 // Factory for Active Directory enterprise-type ScopedStubInstallAttributes. | |
| 55 static ScopedStubInstallAttributes CreateActiveDirectoryEnterprise( | |
| 56 const std::string& realm); | |
| 57 | |
| 50 private: | 58 private: |
| 51 ScopedStubInstallAttributes(); | 59 ScopedStubInstallAttributes(); |
| 52 }; | 60 }; |
| 53 | 61 |
| 54 } // namespace chromeos | 62 } // namespace chromeos |
| 55 | 63 |
| 56 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_INSTALL_ATTRIBUTES_H_ | 64 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_INSTALL_ATTRIBUTES_H_ |
| OLD | NEW |