OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sync/notifier/push_client_channel.h" | 5 #include "sync/notifier/push_client_channel.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "google/cacheinvalidation/v2/client_gateway.pb.h" | 8 #include "google/cacheinvalidation/v2/client_gateway.pb.h" |
9 #include "jingle/notifier/listener/push_client.h" | 9 #include "jingle/notifier/listener/push_client.h" |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 invalidation::NetworkStatusCallback* network_status_receiver) { | 55 invalidation::NetworkStatusCallback* network_status_receiver) { |
56 network_status_receiver->Run(notifications_enabled_); | 56 network_status_receiver->Run(notifications_enabled_); |
57 network_status_receivers_.push_back(network_status_receiver); | 57 network_status_receivers_.push_back(network_status_receiver); |
58 } | 58 } |
59 | 59 |
60 void PushClientChannel::SetSystemResources( | 60 void PushClientChannel::SetSystemResources( |
61 invalidation::SystemResources* resources) { | 61 invalidation::SystemResources* resources) { |
62 // Do nothing. | 62 // Do nothing. |
63 } | 63 } |
64 | 64 |
65 void PushClientChannel::OnNotificationStateChange( | 65 void PushClientChannel::OnPushClientStateChange( |
66 bool notifications_enabled) { | 66 notifier::PushClientState push_client_state) { |
67 for (NetworkStatusReceiverList::const_iterator it = | 67 for (NetworkStatusReceiverList::const_iterator it = |
68 network_status_receivers_.begin(); | 68 network_status_receivers_.begin(); |
69 it != network_status_receivers_.end(); ++it) { | 69 it != network_status_receivers_.end(); ++it) { |
70 (*it)->Run(notifications_enabled); | 70 (*it)->Run(push_client_state == notifier::NOTIFICATIONS_ON); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 void PushClientChannel::OnIncomingNotification( | 74 void PushClientChannel::OnIncomingNotification( |
75 const notifier::Notification& notification) { | 75 const notifier::Notification& notification) { |
76 if (!incoming_receiver_.get()) { | 76 if (!incoming_receiver_.get()) { |
77 DLOG(ERROR) << "No receiver for incoming notification"; | 77 DLOG(ERROR) << "No receiver for incoming notification"; |
78 return; | 78 return; |
79 } | 79 } |
80 std::string message; | 80 std::string message; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if (envelope.has_service_context()) { | 142 if (envelope.has_service_context()) { |
143 *service_context = envelope.service_context(); | 143 *service_context = envelope.service_context(); |
144 } | 144 } |
145 if (envelope.has_rpc_scheduling_hash()) { | 145 if (envelope.has_rpc_scheduling_hash()) { |
146 *scheduling_hash = envelope.rpc_scheduling_hash(); | 146 *scheduling_hash = envelope.rpc_scheduling_hash(); |
147 } | 147 } |
148 return true; | 148 return true; |
149 } | 149 } |
150 | 150 |
151 } // namespace sync_notifier | 151 } // namespace sync_notifier |
OLD | NEW |