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 "cloud_print/gcp20/prototype/printer.h" | 5 #include "cloud_print/gcp20/prototype/printer.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 if (reg_info_.state != RegistrationInfo::DEV_REG_REGISTRATION_STARTED && | 233 if (reg_info_.state != RegistrationInfo::DEV_REG_REGISTRATION_STARTED && |
234 reg_info_.state != | 234 reg_info_.state != |
235 RegistrationInfo::DEV_REG_REGISTRATION_CLAIM_TOKEN_READY) | 235 RegistrationInfo::DEV_REG_REGISTRATION_CLAIM_TOKEN_READY) |
236 return PrivetHttpServer::REG_ERROR_INVALID_ACTION; | 236 return PrivetHttpServer::REG_ERROR_INVALID_ACTION; |
237 | 237 |
238 // If |action=getClaimToken| is valid in this state (was checked above) then | 238 // If |action=getClaimToken| is valid in this state (was checked above) then |
239 // check confirmation status. | 239 // check confirmation status. |
240 if (reg_info_.confirmation_state != RegistrationInfo::CONFIRMATION_CONFIRMED) | 240 if (reg_info_.confirmation_state != RegistrationInfo::CONFIRMATION_CONFIRMED) |
241 return ConfirmationToRegistrationError(reg_info_.confirmation_state); | 241 return ConfirmationToRegistrationError(reg_info_.confirmation_state); |
242 | 242 |
243 // If reply wasn't received yet, reply with |device_busy| error. | 243 // If reply wasn't received yet, reply with |pending_user_action| error. |
244 if (reg_info_.state == RegistrationInfo::DEV_REG_REGISTRATION_STARTED) | 244 if (reg_info_.state == RegistrationInfo::DEV_REG_REGISTRATION_STARTED) |
245 return PrivetHttpServer::REG_ERROR_DEVICE_BUSY; | 245 return PrivetHttpServer::REG_ERROR_PENDING_USER_ACTION; |
246 | 246 |
247 DCHECK_EQ(reg_info_.state, | 247 DCHECK_EQ(reg_info_.state, |
248 RegistrationInfo::DEV_REG_REGISTRATION_CLAIM_TOKEN_READY); | 248 RegistrationInfo::DEV_REG_REGISTRATION_CLAIM_TOKEN_READY); |
249 DCHECK_EQ(reg_info_.confirmation_state, | 249 DCHECK_EQ(reg_info_.confirmation_state, |
250 RegistrationInfo::CONFIRMATION_CONFIRMED); | 250 RegistrationInfo::CONFIRMATION_CONFIRMED); |
251 | 251 |
252 *token = reg_info_.registration_token; | 252 *token = reg_info_.registration_token; |
253 *claim_url = reg_info_.complete_invite_url; | 253 *claim_url = reg_info_.complete_invite_url; |
254 return PrivetHttpServer::REG_ERROR_OK; | 254 return PrivetHttpServer::REG_ERROR_OK; |
255 } | 255 } |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 case NOT_CONFIGURED: | 786 case NOT_CONFIGURED: |
787 break; | 787 break; |
788 | 788 |
789 default: | 789 default: |
790 NOTREACHED(); | 790 NOTREACHED(); |
791 } | 791 } |
792 | 792 |
793 return true; | 793 return true; |
794 } | 794 } |
795 | 795 |
OLD | NEW |