OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/policy/browser_policy_connector.h" | 5 #include "chrome/browser/policy/browser_policy_connector.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/policy/cloud_policy_subsystem.h" | 10 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // Delay in milliseconds from startup. | 38 // Delay in milliseconds from startup. |
39 const int64 kServiceInitializationStartupDelay = 5000; | 39 const int64 kServiceInitializationStartupDelay = 5000; |
40 | 40 |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 // static | 43 // static |
44 BrowserPolicyConnector* BrowserPolicyConnector::Create() { | 44 BrowserPolicyConnector* BrowserPolicyConnector::Create() { |
45 return new BrowserPolicyConnector(); | 45 return new BrowserPolicyConnector(); |
46 } | 46 } |
47 | 47 |
| 48 // static |
| 49 BrowserPolicyConnector* BrowserPolicyConnector::CreateForTests() { |
| 50 const policy::ConfigurationPolicyProvider::PolicyDefinitionList* |
| 51 policy_list = policy::ConfigurationPolicyPrefStore:: |
| 52 GetChromePolicyDefinitionList(); |
| 53 return new BrowserPolicyConnector( |
| 54 new policy::DummyConfigurationPolicyProvider(policy_list), |
| 55 new policy::DummyConfigurationPolicyProvider(policy_list)); |
| 56 } |
| 57 |
48 BrowserPolicyConnector::BrowserPolicyConnector() | 58 BrowserPolicyConnector::BrowserPolicyConnector() |
49 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { | 59 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
50 managed_platform_provider_.reset(CreateManagedPlatformProvider()); | 60 managed_platform_provider_.reset(CreateManagedPlatformProvider()); |
51 recommended_platform_provider_.reset(CreateRecommendedPlatformProvider()); | 61 recommended_platform_provider_.reset(CreateRecommendedPlatformProvider()); |
52 | 62 |
53 #if defined(OS_CHROMEOS) | 63 #if defined(OS_CHROMEOS) |
54 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 64 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
55 if (command_line->HasSwitch(switches::kEnableDevicePolicy)) { | 65 if (command_line->HasSwitch(switches::kEnableDevicePolicy)) { |
56 identity_strategy_.reset(new DevicePolicyIdentityStrategy()); | 66 identity_strategy_.reset(new DevicePolicyIdentityStrategy()); |
57 install_attributes_.reset(new EnterpriseInstallAttributes( | 67 install_attributes_.reset(new EnterpriseInstallAttributes( |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 216 } |
207 } | 217 } |
208 | 218 |
209 void BrowserPolicyConnector::ScheduleServiceInitialization( | 219 void BrowserPolicyConnector::ScheduleServiceInitialization( |
210 int64 delay_milliseconds) { | 220 int64 delay_milliseconds) { |
211 if (cloud_policy_subsystem_.get()) | 221 if (cloud_policy_subsystem_.get()) |
212 cloud_policy_subsystem_->ScheduleServiceInitialization(delay_milliseconds); | 222 cloud_policy_subsystem_->ScheduleServiceInitialization(delay_milliseconds); |
213 } | 223 } |
214 | 224 |
215 } // namespace | 225 } // namespace |
OLD | NEW |