Avoid crashing when going back/forward to debug URLs on a sad WebUI tab.
[chromium-blink-merge.git] / chrome / service / cloud_print / connector_settings.h
blob18ce5afdd61cfab4e6fb420ae5a11a30e3d5edd0
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 CHROME_SERVICE_CLOUD_PRINT_CONNECTOR_SETTINGS_H_
6 #define CHROME_SERVICE_CLOUD_PRINT_CONNECTOR_SETTINGS_H_
8 #include <set>
9 #include <string>
11 #include "base/gtest_prod_util.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "url/gurl.h"
15 class ServiceProcessPrefs;
17 namespace base {
18 class DictionaryValue;
21 namespace cloud_print {
23 class ConnectorSettings {
24 public:
25 ConnectorSettings();
26 ~ConnectorSettings();
28 void InitFrom(ServiceProcessPrefs* prefs);
30 void CopyFrom(const ConnectorSettings& source);
32 const GURL& server_url() const {
33 return server_url_;
36 const std::string& proxy_id() const {
37 return proxy_id_;
40 bool delete_on_enum_fail() const {
41 return delete_on_enum_fail_;
44 bool xmpp_ping_enabled() const {
45 return xmpp_ping_enabled_;
48 int xmpp_ping_timeout_sec() const {
49 return xmpp_ping_timeout_sec_;
52 const base::DictionaryValue* print_system_settings() const {
53 return print_system_settings_.get();
56 bool ShouldConnect(const std::string& printer_name) const;
58 void SetXmppPingTimeoutSec(int timeout);
60 private:
61 friend class ConnectorSettingsTest;
62 FRIEND_TEST_ALL_PREFIXES(ConnectorSettingsTest, SettersTest);
64 void set_xmpp_ping_enabled(bool enabled) {
65 xmpp_ping_enabled_ = enabled;
68 // Cloud Print server url.
69 GURL server_url_;
71 // This is initialized after a successful call to one of the Enable* methods.
72 // It is not cleared in DisableUser.
73 std::string proxy_id_;
75 // If |true| printers that are not found locally will be deleted on GCP
76 // even if the local enumeration failed.
77 bool delete_on_enum_fail_;
79 // If true register all new printers in cloud print.
80 bool connect_new_printers_;
82 // Indicate if XMPP pings are enabled.
83 bool xmpp_ping_enabled_;
85 // Indicate timeout between XMPP pings.
86 int xmpp_ping_timeout_sec_;
88 // Black list if connect_new_printers_ is true, or whitelist if false.
89 typedef std::set<std::string> Printers;
90 Printers printers_;
92 // Print system settings.
93 scoped_ptr<base::DictionaryValue> print_system_settings_;
95 DISALLOW_COPY_AND_ASSIGN(ConnectorSettings);
98 } // namespace cloud_print
100 #endif // CHROME_SERVICE_CLOUD_PRINT_CONNECTOR_SETTINGS_H_