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 "chrome/browser/policy/cloud_policy_subsystem.h" | 5 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 policy_notifier_->AddObserver(observer); | 43 policy_notifier_->AddObserver(observer); |
44 } | 44 } |
45 | 45 |
46 CloudPolicySubsystem::ObserverRegistrar::~ObserverRegistrar() { | 46 CloudPolicySubsystem::ObserverRegistrar::~ObserverRegistrar() { |
47 if (policy_notifier_) | 47 if (policy_notifier_) |
48 policy_notifier_->RemoveObserver(observer_); | 48 policy_notifier_->RemoveObserver(observer_); |
49 } | 49 } |
50 | 50 |
51 CloudPolicySubsystem::CloudPolicySubsystem( | 51 CloudPolicySubsystem::CloudPolicySubsystem( |
52 CloudPolicyDataStore* data_store, | 52 CloudPolicyDataStore* data_store, |
53 CloudPolicyCacheBase* policy_cache, | 53 CloudPolicyCacheBase* policy_cache) { |
54 const std::string& device_management_url) { | 54 std::string device_management_url; |
| 55 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 56 if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { |
| 57 device_management_url = |
| 58 command_line->GetSwitchValueASCII(switches::kDeviceManagementUrl); |
| 59 } |
55 Initialize(data_store, policy_cache, device_management_url); | 60 Initialize(data_store, policy_cache, device_management_url); |
56 } | 61 } |
57 | 62 |
58 CloudPolicySubsystem::~CloudPolicySubsystem() { | 63 CloudPolicySubsystem::~CloudPolicySubsystem() { |
59 cloud_policy_controller_.reset(); | 64 cloud_policy_controller_.reset(); |
60 device_token_fetcher_.reset(); | 65 device_token_fetcher_.reset(); |
61 cloud_policy_cache_.reset(); | 66 cloud_policy_cache_.reset(); |
62 device_management_service_.reset(); | 67 device_management_service_.reset(); |
63 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); | 68 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
64 } | 69 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const { | 206 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const { |
202 return cloud_policy_cache_.get(); | 207 return cloud_policy_cache_.get(); |
203 } | 208 } |
204 | 209 |
205 CloudPolicySubsystem::CloudPolicySubsystem() | 210 CloudPolicySubsystem::CloudPolicySubsystem() |
206 : refresh_pref_name_(NULL), | 211 : refresh_pref_name_(NULL), |
207 data_store_(NULL) { | 212 data_store_(NULL) { |
208 } | 213 } |
209 | 214 |
210 } // namespace policy | 215 } // namespace policy |
OLD | NEW |