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

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

Issue 600053002: [GCM] Loading the account mappings from store to the driver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing account mapper from BUILD.gn android section Created 6 years, 3 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
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop.h ('k') | google_apis/gcm/engine/gcm_store.h » ('j') | 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 GCMClient::Result result) OVERRIDE; 43 GCMClient::Result result) OVERRIDE;
44 virtual void OnMessageReceived( 44 virtual void OnMessageReceived(
45 const std::string& app_id, 45 const std::string& app_id,
46 const GCMClient::IncomingMessage& message) OVERRIDE; 46 const GCMClient::IncomingMessage& message) OVERRIDE;
47 virtual void OnMessagesDeleted(const std::string& app_id) OVERRIDE; 47 virtual void OnMessagesDeleted(const std::string& app_id) OVERRIDE;
48 virtual void OnMessageSendError( 48 virtual void OnMessageSendError(
49 const std::string& app_id, 49 const std::string& app_id,
50 const GCMClient::SendErrorDetails& send_error_details) OVERRIDE; 50 const GCMClient::SendErrorDetails& send_error_details) OVERRIDE;
51 virtual void OnSendAcknowledged(const std::string& app_id, 51 virtual void OnSendAcknowledged(const std::string& app_id,
52 const std::string& message_id) OVERRIDE; 52 const std::string& message_id) OVERRIDE;
53 virtual void OnGCMReady() OVERRIDE; 53 virtual void OnGCMReady(
54 const std::vector<AccountMapping>& account_mappings) OVERRIDE;
54 virtual void OnActivityRecorded() OVERRIDE; 55 virtual void OnActivityRecorded() OVERRIDE;
55 virtual void OnConnected(const net::IPEndPoint& ip_endpoint) OVERRIDE; 56 virtual void OnConnected(const net::IPEndPoint& ip_endpoint) OVERRIDE;
56 virtual void OnDisconnected() OVERRIDE; 57 virtual void OnDisconnected() OVERRIDE;
57 58
58 // Called on IO thread. 59 // Called on IO thread.
59 void Initialize( 60 void Initialize(
60 scoped_ptr<GCMClientFactory> gcm_client_factory, 61 scoped_ptr<GCMClientFactory> gcm_client_factory,
61 const GCMClient::ChromeBuildInfo& chrome_build_info, 62 const GCMClient::ChromeBuildInfo& chrome_build_info,
62 const base::FilePath& store_path, 63 const base::FilePath& store_path,
63 const scoped_refptr<net::URLRequestContextGetter>& request_context, 64 const scoped_refptr<net::URLRequestContextGetter>& request_context,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 const std::string& app_id, 195 const std::string& app_id,
195 const std::string& message_id) { 196 const std::string& message_id) {
196 DCHECK(io_thread_->RunsTasksOnCurrentThread()); 197 DCHECK(io_thread_->RunsTasksOnCurrentThread());
197 198
198 ui_thread_->PostTask( 199 ui_thread_->PostTask(
199 FROM_HERE, 200 FROM_HERE,
200 base::Bind( 201 base::Bind(
201 &GCMDriverDesktop::SendAcknowledged, service_, app_id, message_id)); 202 &GCMDriverDesktop::SendAcknowledged, service_, app_id, message_id));
202 } 203 }
203 204
204 void GCMDriverDesktop::IOWorker::OnGCMReady() { 205 void GCMDriverDesktop::IOWorker::OnGCMReady(
206 const std::vector<AccountMapping>& account_mappings) {
205 ui_thread_->PostTask( 207 ui_thread_->PostTask(
206 FROM_HERE, 208 FROM_HERE,
207 base::Bind(&GCMDriverDesktop::GCMClientReady, service_)); 209 base::Bind(
210 &GCMDriverDesktop::GCMClientReady, service_, account_mappings));
208 } 211 }
209 212
210 void GCMDriverDesktop::IOWorker::OnActivityRecorded() { 213 void GCMDriverDesktop::IOWorker::OnActivityRecorded() {
211 DCHECK(io_thread_->RunsTasksOnCurrentThread()); 214 DCHECK(io_thread_->RunsTasksOnCurrentThread());
212 // When an activity is recorded, get all the stats and refresh the UI of 215 // When an activity is recorded, get all the stats and refresh the UI of
213 // gcm-internals page. 216 // gcm-internals page.
214 GetGCMStatistics(false); 217 GetGCMStatistics(false);
215 } 218 }
216 219
217 void GCMDriverDesktop::IOWorker::OnConnected( 220 void GCMDriverDesktop::IOWorker::OnConnected(
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 const std::string& message_id) { 710 const std::string& message_id) {
708 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); 711 DCHECK(ui_thread_->RunsTasksOnCurrentThread());
709 712
710 // Drop the event if the service has been stopped. 713 // Drop the event if the service has been stopped.
711 if (!gcm_started_) 714 if (!gcm_started_)
712 return; 715 return;
713 716
714 GetAppHandler(app_id)->OnSendAcknowledged(app_id, message_id); 717 GetAppHandler(app_id)->OnSendAcknowledged(app_id, message_id);
715 } 718 }
716 719
717 void GCMDriverDesktop::GCMClientReady() { 720 void GCMDriverDesktop::GCMClientReady(
721 const std::vector<AccountMapping>& account_mappings) {
718 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); 722 DCHECK(ui_thread_->RunsTasksOnCurrentThread());
719 723
720 delayed_task_controller_->SetReady(); 724 delayed_task_controller_->SetReady();
721 } 725 }
722 726
723 void GCMDriverDesktop::OnConnected(const net::IPEndPoint& ip_endpoint) { 727 void GCMDriverDesktop::OnConnected(const net::IPEndPoint& ip_endpoint) {
724 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); 728 DCHECK(ui_thread_->RunsTasksOnCurrentThread());
725 729
726 connected_ = true; 730 connected_ = true;
727 731
(...skipping 25 matching lines...) Expand all
753 757
754 // Normally request_gcm_statistics_callback_ would not be null. 758 // Normally request_gcm_statistics_callback_ would not be null.
755 if (!request_gcm_statistics_callback_.is_null()) 759 if (!request_gcm_statistics_callback_.is_null())
756 request_gcm_statistics_callback_.Run(stats); 760 request_gcm_statistics_callback_.Run(stats);
757 else 761 else
758 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL."; 762 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL.";
759 } 763 }
760 764
761 } // namespace gcm 765 } // namespace gcm
762 766
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop.h ('k') | google_apis/gcm/engine/gcm_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698