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

Side by Side Diff: components/signin/core/browser/account_reconcilor.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 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 "components/signin/core/browser/account_reconcilor.h" 5 #include "components/signin/core/browser/account_reconcilor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/location.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 13 #include "base/single_thread_task_runner.h"
13 #include "base/message_loop/message_loop_proxy.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/thread_task_runner_handle.h"
15 #include "components/signin/core/browser/profile_oauth2_token_service.h" 16 #include "components/signin/core/browser/profile_oauth2_token_service.h"
16 #include "components/signin/core/browser/signin_client.h" 17 #include "components/signin/core/browser/signin_client.h"
17 #include "components/signin/core/browser/signin_metrics.h" 18 #include "components/signin/core/browser/signin_metrics.h"
18 #include "components/signin/core/common/profile_management_switches.h" 19 #include "components/signin/core/common/profile_management_switches.h"
19 #include "google_apis/gaia/gaia_auth_util.h" 20 #include "google_apis/gaia/gaia_auth_util.h"
20 #include "google_apis/gaia/gaia_oauth_client.h" 21 #include "google_apis/gaia/gaia_oauth_client.h"
21 #include "google_apis/gaia/gaia_urls.h" 22 #include "google_apis/gaia/gaia_urls.h"
22 23
23 24
24 namespace { 25 namespace {
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 424 }
424 425
425 void AccountReconcilor::ScheduleStartReconcileIfChromeAccountsChanged() { 426 void AccountReconcilor::ScheduleStartReconcileIfChromeAccountsChanged() {
426 if (is_reconcile_started_) 427 if (is_reconcile_started_)
427 return; 428 return;
428 429
429 // Start a reconcile as the token accounts have changed. 430 // Start a reconcile as the token accounts have changed.
430 VLOG(1) << "AccountReconcilor::StartReconcileIfChromeAccountsChanged"; 431 VLOG(1) << "AccountReconcilor::StartReconcileIfChromeAccountsChanged";
431 if (chrome_accounts_changed_) { 432 if (chrome_accounts_changed_) {
432 chrome_accounts_changed_ = false; 433 chrome_accounts_changed_ = false;
433 base::MessageLoop::current()->PostTask( 434 base::ThreadTaskRunnerHandle::Get()->PostTask(
434 FROM_HERE, 435 FROM_HERE,
435 base::Bind(&AccountReconcilor::StartReconcile, base::Unretained(this))); 436 base::Bind(&AccountReconcilor::StartReconcile, base::Unretained(this)));
436 } 437 }
437 } 438 }
438 439
439 // Remove the account from the list that is being merged. 440 // Remove the account from the list that is being merged.
440 bool AccountReconcilor::MarkAccountAsAddedToCookie( 441 bool AccountReconcilor::MarkAccountAsAddedToCookie(
441 const std::string& account_id) { 442 const std::string& account_id) {
442 for (std::vector<std::string>::iterator i = add_to_cookie_.begin(); 443 for (std::vector<std::string>::iterator i = add_to_cookie_.begin();
443 i != add_to_cookie_.end(); 444 i != add_to_cookie_.end();
(...skipping 13 matching lines...) Expand all
457 << "Account added: " << account_id << ", " 458 << "Account added: " << account_id << ", "
458 << "Error was " << error.ToString(); 459 << "Error was " << error.ToString();
459 // Always listens to GaiaCookieManagerService. Only proceed if reconciling. 460 // Always listens to GaiaCookieManagerService. Only proceed if reconciling.
460 if (is_reconcile_started_ && MarkAccountAsAddedToCookie(account_id)) { 461 if (is_reconcile_started_ && MarkAccountAsAddedToCookie(account_id)) {
461 if (error.state() != GoogleServiceAuthError::State::NONE) 462 if (error.state() != GoogleServiceAuthError::State::NONE)
462 error_during_last_reconcile_ = true; 463 error_during_last_reconcile_ = true;
463 CalculateIfReconcileIsDone(); 464 CalculateIfReconcileIsDone();
464 ScheduleStartReconcileIfChromeAccountsChanged(); 465 ScheduleStartReconcileIfChromeAccountsChanged();
465 } 466 }
466 } 467 }
OLDNEW
« no previous file with comments | « components/sessions/base_session_service.cc ('k') | components/signin/core/browser/account_tracker_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698