summaryrefslogtreecommitdiffstats
path: root/cloud_print/gcp20/prototype/printer_state.h
diff options
context:
space:
mode:
authormaksymb@chromium.org <maksymb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-17 13:31:37 +0000
committermaksymb@chromium.org <maksymb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-17 13:31:37 +0000
commitdca278b617ec9f000387b25425db651171c4697f (patch)
tree4fea1ff1699872e1c52e5dd0cbd1fedc6c625ee2 /cloud_print/gcp20/prototype/printer_state.h
parent8285bbe0a509c70067587d935e860b4aafb64be9 (diff)
downloadchromium_src-dca278b617ec9f000387b25425db651171c4697f.zip
chromium_src-dca278b617ec9f000387b25425db651171c4697f.tar.gz
chromium_src-dca278b617ec9f000387b25425db651171c4697f.tar.bz2
GCP2.0 Device: Refactor: PrinterState is now separate from Printer
Also all I/O deleted from Printer class BUG= Review URL: https://chromiumcodereview.appspot.com/22647005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cloud_print/gcp20/prototype/printer_state.h')
-rw-r--r--cloud_print/gcp20/prototype/printer_state.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/cloud_print/gcp20/prototype/printer_state.h b/cloud_print/gcp20/prototype/printer_state.h
new file mode 100644
index 0000000..6ad0554
--- /dev/null
+++ b/cloud_print/gcp20/prototype/printer_state.h
@@ -0,0 +1,74 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CLOUD_PRINT_GCP20_PROTOTYPE_PRINTER_STATE_H_
+#define CLOUD_PRINT_GCP20_PROTOTYPE_PRINTER_STATE_H_
+
+#include <string>
+
+#include "base/time/time.h"
+#include "cloud_print/gcp20/prototype/local_settings.h"
+
+namespace base {
+
+class FilePath;
+
+} // namespace base
+
+struct PrinterState {
+ enum RegistrationState {
+ UNREGISTERED,
+ REGISTRATION_STARTED, // |action=start| was called,
+ // request to CloudPrint was sent.
+ REGISTRATION_CLAIM_TOKEN_READY, // The same as previous, but request
+ // reply is already received.
+ REGISTRATION_COMPLETING, // |action=complete| was called,
+ // |complete| request was sent.
+ REGISTRATION_ERROR, // Is set when server error was occurred.
+ REGISTERED,
+ };
+
+ enum ConfirmationState {
+ CONFIRMATION_PENDING,
+ CONFIRMATION_CONFIRMED,
+ CONFIRMATION_DISCARDED,
+ CONFIRMATION_TIMEOUT,
+ };
+
+ PrinterState();
+ ~PrinterState();
+
+ // Registration process info
+ std::string user;
+ std::string registration_token;
+ std::string complete_invite_url;
+ RegistrationState registration_state;
+ ConfirmationState confirmation_state;
+
+ // Printer workflow info
+ std::string refresh_token;
+ std::string device_id;
+ std::string xmpp_jid;
+ LocalSettings local_settings;
+
+ // Last valid |access_token|.
+ std::string access_token;
+ base::Time access_token_update;
+
+ // Contains error if |REGISTRATION_ERROR| is set.
+ std::string error_description;
+};
+
+namespace printer_state {
+
+//
+bool SaveToFile(const base::FilePath& path, const PrinterState& state);
+
+//
+bool LoadFromFile(const base::FilePath& path, PrinterState* state);
+
+} // namespace printer_state
+
+#endif // CLOUD_PRINT_GCP20_PROTOTYPE_PRINTER_STATE_H_
+