Index: cloud_print/gcp20/prototype/printer.h |
diff --git a/cloud_print/gcp20/prototype/printer.h b/cloud_print/gcp20/prototype/printer.h |
index 1a23f24ad3d233da313bcd616d85f7e212eb121d..7cc3272d06b81bfef2110db11712904e91abd1e4 100644 |
--- a/cloud_print/gcp20/prototype/printer.h |
+++ b/cloud_print/gcp20/prototype/printer.h |
@@ -37,7 +37,7 @@ class Printer : public PrivetHttpServer::Delegate, |
private: |
struct RegistrationInfo { |
enum RegistrationState { |
- DEV_REG_UNREGISTERED = 0, |
+ DEV_REG_UNREGISTERED, |
DEV_REG_REGISTRATION_STARTED, |
DEV_REG_REGISTRATION_CLAIM_TOKEN_READY, |
DEV_REG_REGISTRATION_COMPLETING, |
@@ -45,6 +45,13 @@ class Printer : public PrivetHttpServer::Delegate, |
DEV_REG_REGISTERED, |
}; |
+ enum ConfirmationState { |
+ CONFIRMATION_PENDING, |
+ CONFIRMATION_CONFIRMED, |
+ CONFIRMATION_DISCARTED, |
+ CONFIRMATION_TIMEOUT, |
+ }; |
+ |
RegistrationInfo(); |
~RegistrationInfo(); |
@@ -52,6 +59,7 @@ class Printer : public PrivetHttpServer::Delegate, |
std::string refresh_token; |
std::string device_id; |
RegistrationState state; |
+ ConfirmationState confirmation_state; |
std::string registration_token; |
std::string complete_invite_url; |
@@ -102,15 +110,22 @@ class Printer : public PrivetHttpServer::Delegate, |
// Generates ProxyId for this device. |
std::string GenerateProxyId() const; |
+ // Checks if confirmation was received. |
+ void WaitUserConfirmation(base::Time valid_until); |
+ |
// Creates data for DNS TXT respond. |
std::vector<std::string> CreateTxt() const; |
- RegistrationInfo reg_info_; |
- |
// Saving and loading registration info from file. |
void SaveToFile(const std::string& filename) const; |
bool LoadFromFile(const std::string& filename); |
+ // Converts errors. |
+ PrivetHttpServer::RegistrationErrorStatus ConfirmationToRegistrationError( |
+ RegistrationInfo::ConfirmationState state); |
+ |
+ RegistrationInfo reg_info_; |
+ |
// Contains DNS-SD server. |
DnsSdServer dns_server_; |