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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 if (callback_iter == send_callbacks_.end()) { | 739 if (callback_iter == send_callbacks_.end()) { |
740 // The callback could have been removed when the app is uninstalled. | 740 // The callback could have been removed when the app is uninstalled. |
741 return; | 741 return; |
742 } | 742 } |
743 | 743 |
744 SendCallback callback = callback_iter->second; | 744 SendCallback callback = callback_iter->second; |
745 send_callbacks_.erase(callback_iter); | 745 send_callbacks_.erase(callback_iter); |
746 callback.Run(message_id, result); | 746 callback.Run(message_id, result); |
747 } | 747 } |
748 | 748 |
749 void GCMDriverDesktop::MessageReceived(const std::string& app_id, | 749 void GCMDriverDesktop::MessageReceived( |
750 GCMClient::IncomingMessage message) { | 750 const std::string& app_id, |
| 751 const GCMClient::IncomingMessage& message) { |
751 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); | 752 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); |
752 | 753 |
753 // Drop the event if signed out. | 754 // Drop the event if signed out. |
754 if (account_id_.empty()) | 755 if (account_id_.empty()) |
755 return; | 756 return; |
756 | 757 |
757 GetAppHandler(app_id)->OnMessage(app_id, message); | 758 GetAppHandler(app_id)->OnMessage(app_id, message); |
758 } | 759 } |
759 | 760 |
760 void GCMDriverDesktop::MessagesDeleted(const std::string& app_id) { | 761 void GCMDriverDesktop::MessagesDeleted(const std::string& app_id) { |
(...skipping 22 matching lines...) Expand all Loading... |
783 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); | 784 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); |
784 | 785 |
785 if (gcm_client_ready_) | 786 if (gcm_client_ready_) |
786 return; | 787 return; |
787 gcm_client_ready_ = true; | 788 gcm_client_ready_ = true; |
788 | 789 |
789 delayed_task_controller_->SetReady(); | 790 delayed_task_controller_->SetReady(); |
790 } | 791 } |
791 | 792 |
792 void GCMDriverDesktop::GetGCMStatisticsFinished( | 793 void GCMDriverDesktop::GetGCMStatisticsFinished( |
793 GCMClient::GCMStatistics stats) { | 794 const GCMClient::GCMStatistics& stats) { |
794 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); | 795 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); |
795 | 796 |
796 // Normally request_gcm_statistics_callback_ would not be null. | 797 // Normally request_gcm_statistics_callback_ would not be null. |
797 if (!request_gcm_statistics_callback_.is_null()) | 798 if (!request_gcm_statistics_callback_.is_null()) |
798 request_gcm_statistics_callback_.Run(stats); | 799 request_gcm_statistics_callback_.Run(stats); |
799 else | 800 else |
800 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL."; | 801 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL."; |
801 } | 802 } |
802 | 803 |
803 std::string GCMDriverDesktop::SignedInUserName() const { | 804 std::string GCMDriverDesktop::SignedInUserName() const { |
804 if (IsStarted()) | 805 if (IsStarted()) |
805 return identity_provider_->GetActiveUsername(); | 806 return identity_provider_->GetActiveUsername(); |
806 return std::string(); | 807 return std::string(); |
807 } | 808 } |
808 | 809 |
809 } // namespace gcm | 810 } // namespace gcm |
OLD | NEW |