Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: chrome/browser/policy/cloud_policy_subsystem.cc

Issue 11620007: Switch from OnIPAddressChanged and OnConnectionTypeChange to OnNetworkChanged Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 CloudPolicyCacheBase* policy_cache, 53 CloudPolicyCacheBase* policy_cache,
54 const std::string& device_management_url) { 54 const std::string& device_management_url) {
55 Initialize(data_store, policy_cache, device_management_url); 55 Initialize(data_store, policy_cache, device_management_url);
56 } 56 }
57 57
58 CloudPolicySubsystem::~CloudPolicySubsystem() { 58 CloudPolicySubsystem::~CloudPolicySubsystem() {
59 cloud_policy_controller_.reset(); 59 cloud_policy_controller_.reset();
60 device_token_fetcher_.reset(); 60 device_token_fetcher_.reset();
61 cloud_policy_cache_.reset(); 61 cloud_policy_cache_.reset();
62 device_management_service_.reset(); 62 device_management_service_.reset();
63 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); 63 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
64 } 64 }
65 65
66 void CloudPolicySubsystem::OnIPAddressChanged() { 66 void CloudPolicySubsystem::OnNetworkChanged(
67 if (state() == CloudPolicySubsystem::NETWORK_ERROR && 67 net::NetworkChangeNotifier::ConnectionType type) {
68 if (type != net::NetworkChangeNotifier::CONNECTION_NONE &&
69 state() == CloudPolicySubsystem::NETWORK_ERROR &&
68 cloud_policy_controller_.get()) { 70 cloud_policy_controller_.get()) {
69 cloud_policy_controller_->Retry(); 71 cloud_policy_controller_->Retry();
70 } 72 }
71 } 73 }
72 74
73 void CloudPolicySubsystem::Initialize( 75 void CloudPolicySubsystem::Initialize(
74 CloudPolicyDataStore* data_store, 76 CloudPolicyDataStore* data_store,
75 CloudPolicyCacheBase* policy_cache, 77 CloudPolicyCacheBase* policy_cache,
76 const std::string& device_management_url) { 78 const std::string& device_management_url) {
77 device_management_url_ = device_management_url; 79 device_management_url_ = device_management_url;
78 data_store_ = data_store; 80 data_store_ = data_store;
79 net::NetworkChangeNotifier::AddIPAddressObserver(this); 81 net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
80 notifier_.reset(new PolicyNotifier()); 82 notifier_.reset(new PolicyNotifier());
81 if (!device_management_url_.empty()) { 83 if (!device_management_url_.empty()) {
82 device_management_service_.reset(new DeviceManagementService( 84 device_management_service_.reset(new DeviceManagementService(
83 device_management_url)); 85 device_management_url));
84 cloud_policy_cache_.reset(policy_cache); 86 cloud_policy_cache_.reset(policy_cache);
85 cloud_policy_cache_->set_policy_notifier(notifier_.get()); 87 cloud_policy_cache_->set_policy_notifier(notifier_.get());
86 cloud_policy_cache_->Load(); 88 cloud_policy_cache_->Load();
87 CreateDeviceTokenFetcher(); 89 CreateDeviceTokenFetcher();
88 } 90 }
89 } 91 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const { 194 CloudPolicyCacheBase* CloudPolicySubsystem::GetCloudPolicyCacheBase() const {
193 return cloud_policy_cache_.get(); 195 return cloud_policy_cache_.get();
194 } 196 }
195 197
196 CloudPolicySubsystem::CloudPolicySubsystem() 198 CloudPolicySubsystem::CloudPolicySubsystem()
197 : refresh_pref_name_(NULL), 199 : refresh_pref_name_(NULL),
198 data_store_(NULL) { 200 data_store_(NULL) {
199 } 201 }
200 202
201 } // namespace policy 203 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698