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 std::string device_management_url; | 54 const 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 } | |
60 Initialize(data_store, policy_cache, device_management_url); | 55 Initialize(data_store, policy_cache, device_management_url); |
61 } | 56 } |
62 | 57 |
63 CloudPolicySubsystem::~CloudPolicySubsystem() { | 58 CloudPolicySubsystem::~CloudPolicySubsystem() { |
64 cloud_policy_controller_.reset(); | 59 cloud_policy_controller_.reset(); |
65 device_token_fetcher_.reset(); | 60 device_token_fetcher_.reset(); |
66 cloud_policy_cache_.reset(); | 61 cloud_policy_cache_.reset(); |
67 device_management_service_.reset(); | 62 device_management_service_.reset(); |
68 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); | 63 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
69 } | 64 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const { | 201 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const { |
207 return cloud_policy_cache_.get(); | 202 return cloud_policy_cache_.get(); |
208 } | 203 } |
209 | 204 |
210 CloudPolicySubsystem::CloudPolicySubsystem() | 205 CloudPolicySubsystem::CloudPolicySubsystem() |
211 : refresh_pref_name_(NULL), | 206 : refresh_pref_name_(NULL), |
212 data_store_(NULL) { | 207 data_store_(NULL) { |
213 } | 208 } |
214 | 209 |
215 } // namespace policy | 210 } // namespace policy |
OLD | NEW |