Chromium Code Reviews| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 SetResult(new base::StringValue(registration_id)); | 126 SetResult(new base::StringValue(registration_id)); |
| 127 SetError(GcmResultToError(result)); | 127 SetError(GcmResultToError(result)); |
| 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 #if defined(OS_ANDROID) | |
|
jianli
2015/02/13 22:33:16
gcm_api.cc is not supposed to be included for Andr
johnme
2015/02/14 01:48:35
The patch no longer modifies this file.
| |
| 137 #error If this ever gets ported to Android, you must pass the real sender ID. | |
| 138 #endif | |
| 136 UMA_HISTOGRAM_BOOLEAN("GCM.APICallUnregister", true); | 139 UMA_HISTOGRAM_BOOLEAN("GCM.APICallUnregister", true); |
| 137 | 140 |
| 141 std::vector<std::string> sender_ids; // These are ignored on non-Android. | |
| 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; |
| 143 } | 148 } |
| 144 | 149 |
| 145 void GcmUnregisterFunction::CompleteFunctionWithResult( | 150 void GcmUnregisterFunction::CompleteFunctionWithResult( |
| 146 gcm::GCMClient::Result result) { | 151 gcm::GCMClient::Result result) { |
| 147 SetError(GcmResultToError(result)); | 152 SetError(GcmResultToError(result)); |
| 148 SendResponse(gcm::GCMClient::SUCCESS == result); | 153 SendResponse(gcm::GCMClient::SUCCESS == result); |
| 149 } | 154 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 error.details.additional_properties = send_error_details.additional_data; | 244 error.details.additional_properties = send_error_details.additional_data; |
| 240 | 245 |
| 241 scoped_ptr<Event> event(new Event( | 246 scoped_ptr<Event> event(new Event( |
| 242 api::gcm::OnSendError::kEventName, | 247 api::gcm::OnSendError::kEventName, |
| 243 api::gcm::OnSendError::Create(error).Pass(), | 248 api::gcm::OnSendError::Create(error).Pass(), |
| 244 profile_)); | 249 profile_)); |
| 245 EventRouter::Get(profile_)->DispatchEventToExtension(app_id, event.Pass()); | 250 EventRouter::Get(profile_)->DispatchEventToExtension(app_id, event.Pass()); |
| 246 } | 251 } |
| 247 | 252 |
| 248 } // namespace extensions | 253 } // namespace extensions |
| OLD | NEW |