Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: cloud_print/gcp20/prototype/printer.h

Issue 22184007: GCP2.0 Device: Instant AccessToken update on AuthFailed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cloud_print/gcp20/prototype/printer.h
diff --git a/cloud_print/gcp20/prototype/printer.h b/cloud_print/gcp20/prototype/printer.h
index fab918956f0cf7905b5f18ce6c48d4886591cb9d..5b734ae6fcaab0845e453447d387b24467b24c3a 100644
--- a/cloud_print/gcp20/prototype/printer.h
+++ b/cloud_print/gcp20/prototype/printer.h
@@ -115,7 +115,7 @@ class Printer : public base::SupportsWeakPtr<Printer>,
const std::string& registration_token,
const std::string& complete_invite_url,
const std::string& device_id) OVERRIDE;
- virtual void OnGetAuthCodeResponseParsed(
+ virtual void OnRegistrationFinished(
const std::string& refresh_token,
const std::string& access_token,
int access_token_expires_in_seconds) OVERRIDE;
@@ -165,11 +165,17 @@ class Printer : public base::SupportsWeakPtr<Printer>,
void RememberAccessToken(const std::string& access_token,
int expires_in_seconds);
+ // Sets registration state to error and adds description.
+ void SetRegistrationError(const std::string& description);
+
+ //
Vitaly Buka (NO REVIEWS) 2013/08/15 17:48:06 ??
maksymb 2013/08/15 18:39:13 Unnecessary declaration deleted.
+ void RegistrationTimeout();
+
// Checks if register call is called correctly (|user| is correct,
// error is no set etc). Returns |false| if error status is put into |status|.
// Otherwise no error was occurred.
PrivetHttpServer::RegistrationErrorStatus CheckCommonRegErrors(
- const std::string& user) const;
+ const std::string& user);
// Checks if confirmation was received.
void WaitUserConfirmation(base::Time valid_until);
@@ -187,13 +193,26 @@ class Printer : public base::SupportsWeakPtr<Printer>,
// Adds |OnIdle| method to the MessageLoop.
void PostOnIdle();
+ // Registration timeout.
+ void CheckRegistrationExpiration();
+
+ // Delays expiration after user action.
+ void UpdateRegistrationExpiration();
+
+ // Deletes registration expiration at all.
+ void InvalidateRegistrationExpiration();
+
// Converts errors.
PrivetHttpServer::RegistrationErrorStatus ConfirmationToRegistrationError(
RegistrationInfo::ConfirmationState state);
std::string ConnectionStateToString(ConnectionState state) const;
- // Changes state and update info in DNS server.
+ // Changes state to OFFLINE and posts TryReconnect.
+ void FallOffline(bool instant_reconnect);
+
+ // Changes state and update info in DNS server. Returns |true| if state
+ // was changed (otherwise state was the same).
bool ChangeState(ConnectionState new_state);
RegistrationInfo reg_info_;
@@ -224,6 +243,9 @@ class Printer : public base::SupportsWeakPtr<Printer>,
// Uses for calculating uptime.
base::Time starttime_;
+ // Uses to validate registration timeout.
+ base::Time registration_expiration_;
+
// Used for preventing two and more OnIdle posted in message loop.
bool on_idle_posted_;

Powered by Google App Engine
This is Rietveld 408576698