- add sources.
[platform/framework/web/crosswalk.git] / src / cloud_print / service / service_state.h
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.
4
5 #ifndef CLOUD_PRINT_SERVICE_SERVICE_STATE_H_
6 #define CLOUD_PRINT_SERVICE_SERVICE_STATE_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/values.h"
12
13 // Manages Cloud Print part of Service State.
14 class ServiceState {
15  public:
16   ServiceState();
17   virtual ~ServiceState();
18
19   void Reset();
20
21   // Initialize object from json.
22   bool FromString(const std::string& json);
23
24   // Returns object state as json.
25   std::string ToString();
26
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);
31
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);
36
37   // Returns true of object state is valid.
38   bool IsValid() const;
39
40   std::string email() const {
41     return email_;
42   };
43
44   std::string proxy_id() const {
45     return proxy_id_;
46   };
47
48   std::string robot_email() const {
49     return robot_email_;
50   };
51
52   std::string robot_token() const {
53     return robot_token_;
54   };
55
56   std::string auth_token() const {
57     return auth_token_;
58   };
59
60   std::string xmpp_auth_token() const {
61     return xmpp_auth_token_;
62   };
63
64   void set_email(const std::string& value) {
65     email_ = value;
66   };
67
68   void set_proxy_id(const std::string& value) {
69     proxy_id_ = value;
70   };
71
72   void set_robot_email(const std::string& value) {
73     robot_email_ = value;
74   };
75
76   void set_robot_token(const std::string& value) {
77     robot_token_ = value;
78   };
79
80   void set_auth_token(const std::string& value) {
81     auth_token_ = value;
82   };
83
84   void set_xmpp_auth_token(const std::string& value) {
85     xmpp_auth_token_ = value;
86   };
87
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_;
95
96   DISALLOW_COPY_AND_ASSIGN(ServiceState);
97 };
98
99 #endif  // CLOUD_PRINT_SERVICE_SERVICE_STATE_H_
100