| 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..c225d80f85375a51f4ca0f72f9e677bf78d5dc37 100644
|
| --- a/cloud_print/gcp20/prototype/printer.h
|
| +++ b/cloud_print/gcp20/prototype/printer.h
|
| @@ -13,7 +13,7 @@
|
| #include "cloud_print/gcp20/prototype/privet_http_server.h"
|
| #include "cloud_print/gcp20/prototype/x_privet_token.h"
|
|
|
| -extern const char* kPrinterStatePath;
|
| +extern const char kPrinterStatePath[];
|
|
|
| // This class maintain work of DNS-SD server, HTTP server and others.
|
| class Printer : public PrivetHttpServer::Delegate,
|
| @@ -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_DISCARDED,
|
| + 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_;
|
|
|
|
|