OLD | NEW |
(Empty) | |
| 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/file_path.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/values.h" |
| 13 |
| 14 class FilePath; |
| 15 |
| 16 // Manages Cloud Print part of Service State. |
| 17 class ServiceState { |
| 18 public: |
| 19 ServiceState(); |
| 20 virtual ~ServiceState(); |
| 21 |
| 22 void Reset(); |
| 23 |
| 24 // Initialize object from json. |
| 25 bool FromString(const std::string& json); |
| 26 |
| 27 // Returns object state as json. |
| 28 std::string ToString(); |
| 29 |
| 30 // Setups object using data provided by delegate. |
| 31 bool Configure(const std::string& email, |
| 32 const std::string& password, |
| 33 const std::string& proxy_id); |
| 34 |
| 35 // Returns authentication token provided by Google server. |
| 36 virtual std::string LoginToGoogle(const std::string& service, |
| 37 const std::string& email, |
| 38 const std::string& password); |
| 39 |
| 40 // Returns true of object state is valid. |
| 41 bool IsValid() const; |
| 42 |
| 43 std::string email() const { |
| 44 return email_; |
| 45 }; |
| 46 |
| 47 std::string proxy_id() const { |
| 48 return proxy_id_; |
| 49 }; |
| 50 |
| 51 std::string robot_email() const { |
| 52 return robot_email_; |
| 53 }; |
| 54 |
| 55 std::string robot_token() const { |
| 56 return robot_token_; |
| 57 }; |
| 58 |
| 59 std::string auth_token() const { |
| 60 return auth_token_; |
| 61 }; |
| 62 |
| 63 std::string xmpp_auth_token() const { |
| 64 return xmpp_auth_token_; |
| 65 }; |
| 66 |
| 67 void set_email(const std::string& value) { |
| 68 email_ = value; |
| 69 }; |
| 70 |
| 71 void set_proxy_id(const std::string& value) { |
| 72 proxy_id_ = value; |
| 73 }; |
| 74 |
| 75 void set_robot_email(const std::string& value) { |
| 76 robot_email_ = value; |
| 77 }; |
| 78 |
| 79 void set_robot_token(const std::string& value) { |
| 80 robot_token_ = value; |
| 81 }; |
| 82 |
| 83 void set_auth_token(const std::string& value) { |
| 84 auth_token_ = value; |
| 85 }; |
| 86 |
| 87 void set_xmpp_auth_token(const std::string& value) { |
| 88 xmpp_auth_token_ = value; |
| 89 }; |
| 90 |
| 91 private: |
| 92 std::string email_; |
| 93 std::string proxy_id_; |
| 94 std::string robot_email_; |
| 95 std::string robot_token_; |
| 96 std::string auth_token_; |
| 97 std::string xmpp_auth_token_; |
| 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(ServiceState); |
| 100 }; |
| 101 |
| 102 #endif // CLOUD_PRINT_SERVICE_SERVICE_STATE_H_ |
| 103 |
OLD | NEW |