| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 DCHECK(server_url_.is_valid()); | 60 DCHECK(server_url_.is_valid()); |
| 61 | 61 |
| 62 connect_new_printers_ = prefs->GetBoolean( | 62 connect_new_printers_ = prefs->GetBoolean( |
| 63 prefs::kCloudPrintConnectNewPrinters, true); | 63 prefs::kCloudPrintConnectNewPrinters, true); |
| 64 | 64 |
| 65 xmpp_ping_enabled_ = prefs->GetBoolean( | 65 xmpp_ping_enabled_ = prefs->GetBoolean( |
| 66 prefs::kCloudPrintXmppPingEnabled, false); | 66 prefs::kCloudPrintXmppPingEnabled, false); |
| 67 int timeout = prefs->GetInt( | 67 int timeout = prefs->GetInt( |
| 68 prefs::kCloudPrintXmppPingTimeout, kDefaultXmppPingTimeoutSecs); | 68 prefs::kCloudPrintXmppPingTimeout, kDefaultXmppPingTimeoutSecs); |
| 69 SetXmppPingTimeoutSec(timeout); | 69 SetXmppPingTimeoutSec(timeout); |
| 70 UMA_HISTOGRAM_LONG_TIMES( | |
| 71 "CloudPrint.XmppTimeout", | |
| 72 base::TimeDelta::FromSeconds(xmpp_ping_timeout_sec_)); | |
| 73 | 70 |
| 74 const base::ListValue* printers = prefs->GetList(prefs::kCloudPrintPrinters); | 71 const base::ListValue* printers = prefs->GetList(prefs::kCloudPrintPrinters); |
| 75 if (printers) { | 72 if (printers) { |
| 76 for (size_t i = 0; i < printers->GetSize(); ++i) { | 73 for (size_t i = 0; i < printers->GetSize(); ++i) { |
| 77 const base::DictionaryValue* dictionary = NULL; | 74 const base::DictionaryValue* dictionary = NULL; |
| 78 if (printers->GetDictionary(i, &dictionary) && dictionary) { | 75 if (printers->GetDictionary(i, &dictionary) && dictionary) { |
| 79 std::string name; | 76 std::string name; |
| 80 dictionary->GetString(kName, &name); | 77 dictionary->GetString(kName, &name); |
| 81 if (!name.empty()) { | 78 if (!name.empty()) { |
| 82 bool connect = connect_new_printers_; | 79 bool connect = connect_new_printers_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 void ConnectorSettings::SetXmppPingTimeoutSec(int timeout) { | 115 void ConnectorSettings::SetXmppPingTimeoutSec(int timeout) { |
| 119 xmpp_ping_timeout_sec_ = timeout; | 116 xmpp_ping_timeout_sec_ = timeout; |
| 120 if (xmpp_ping_timeout_sec_ < kMinXmppPingTimeoutSecs) { | 117 if (xmpp_ping_timeout_sec_ < kMinXmppPingTimeoutSecs) { |
| 121 LOG(WARNING) << | 118 LOG(WARNING) << |
| 122 "CP_CONNECTOR: XMPP ping timeout is less than minimal value"; | 119 "CP_CONNECTOR: XMPP ping timeout is less than minimal value"; |
| 123 xmpp_ping_timeout_sec_ = kMinXmppPingTimeoutSecs; | 120 xmpp_ping_timeout_sec_ = kMinXmppPingTimeoutSecs; |
| 124 } | 121 } |
| 125 } | 122 } |
| 126 | 123 |
| 127 } // namespace cloud_print | 124 } // namespace cloud_print |
| OLD | NEW |