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

Side by Side Diff: components/gcm_driver/gcm_driver_desktop.cc

Issue 710903002: Revert of [GCM] Fetching OAuth2 tokens periodically in account tracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mapper-in-driver
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « components/gcm_driver/gcm_client_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/gcm_driver/gcm_driver_desktop.h" 5 #include "components/gcm_driver/gcm_driver_desktop.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 new GCMChannelStatusSyncer(this, 356 new GCMChannelStatusSyncer(this,
357 prefs, 357 prefs,
358 channel_status_request_url, 358 channel_status_request_url,
359 user_agent, 359 user_agent,
360 request_context)), 360 request_context)),
361 signed_in_(false), 361 signed_in_(false),
362 gcm_started_(false), 362 gcm_started_(false),
363 gcm_enabled_(true), 363 gcm_enabled_(true),
364 connected_(false), 364 connected_(false),
365 account_mapper_(new GCMAccountMapper(this)), 365 account_mapper_(new GCMAccountMapper(this)),
366 // Setting to max, to make sure it does not prompt for token reporting
367 // Before reading a reasonable value from the DB, which might be never,
368 // in which case the fetching will be triggered.
369 last_token_fetch_time_(base::Time::Max()),
370 ui_thread_(ui_thread), 366 ui_thread_(ui_thread),
371 io_thread_(io_thread), 367 io_thread_(io_thread),
372 weak_ptr_factory_(this) { 368 weak_ptr_factory_(this) {
373 gcm_enabled_ = gcm_channel_status_syncer_->gcm_enabled(); 369 gcm_enabled_ = gcm_channel_status_syncer_->gcm_enabled();
374 370
375 // Create and initialize the GCMClient. Note that this does not initiate the 371 // Create and initialize the GCMClient. Note that this does not initiate the
376 // GCM check-in. 372 // GCM check-in.
377 io_worker_.reset(new IOWorker(ui_thread, io_thread)); 373 io_worker_.reset(new IOWorker(ui_thread, io_thread));
378 io_thread_->PostTask( 374 io_thread_->PostTask(
379 FROM_HERE, 375 FROM_HERE,
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 return; 765 return;
770 766
771 GetAppHandler(app_id)->OnSendAcknowledged(app_id, message_id); 767 GetAppHandler(app_id)->OnSendAcknowledged(app_id, message_id);
772 } 768 }
773 769
774 void GCMDriverDesktop::GCMClientReady( 770 void GCMDriverDesktop::GCMClientReady(
775 const std::vector<AccountMapping>& account_mappings, 771 const std::vector<AccountMapping>& account_mappings,
776 const base::Time& last_token_fetch_time) { 772 const base::Time& last_token_fetch_time) {
777 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); 773 DCHECK(ui_thread_->RunsTasksOnCurrentThread());
778 774
779 last_token_fetch_time_ = last_token_fetch_time;
780
781 GCMDriver::AddAppHandler(kGCMAccountMapperAppId, account_mapper_.get()); 775 GCMDriver::AddAppHandler(kGCMAccountMapperAppId, account_mapper_.get());
782 account_mapper_->Initialize(account_mappings); 776 account_mapper_->Initialize(account_mappings);
777 last_token_fetch_time_ = last_token_fetch_time;
783 778
784 delayed_task_controller_->SetReady(); 779 delayed_task_controller_->SetReady();
785 } 780 }
786 781
787 void GCMDriverDesktop::OnConnected(const net::IPEndPoint& ip_endpoint) { 782 void GCMDriverDesktop::OnConnected(const net::IPEndPoint& ip_endpoint) {
788 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); 783 DCHECK(ui_thread_->RunsTasksOnCurrentThread());
789 784
790 connected_ = true; 785 connected_ = true;
791 786
792 // Drop the event if the service has been stopped. 787 // Drop the event if the service has been stopped.
(...skipping 24 matching lines...) Expand all
817 812
818 // Normally request_gcm_statistics_callback_ would not be null. 813 // Normally request_gcm_statistics_callback_ would not be null.
819 if (!request_gcm_statistics_callback_.is_null()) 814 if (!request_gcm_statistics_callback_.is_null())
820 request_gcm_statistics_callback_.Run(stats); 815 request_gcm_statistics_callback_.Run(stats);
821 else 816 else
822 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL."; 817 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL.";
823 } 818 }
824 819
825 } // namespace gcm 820 } // namespace gcm
826 821
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_client_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698