OLD | NEW |
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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 class GCMDriverDesktop::IOWorker : public GCMClient::Delegate { | 29 class GCMDriverDesktop::IOWorker : public GCMClient::Delegate { |
30 public: | 30 public: |
31 // Called on UI thread. | 31 // Called on UI thread. |
32 IOWorker(const scoped_refptr<base::SequencedTaskRunner>& ui_thread, | 32 IOWorker(const scoped_refptr<base::SequencedTaskRunner>& ui_thread, |
33 const scoped_refptr<base::SequencedTaskRunner>& io_thread); | 33 const scoped_refptr<base::SequencedTaskRunner>& io_thread); |
34 virtual ~IOWorker(); | 34 virtual ~IOWorker(); |
35 | 35 |
36 // Overridden from GCMClient::Delegate: | 36 // Overridden from GCMClient::Delegate: |
37 // Called on IO thread. | 37 // Called on IO thread. |
38 virtual void OnRegisterFinished(const std::string& app_id, | 38 void OnRegisterFinished(const std::string& app_id, |
39 const std::string& registration_id, | 39 const std::string& registration_id, |
40 GCMClient::Result result) override; | 40 GCMClient::Result result) override; |
41 virtual void OnUnregisterFinished(const std::string& app_id, | 41 void OnUnregisterFinished(const std::string& app_id, |
42 GCMClient::Result result) override; | 42 GCMClient::Result result) override; |
43 virtual void OnSendFinished(const std::string& app_id, | 43 void OnSendFinished(const std::string& app_id, |
44 const std::string& message_id, | 44 const std::string& message_id, |
45 GCMClient::Result result) override; | 45 GCMClient::Result result) override; |
46 virtual void OnMessageReceived( | 46 void OnMessageReceived(const std::string& app_id, |
47 const std::string& app_id, | 47 const GCMClient::IncomingMessage& message) override; |
48 const GCMClient::IncomingMessage& message) override; | 48 void OnMessagesDeleted(const std::string& app_id) override; |
49 virtual void OnMessagesDeleted(const std::string& app_id) override; | 49 void OnMessageSendError( |
50 virtual void OnMessageSendError( | |
51 const std::string& app_id, | 50 const std::string& app_id, |
52 const GCMClient::SendErrorDetails& send_error_details) override; | 51 const GCMClient::SendErrorDetails& send_error_details) override; |
53 virtual void OnSendAcknowledged(const std::string& app_id, | 52 void OnSendAcknowledged(const std::string& app_id, |
54 const std::string& message_id) override; | 53 const std::string& message_id) override; |
55 virtual void OnGCMReady( | 54 void OnGCMReady(const std::vector<AccountMapping>& account_mappings) override; |
56 const std::vector<AccountMapping>& account_mappings) override; | 55 void OnActivityRecorded() override; |
57 virtual void OnActivityRecorded() override; | 56 void OnConnected(const net::IPEndPoint& ip_endpoint) override; |
58 virtual void OnConnected(const net::IPEndPoint& ip_endpoint) override; | 57 void OnDisconnected() override; |
59 virtual void OnDisconnected() override; | |
60 | 58 |
61 // Called on IO thread. | 59 // Called on IO thread. |
62 void Initialize( | 60 void Initialize( |
63 scoped_ptr<GCMClientFactory> gcm_client_factory, | 61 scoped_ptr<GCMClientFactory> gcm_client_factory, |
64 const GCMClient::ChromeBuildInfo& chrome_build_info, | 62 const GCMClient::ChromeBuildInfo& chrome_build_info, |
65 const base::FilePath& store_path, | 63 const base::FilePath& store_path, |
66 const scoped_refptr<net::URLRequestContextGetter>& request_context, | 64 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
67 const scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); | 65 const scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); |
68 void Start(const base::WeakPtr<GCMDriverDesktop>& service); | 66 void Start(const base::WeakPtr<GCMDriverDesktop>& service); |
69 void Stop(); | 67 void Stop(); |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 | 785 |
788 // Normally request_gcm_statistics_callback_ would not be null. | 786 // Normally request_gcm_statistics_callback_ would not be null. |
789 if (!request_gcm_statistics_callback_.is_null()) | 787 if (!request_gcm_statistics_callback_.is_null()) |
790 request_gcm_statistics_callback_.Run(stats); | 788 request_gcm_statistics_callback_.Run(stats); |
791 else | 789 else |
792 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL."; | 790 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL."; |
793 } | 791 } |
794 | 792 |
795 } // namespace gcm | 793 } // namespace gcm |
796 | 794 |
OLD | NEW |