OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CONNECTOR_SETTINGS_H_ | 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CONNECTOR_SETTINGS_H_ |
6 #define CHROME_SERVICE_CLOUD_PRINT_CONNECTOR_SETTINGS_H_ | 6 #define CHROME_SERVICE_CLOUD_PRINT_CONNECTOR_SETTINGS_H_ |
7 | 7 |
8 #include <set> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 | 13 |
14 class ServiceProcessPrefs; | 14 class ServiceProcessPrefs; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class DictionaryValue; | 17 class DictionaryValue; |
18 } | 18 } |
(...skipping 14 matching lines...) Expand all Loading... |
33 }; | 33 }; |
34 | 34 |
35 const std::string& proxy_id() const { | 35 const std::string& proxy_id() const { |
36 return proxy_id_; | 36 return proxy_id_; |
37 } | 37 } |
38 | 38 |
39 bool delete_on_enum_fail() const { | 39 bool delete_on_enum_fail() const { |
40 return delete_on_enum_fail_; | 40 return delete_on_enum_fail_; |
41 } | 41 } |
42 | 42 |
43 bool connect_new_printers() const { | |
44 return connect_new_printers_; | |
45 }; | |
46 | |
47 bool xmpp_ping_enabled() const { | 43 bool xmpp_ping_enabled() const { |
48 return xmpp_ping_enabled_; | 44 return xmpp_ping_enabled_; |
49 } | 45 } |
50 | 46 |
51 void set_xmpp_ping_enabled(bool enabled) { | 47 void set_xmpp_ping_enabled(bool enabled) { |
52 xmpp_ping_enabled_ = enabled; | 48 xmpp_ping_enabled_ = enabled; |
53 } | 49 } |
54 | 50 |
55 int xmpp_ping_timeout_sec() const { | 51 int xmpp_ping_timeout_sec() const { |
56 return xmpp_ping_timeout_sec_; | 52 return xmpp_ping_timeout_sec_; |
57 } | 53 } |
58 | 54 |
59 const base::DictionaryValue* print_system_settings() const { | 55 const base::DictionaryValue* print_system_settings() const { |
60 return print_system_settings_.get(); | 56 return print_system_settings_.get(); |
61 }; | 57 }; |
62 | 58 |
63 bool IsPrinterBlacklisted(const std::string& name) const; | 59 bool ShouldConnect(const std::string& printer_name) const; |
| 60 std::string GetDisplayName(const std::string& printer_name) const; |
64 | 61 |
65 void SetXmppPingTimeoutSec(int timeout); | 62 void SetXmppPingTimeoutSec(int timeout); |
66 | 63 |
67 private: | 64 private: |
68 // Cloud Print server url. | 65 // Cloud Print server url. |
69 GURL server_url_; | 66 GURL server_url_; |
70 | 67 |
71 // This is initialized after a successful call to one of the Enable* methods. | 68 // This is initialized after a successful call to one of the Enable* methods. |
72 // It is not cleared in DisableUser. | 69 // It is not cleared in DisableUser. |
73 std::string proxy_id_; | 70 std::string proxy_id_; |
74 | 71 |
75 // If |true| printers that are not found locally will be deleted on GCP | 72 // If |true| printers that are not found locally will be deleted on GCP |
76 // even if the local enumeration failed. | 73 // even if the local enumeration failed. |
77 bool delete_on_enum_fail_; | 74 bool delete_on_enum_fail_; |
78 | 75 |
79 // If true register all new printers in cloud print. | 76 // If true register all new printers in cloud print. |
80 bool connect_new_printers_; | 77 bool connect_new_printers_; |
81 | 78 |
82 // Indicate if XMPP pings are enabled. | 79 // Indicate if XMPP pings are enabled. |
83 bool xmpp_ping_enabled_; | 80 bool xmpp_ping_enabled_; |
84 | 81 |
85 // Indicate timeout between XMPP pings. | 82 // Indicate timeout between XMPP pings. |
86 int xmpp_ping_timeout_sec_; | 83 int xmpp_ping_timeout_sec_; |
87 | 84 |
88 // List of printers which should not be connected. | 85 // Mapping from printer name to printer settings. |
89 std::set<std::string> printer_blacklist_; | 86 // Settings include bool value whether connect printer or not and |
| 87 // display name. |
| 88 typedef std::map<std::string, std::pair<bool, std::string> > Printers; |
| 89 Printers printers_; |
90 | 90 |
91 // Print system settings. | 91 // Print system settings. |
92 scoped_ptr<base::DictionaryValue> print_system_settings_; | 92 scoped_ptr<base::DictionaryValue> print_system_settings_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(ConnectorSettings); | 94 DISALLOW_COPY_AND_ASSIGN(ConnectorSettings); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace cloud_print | 97 } // namespace cloud_print |
98 | 98 |
99 #endif // CHROME_SERVICE_CLOUD_PRINT_CONNECTOR_SETTINGS_H_ | 99 #endif // CHROME_SERVICE_CLOUD_PRINT_CONNECTOR_SETTINGS_H_ |
100 | 100 |
OLD | NEW |