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

Side by Side Diff: chrome/browser/policy/cloud/user_policy_signin_service_mobile.cc

Issue 2033753002: Remove use of deprecated MessageLoop methods in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: manual change Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/user_policy_signin_service_mobile.h" 5 #include "chrome/browser/policy/cloud/user_policy_signin_service_mobile.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/location.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/threading/thread_task_runner_handle.h"
12 #include "base/time/time.h" 14 #include "base/time/time.h"
13 #include "build/build_config.h" 15 #include "build/build_config.h"
14 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
16 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
17 #include "components/policy/core/common/cloud/cloud_policy_client_registration_h elper.h" 19 #include "components/policy/core/common/cloud/cloud_policy_client_registration_h elper.h"
18 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" 20 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
19 #include "components/policy/core/common/policy_switches.h" 21 #include "components/policy/core/common/policy_switches.h"
20 #include "components/prefs/pref_service.h" 22 #include "components/prefs/pref_service.h"
21 #include "components/signin/core/browser/profile_oauth2_token_service.h" 23 #include "components/signin/core/browser/profile_oauth2_token_service.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 base::Time now = base::Time::Now(); 168 base::Time now = base::Time::Now();
167 base::Time next_check_time = last_check_time + retry_delay; 169 base::Time next_check_time = last_check_time + retry_delay;
168 170
169 // Check immediately if no check was ever done before (last_check_time == 0), 171 // Check immediately if no check was ever done before (last_check_time == 0),
170 // or if the last check was in the future (?), or if we're already past the 172 // or if the last check was in the future (?), or if we're already past the
171 // next check time. Otherwise, delay checking until the next check time. 173 // next check time. Otherwise, delay checking until the next check time.
172 base::TimeDelta try_registration_delay = base::TimeDelta::FromSeconds(5); 174 base::TimeDelta try_registration_delay = base::TimeDelta::FromSeconds(5);
173 if (now > last_check_time && now < next_check_time) 175 if (now > last_check_time && now < next_check_time)
174 try_registration_delay = next_check_time - now; 176 try_registration_delay = next_check_time - now;
175 177
176 base::MessageLoop::current()->PostDelayedTask( 178 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
177 FROM_HERE, 179 FROM_HERE,
178 base::Bind(&UserPolicySigninService::RegisterCloudPolicyService, 180 base::Bind(&UserPolicySigninService::RegisterCloudPolicyService,
179 weak_factory_.GetWeakPtr()), 181 weak_factory_.GetWeakPtr()),
180 try_registration_delay); 182 try_registration_delay);
181 } 183 }
182 184
183 void UserPolicySigninService::RegisterCloudPolicyService() { 185 void UserPolicySigninService::RegisterCloudPolicyService() {
184 // If the user signed-out while this task was waiting then Shutdown() would 186 // If the user signed-out while this task was waiting then Shutdown() would
185 // have been called, which would have invalidated this task. Since we're here 187 // have been called, which would have invalidated this task. Since we're here
186 // then the user must still be signed-in. 188 // then the user must still be signed-in.
(...skipping 17 matching lines...) Expand all
204 206
205 void UserPolicySigninService::CancelPendingRegistration() { 207 void UserPolicySigninService::CancelPendingRegistration() {
206 weak_factory_.InvalidateWeakPtrs(); 208 weak_factory_.InvalidateWeakPtrs();
207 } 209 }
208 210
209 void UserPolicySigninService::OnRegistrationDone() { 211 void UserPolicySigninService::OnRegistrationDone() {
210 registration_helper_.reset(); 212 registration_helper_.reset();
211 } 213 }
212 214
213 } // namespace policy 215 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_win_unittest.cc ('k') | chrome/browser/printing/background_printing_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698