Chromium Code Reviews| Index: chrome/service/cloud_print/connector_settings.cc |
| diff --git a/chrome/service/cloud_print/connector_settings.cc b/chrome/service/cloud_print/connector_settings.cc |
| index 8c362de14edbc97a1cbb6b74741716df7ab26ad3..e27d784394d01912bca402d7f052b946a4b8852f 100644 |
| --- a/chrome/service/cloud_print/connector_settings.cc |
| +++ b/chrome/service/cloud_print/connector_settings.cc |
| @@ -10,13 +10,10 @@ |
| #include "chrome/service/cloud_print/print_system.h" |
| #include "chrome/service/service_process_prefs.h" |
| -namespace { |
| - |
| const char kDeleteOnEnumFail[] = "delete_on_enum_fail"; |
| -} // namespace |
| - |
| -ConnectorSettings::ConnectorSettings() : remove_missing_printers_(false) { |
| +ConnectorSettings::ConnectorSettings() |
| + : remove_missing_printers_(false) { |
| } |
| ConnectorSettings::~ConnectorSettings() { |
| @@ -25,7 +22,7 @@ ConnectorSettings::~ConnectorSettings() { |
| void ConnectorSettings::InitFrom(ServiceProcessPrefs* prefs) { |
| CopyFrom(ConnectorSettings()); |
| - prefs->GetString(prefs::kCloudPrintProxyId, &proxy_id_); |
| + proxy_id_ = prefs->GetString(prefs::kCloudPrintProxyId, ""); |
| if (proxy_id_.empty()) { |
| proxy_id_ = cloud_print::PrintSystem::GenerateProxyId(); |
| prefs->SetString(prefs::kCloudPrintProxyId, proxy_id_); |
| @@ -33,30 +30,29 @@ void ConnectorSettings::InitFrom(ServiceProcessPrefs* prefs) { |
| } |
| // Getting print system specific settings from the preferences. |
| - const base::DictionaryValue* print_system_settings = NULL; |
| - prefs->GetDictionary(prefs::kCloudPrintPrintSystemSettings, |
| - &print_system_settings); |
| + const base::DictionaryValue* print_system_settings = |
| + prefs->GetDictionary(prefs::kCloudPrintPrintSystemSettings); |
| if (print_system_settings) { |
| print_system_settings_.reset(print_system_settings->DeepCopy()); |
| - // TODO(vitalybuka) : Consider to move option from print_system_settings. |
| + // TODO(vitalybuka) : Consider to rename and move out option from |
| + // print_system_settings. |
| print_system_settings_->GetBoolean(kDeleteOnEnumFail, |
| &remove_missing_printers_); |
| } |
| // Check if there is an override for the cloud print server URL. |
| - std::string cloud_print_server_url_str; |
| - prefs->GetString(prefs::kCloudPrintServiceURL, |
| - &cloud_print_server_url_str); |
| - if (cloud_print_server_url_str.empty()) { |
| - cloud_print_server_url_str = kDefaultCloudPrintServerUrl; |
| + server_url_ = GURL(prefs->GetString(prefs::kCloudPrintServiceURL, "")); |
| + DCHECK(server_url_.is_empty() || server_url_.is_valid()); |
| + if (server_url_.is_empty() || !server_url_.is_valid()) { |
| + server_url_ = GURL(kDefaultCloudPrintServerUrl); |
| } |
| - server_url_ = GURL(cloud_print_server_url_str.c_str()); |
| DCHECK(server_url_.is_valid()); |
| } |
| void ConnectorSettings::CopyFrom(const ConnectorSettings& source) { |
| server_url_ = source.server_url(); |
| proxy_id_ = source.proxy_id(); |
| + remove_missing_printers_ = source.remove_missing_printers(); |
|
gene
2012/09/21 22:57:04
this is from previous CL
|
| if (source.print_system_settings()) |
| print_system_settings_.reset(source.print_system_settings()->DeepCopy()); |
| } |