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

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

Issue 10854213: Added UserCloudPolicyManager::ShutdownAndRemovePolicy() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/user_cloud_policy_manager.h" 5 #include "chrome/browser/policy/user_cloud_policy_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 if (service_->client()->is_registered()) { 88 if (service_->client()->is_registered()) {
89 service_->RefreshPolicy( 89 service_->RefreshPolicy(
90 base::Bind(&UserCloudPolicyManager::OnInitialPolicyFetchComplete, 90 base::Bind(&UserCloudPolicyManager::OnInitialPolicyFetchComplete,
91 base::Unretained(this))); 91 base::Unretained(this)));
92 } 92 }
93 } else { 93 } else {
94 CancelWaitForPolicyFetch(); 94 CancelWaitForPolicyFetch();
95 } 95 }
96 } 96 }
97 97
98 void UserCloudPolicyManager::Shutdown() { 98 void UserCloudPolicyManager::ShutdownAndRemovePolicy() {
99 refresh_scheduler_.reset(); 99 Shutdown();
100 if (service_.get()) 100 store_->Clear();
101 service_->client()->RemoveObserver(this);
102 service_.reset();
103 prefs_ = NULL;
104 } 101 }
105 102
106 void UserCloudPolicyManager::CancelWaitForPolicyFetch() { 103 void UserCloudPolicyManager::CancelWaitForPolicyFetch() {
107 wait_for_policy_fetch_ = false; 104 wait_for_policy_fetch_ = false;
108 CheckAndPublishPolicy(); 105 CheckAndPublishPolicy();
109 106
110 // Now that |wait_for_policy_fetch_| is guaranteed to be false, the scheduler 107 // Now that |wait_for_policy_fetch_| is guaranteed to be false, the scheduler
111 // can be started. 108 // can be started.
112 if (service_.get() && !refresh_scheduler_.get() && prefs_) { 109 if (service_.get() && !refresh_scheduler_.get() && prefs_) {
113 refresh_scheduler_.reset( 110 refresh_scheduler_.reset(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 186
190 void UserCloudPolicyManager::OnInitialPolicyFetchComplete() { 187 void UserCloudPolicyManager::OnInitialPolicyFetchComplete() {
191 CancelWaitForPolicyFetch(); 188 CancelWaitForPolicyFetch();
192 } 189 }
193 190
194 void UserCloudPolicyManager::OnRefreshComplete() { 191 void UserCloudPolicyManager::OnRefreshComplete() {
195 wait_for_policy_refresh_ = false; 192 wait_for_policy_refresh_ = false;
196 CheckAndPublishPolicy(); 193 CheckAndPublishPolicy();
197 } 194 }
198 195
196 void UserCloudPolicyManager::Shutdown() {
197 refresh_scheduler_.reset();
198 if (service_.get())
199 service_->client()->RemoveObserver(this);
200 service_.reset();
201 prefs_ = NULL;
202 }
203
199 } // namespace policy 204 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_manager.h ('k') | chrome/browser/policy/user_cloud_policy_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698