OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/instance_id/instance_id_impl.h" | 5 #include "components/gcm_driver/instance_id/instance_id_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 InstanceID::Result GCMClientResultToInstanceIDResult( | 25 InstanceID::Result GCMClientResultToInstanceIDResult( |
26 gcm::GCMClient::Result result) { | 26 gcm::GCMClient::Result result) { |
27 switch (result) { | 27 switch (result) { |
28 case gcm::GCMClient::SUCCESS: | 28 case gcm::GCMClient::SUCCESS: |
29 return InstanceID::SUCCESS; | 29 return InstanceID::SUCCESS; |
30 case gcm::GCMClient::INVALID_PARAMETER: | 30 case gcm::GCMClient::INVALID_PARAMETER: |
31 return InstanceID::INVALID_PARAMETER; | 31 return InstanceID::INVALID_PARAMETER; |
| 32 case gcm::GCMClient::GCM_DISABLED: |
| 33 return InstanceID::DISABLED; |
32 case gcm::GCMClient::ASYNC_OPERATION_PENDING: | 34 case gcm::GCMClient::ASYNC_OPERATION_PENDING: |
33 return InstanceID::ASYNC_OPERATION_PENDING; | 35 return InstanceID::ASYNC_OPERATION_PENDING; |
34 case gcm::GCMClient::GCM_DISABLED: | |
35 return InstanceID::DISABLED; | |
36 case gcm::GCMClient::NETWORK_ERROR: | 36 case gcm::GCMClient::NETWORK_ERROR: |
37 return InstanceID::NETWORK_ERROR; | 37 return InstanceID::NETWORK_ERROR; |
38 case gcm::GCMClient::SERVER_ERROR: | 38 case gcm::GCMClient::SERVER_ERROR: |
39 return InstanceID::SERVER_ERROR; | 39 return InstanceID::SERVER_ERROR; |
40 case gcm::GCMClient::UNKNOWN_ERROR: | 40 case gcm::GCMClient::UNKNOWN_ERROR: |
41 return InstanceID::UNKNOWN_ERROR; | 41 return InstanceID::UNKNOWN_ERROR; |
42 default: | 42 case gcm::GCMClient::TTL_EXCEEDED: |
43 NOTREACHED() << "Unexpected value of result cannot be converted: " | 43 NOTREACHED(); |
44 << result; | 44 break; |
45 } | 45 } |
46 return InstanceID::UNKNOWN_ERROR; | 46 return InstanceID::UNKNOWN_ERROR; |
47 } | 47 } |
48 | 48 |
49 } // namespace | 49 } // namespace |
50 | 50 |
51 // static | 51 // static |
52 std::unique_ptr<InstanceID> InstanceID::CreateInternal( | 52 std::unique_ptr<InstanceID> InstanceID::CreateInternal( |
53 const std::string& app_id, | 53 const std::string& app_id, |
54 gcm::GCMDriver* gcm_driver) { | 54 gcm::GCMDriver* gcm_driver) { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 | 270 |
271 gcm::InstanceIDHandler* InstanceIDImpl::Handler() { | 271 gcm::InstanceIDHandler* InstanceIDImpl::Handler() { |
272 gcm::InstanceIDHandler* handler = | 272 gcm::InstanceIDHandler* handler = |
273 gcm_driver()->GetInstanceIDHandlerInternal(); | 273 gcm_driver()->GetInstanceIDHandlerInternal(); |
274 DCHECK(handler); | 274 DCHECK(handler); |
275 return handler; | 275 return handler; |
276 } | 276 } |
277 | 277 |
278 } // namespace instance_id | 278 } // namespace instance_id |
OLD | NEW |