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/asynchronous_policy_loader.h" | 5 #include "chrome/browser/policy/asynchronous_policy_loader.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 void AsynchronousPolicyLoader::ScheduleReloadTask( | 64 void AsynchronousPolicyLoader::ScheduleReloadTask( |
65 const base::TimeDelta& delay) { | 65 const base::TimeDelta& delay) { |
66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
67 | 67 |
68 CancelReloadTask(); | 68 CancelReloadTask(); |
69 | 69 |
70 BrowserThread::PostDelayedTask( | 70 BrowserThread::PostDelayedTask( |
71 BrowserThread::FILE, FROM_HERE, | 71 BrowserThread::FILE, FROM_HERE, |
72 base::Bind(&AsynchronousPolicyLoader::ReloadFromTask, | 72 base::Bind(&AsynchronousPolicyLoader::ReloadFromTask, |
73 weak_ptr_factory_.GetWeakPtr()), | 73 weak_ptr_factory_.GetWeakPtr()), |
74 delay.InMilliseconds()); | 74 delay); |
75 } | 75 } |
76 | 76 |
77 void AsynchronousPolicyLoader::ScheduleFallbackReloadTask() { | 77 void AsynchronousPolicyLoader::ScheduleFallbackReloadTask() { |
78 // As a safeguard in case that the load delegate failed to timely notice a | 78 // As a safeguard in case that the load delegate failed to timely notice a |
79 // change in policy, schedule a reload task that'll make us recheck after a | 79 // change in policy, schedule a reload task that'll make us recheck after a |
80 // reasonable interval. | 80 // reasonable interval. |
81 ScheduleReloadTask(reload_interval_); | 81 ScheduleReloadTask(reload_interval_); |
82 } | 82 } |
83 | 83 |
84 void AsynchronousPolicyLoader::ReloadFromTask() { | 84 void AsynchronousPolicyLoader::ReloadFromTask() { |
(...skipping 25 matching lines...) Expand all Loading... |
110 | 110 |
111 void AsynchronousPolicyLoader::InitAfterFileThreadAvailable() { | 111 void AsynchronousPolicyLoader::InitAfterFileThreadAvailable() { |
112 if (!stopped_) { | 112 if (!stopped_) { |
113 BrowserThread::PostTask( | 113 BrowserThread::PostTask( |
114 BrowserThread::FILE, FROM_HERE, | 114 BrowserThread::FILE, FROM_HERE, |
115 base::Bind(&AsynchronousPolicyLoader::InitOnFileThread, this)); | 115 base::Bind(&AsynchronousPolicyLoader::InitOnFileThread, this)); |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 } // namespace policy | 119 } // namespace policy |
OLD | NEW |