Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / cloud_print / service / service_state.h
blob2c051f6da4bad45f54886f0699770f89a21f75fc
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CLOUD_PRINT_SERVICE_SERVICE_STATE_H_
6 #define CLOUD_PRINT_SERVICE_SERVICE_STATE_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/values.h"
13 // Manages Cloud Print part of Service State.
14 class ServiceState {
15 public:
16 ServiceState();
17 virtual ~ServiceState();
19 void Reset();
21 // Initialize object from json.
22 bool FromString(const std::string& json);
24 // Returns object state as json.
25 std::string ToString();
27 // Setups object using data provided by delegate.
28 bool Configure(const std::string& email,
29 const std::string& password,
30 const std::string& proxy_id);
32 // Returns authentication token provided by Google server.
33 virtual std::string LoginToGoogle(const std::string& service,
34 const std::string& email,
35 const std::string& password);
37 // Returns true of object state is valid.
38 bool IsValid() const;
40 std::string email() const {
41 return email_;
44 std::string proxy_id() const {
45 return proxy_id_;
48 std::string robot_email() const {
49 return robot_email_;
52 std::string robot_token() const {
53 return robot_token_;
56 std::string auth_token() const {
57 return auth_token_;
60 std::string xmpp_auth_token() const {
61 return xmpp_auth_token_;
64 void set_email(const std::string& value) {
65 email_ = value;
68 void set_proxy_id(const std::string& value) {
69 proxy_id_ = value;
72 void set_robot_email(const std::string& value) {
73 robot_email_ = value;
76 void set_robot_token(const std::string& value) {
77 robot_token_ = value;
80 void set_auth_token(const std::string& value) {
81 auth_token_ = value;
84 void set_xmpp_auth_token(const std::string& value) {
85 xmpp_auth_token_ = value;
88 private:
89 std::string email_;
90 std::string proxy_id_;
91 std::string robot_email_;
92 std::string robot_token_;
93 std::string auth_token_;
94 std::string xmpp_auth_token_;
96 DISALLOW_COPY_AND_ASSIGN(ServiceState);
99 #endif // CLOUD_PRINT_SERVICE_SERVICE_STATE_H_