summaryrefslogtreecommitdiffstats
path: root/cloud_print/service/service_state.h
blob: 2c051f6da4bad45f54886f0699770f89a21f75fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Copyright (c) 2012 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_SERVICE_SERVICE_STATE_H_
#define CLOUD_PRINT_SERVICE_SERVICE_STATE_H_

#include <string>

#include "base/memory/scoped_ptr.h"
#include "base/values.h"

// Manages Cloud Print part of Service State.
class ServiceState {
 public:
  ServiceState();
  virtual ~ServiceState();

  void Reset();

  // Initialize object from json.
  bool FromString(const std::string& json);

  // Returns object state as json.
  std::string ToString();

  // Setups object using data provided by delegate.
  bool Configure(const std::string& email,
                 const std::string& password,
                 const std::string& proxy_id);

  // Returns authentication token provided by Google server.
  virtual std::string LoginToGoogle(const std::string& service,
                                    const std::string& email,
                                    const std::string& password);

  // Returns true of object state is valid.
  bool IsValid() const;

  std::string email() const {
    return email_;
  };

  std::string proxy_id() const {
    return proxy_id_;
  };

  std::string robot_email() const {
    return robot_email_;
  };

  std::string robot_token() const {
    return robot_token_;
  };

  std::string auth_token() const {
    return auth_token_;
  };

  std::string xmpp_auth_token() const {
    return xmpp_auth_token_;
  };

  void set_email(const std::string& value) {
    email_ = value;
  };

  void set_proxy_id(const std::string& value) {
    proxy_id_ = value;
  };

  void set_robot_email(const std::string& value) {
    robot_email_ = value;
  };

  void set_robot_token(const std::string& value) {
    robot_token_ = value;
  };

  void set_auth_token(const std::string& value) {
    auth_token_ = value;
  };

  void set_xmpp_auth_token(const std::string& value) {
    xmpp_auth_token_ = value;
  };

 private:
  std::string email_;
  std::string proxy_id_;
  std::string robot_email_;
  std::string robot_token_;
  std::string auth_token_;
  std::string xmpp_auth_token_;

  DISALLOW_COPY_AND_ASSIGN(ServiceState);
};

#endif  // CLOUD_PRINT_SERVICE_SERVICE_STATE_H_