| 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 "chrome/browser/services/gcm/push_messaging_service_impl.h" | 5 #include "chrome/browser/services/gcm/push_messaging_service_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 const content::PushMessagingService::RegisterCallback& callback, | 250 const content::PushMessagingService::RegisterCallback& callback, |
| 251 const std::string& registration_id, | 251 const std::string& registration_id, |
| 252 GCMClient::Result result) { | 252 GCMClient::Result result) { |
| 253 content::PushMessagingStatus status = | 253 content::PushMessagingStatus status = |
| 254 result == GCMClient::SUCCESS | 254 result == GCMClient::SUCCESS |
| 255 ? content::PUSH_MESSAGING_STATUS_OK | 255 ? content::PUSH_MESSAGING_STATUS_OK |
| 256 : content::PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_SERVICE_ERROR; | 256 : content::PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_SERVICE_ERROR; |
| 257 RegisterEnd(callback, registration_id, status); | 257 RegisterEnd(callback, registration_id, status); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void PushMessagingServiceImpl::SetProfileForTesting(Profile* profile) { |
| 261 profile_ = profile; |
| 262 } |
| 263 |
| 260 void PushMessagingServiceImpl::DidRequestPermission( | 264 void PushMessagingServiceImpl::DidRequestPermission( |
| 261 const PushMessagingApplicationId& application_id, | 265 const PushMessagingApplicationId& application_id, |
| 262 const std::string& sender_id, | 266 const std::string& sender_id, |
| 263 const content::PushMessagingService::RegisterCallback& register_callback, | 267 const content::PushMessagingService::RegisterCallback& register_callback, |
| 264 bool allow) { | 268 bool allow) { |
| 265 if (!allow) { | 269 if (!allow) { |
| 266 RegisterEnd( | 270 RegisterEnd( |
| 267 register_callback, | 271 register_callback, |
| 268 std::string(), | 272 std::string(), |
| 269 content::PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_PERMISSION_DENIED); | 273 content::PUSH_MESSAGING_STATUS_REGISTRATION_FAILED_PERMISSION_DENIED); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 281 sender_ids, | 285 sender_ids, |
| 282 base::Bind(&PushMessagingServiceImpl::DidRegister, | 286 base::Bind(&PushMessagingServiceImpl::DidRegister, |
| 283 weak_factory_.GetWeakPtr(), | 287 weak_factory_.GetWeakPtr(), |
| 284 register_callback)); | 288 register_callback)); |
| 285 } | 289 } |
| 286 | 290 |
| 287 // TODO(johnme): Unregister should decrement the pref, and call | 291 // TODO(johnme): Unregister should decrement the pref, and call |
| 288 // RemoveAppHandler if the count drops to zero. | 292 // RemoveAppHandler if the count drops to zero. |
| 289 | 293 |
| 290 } // namespace gcm | 294 } // namespace gcm |
| OLD | NEW |