OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/extensions/api/gcm/gcm_api.h" | 5 #include "chrome/browser/extensions/api/gcm/gcm_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 SendResponse(gcm::GCMClient::SUCCESS == result); | 128 SendResponse(gcm::GCMClient::SUCCESS == result); |
129 } | 129 } |
130 | 130 |
131 GcmUnregisterFunction::GcmUnregisterFunction() {} | 131 GcmUnregisterFunction::GcmUnregisterFunction() {} |
132 | 132 |
133 GcmUnregisterFunction::~GcmUnregisterFunction() {} | 133 GcmUnregisterFunction::~GcmUnregisterFunction() {} |
134 | 134 |
135 bool GcmUnregisterFunction::DoWork() { | 135 bool GcmUnregisterFunction::DoWork() { |
136 UMA_HISTOGRAM_BOOLEAN("GCM.APICallUnregister", true); | 136 UMA_HISTOGRAM_BOOLEAN("GCM.APICallUnregister", true); |
137 | 137 |
| 138 #if defined(OS_ANDROID) |
| 139 LOG(FATAL) << "GcmUnregisterFunction is not implemented on Android"; |
| 140 #else |
| 141 std::vector<std::string> sender_ids; // These are ignored on desktop. |
138 GetGCMDriver()->Unregister( | 142 GetGCMDriver()->Unregister( |
139 extension()->id(), | 143 extension()->id(), |
| 144 sender_ids, |
140 base::Bind(&GcmUnregisterFunction::CompleteFunctionWithResult, this)); | 145 base::Bind(&GcmUnregisterFunction::CompleteFunctionWithResult, this)); |
141 | 146 |
142 return true; | 147 return true; |
| 148 #endif |
143 } | 149 } |
144 | 150 |
145 void GcmUnregisterFunction::CompleteFunctionWithResult( | 151 void GcmUnregisterFunction::CompleteFunctionWithResult( |
146 gcm::GCMClient::Result result) { | 152 gcm::GCMClient::Result result) { |
147 SetError(GcmResultToError(result)); | 153 SetError(GcmResultToError(result)); |
148 SendResponse(gcm::GCMClient::SUCCESS == result); | 154 SendResponse(gcm::GCMClient::SUCCESS == result); |
149 } | 155 } |
150 | 156 |
151 GcmSendFunction::GcmSendFunction() {} | 157 GcmSendFunction::GcmSendFunction() {} |
152 | 158 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 error.details.additional_properties = send_error_details.additional_data; | 245 error.details.additional_properties = send_error_details.additional_data; |
240 | 246 |
241 scoped_ptr<Event> event(new Event( | 247 scoped_ptr<Event> event(new Event( |
242 api::gcm::OnSendError::kEventName, | 248 api::gcm::OnSendError::kEventName, |
243 api::gcm::OnSendError::Create(error).Pass(), | 249 api::gcm::OnSendError::Create(error).Pass(), |
244 profile_)); | 250 profile_)); |
245 EventRouter::Get(profile_)->DispatchEventToExtension(app_id, event.Pass()); | 251 EventRouter::Get(profile_)->DispatchEventToExtension(app_id, event.Pass()); |
246 } | 252 } |
247 | 253 |
248 } // namespace extensions | 254 } // namespace extensions |
OLD | NEW |