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 #include "chrome/service/cloud_print/connector_settings.h" | 5 #include "chrome/service/cloud_print/connector_settings.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/common/cloud_print/cloud_print_constants.h" |
8 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
9 #include "chrome/service/cloud_print/cloud_print_consts.h" | |
10 #include "chrome/service/cloud_print/print_system.h" | 10 #include "chrome/service/cloud_print/print_system.h" |
11 #include "chrome/service/service_process_prefs.h" | 11 #include "chrome/service/service_process_prefs.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 const char kDefaultCloudPrintServerUrl[] = "https://www.google.com/cloudprint"; | 15 const char kDefaultCloudPrintServerUrl[] = "https://www.google.com/cloudprint"; |
16 const char kDeleteOnEnumFail[] = "delete_on_enum_fail"; | 16 const char kDeleteOnEnumFail[] = "delete_on_enum_fail"; |
17 | 17 |
18 } // namespace | 18 } // namespace |
19 | 19 |
| 20 namespace cloud_print { |
| 21 |
20 ConnectorSettings::ConnectorSettings() | 22 ConnectorSettings::ConnectorSettings() |
21 : delete_on_enum_fail_(false), | 23 : delete_on_enum_fail_(false), |
22 connect_new_printers_(true), | 24 connect_new_printers_(true), |
23 xmpp_ping_enabled_(false), | 25 xmpp_ping_enabled_(false), |
24 xmpp_ping_timeout_sec_(kDefaultXmppPingTimeoutSecs) { | 26 xmpp_ping_timeout_sec_(kDefaultXmppPingTimeoutSecs) { |
25 } | 27 } |
26 | 28 |
27 ConnectorSettings::~ConnectorSettings() { | 29 ConnectorSettings::~ConnectorSettings() { |
28 } | 30 } |
29 | 31 |
30 void ConnectorSettings::InitFrom(ServiceProcessPrefs* prefs) { | 32 void ConnectorSettings::InitFrom(ServiceProcessPrefs* prefs) { |
31 CopyFrom(ConnectorSettings()); | 33 CopyFrom(ConnectorSettings()); |
32 | 34 |
33 proxy_id_ = prefs->GetString(prefs::kCloudPrintProxyId, ""); | 35 proxy_id_ = prefs->GetString(prefs::kCloudPrintProxyId, ""); |
34 if (proxy_id_.empty()) { | 36 if (proxy_id_.empty()) { |
35 proxy_id_ = cloud_print::PrintSystem::GenerateProxyId(); | 37 proxy_id_ = PrintSystem::GenerateProxyId(); |
36 prefs->SetString(prefs::kCloudPrintProxyId, proxy_id_); | 38 prefs->SetString(prefs::kCloudPrintProxyId, proxy_id_); |
37 prefs->WritePrefs(); | 39 prefs->WritePrefs(); |
38 } | 40 } |
39 | 41 |
40 // Getting print system specific settings from the preferences. | 42 // Getting print system specific settings from the preferences. |
41 const base::DictionaryValue* print_system_settings = | 43 const base::DictionaryValue* print_system_settings = |
42 prefs->GetDictionary(prefs::kCloudPrintPrintSystemSettings); | 44 prefs->GetDictionary(prefs::kCloudPrintPrintSystemSettings); |
43 if (print_system_settings) { | 45 if (print_system_settings) { |
44 print_system_settings_.reset(print_system_settings->DeepCopy()); | 46 print_system_settings_.reset(print_system_settings->DeepCopy()); |
45 // TODO(vitalybuka) : Consider to rename and move out option from | 47 // TODO(vitalybuka) : Consider to rename and move out option from |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 95 } |
94 | 96 |
95 void ConnectorSettings::SetXmppPingTimeoutSec(int timeout) { | 97 void ConnectorSettings::SetXmppPingTimeoutSec(int timeout) { |
96 xmpp_ping_timeout_sec_ = timeout; | 98 xmpp_ping_timeout_sec_ = timeout; |
97 if (xmpp_ping_timeout_sec_ < kMinimumXmppPingTimeoutSecs) { | 99 if (xmpp_ping_timeout_sec_ < kMinimumXmppPingTimeoutSecs) { |
98 LOG(WARNING) << | 100 LOG(WARNING) << |
99 "CP_CONNECTOR: XMPP ping timeout is less then minimal value"; | 101 "CP_CONNECTOR: XMPP ping timeout is less then minimal value"; |
100 xmpp_ping_timeout_sec_ = kMinimumXmppPingTimeoutSecs; | 102 xmpp_ping_timeout_sec_ = kMinimumXmppPingTimeoutSecs; |
101 } | 103 } |
102 } | 104 } |
| 105 |
| 106 } // namespace cloud_print |
OLD | NEW |