| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cloud_print_proxy.h" | 5 #include "chrome/service/cloud_print/cloud_print_proxy.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/common/pref_names.h" | 8 #include "chrome/common/pref_names.h" |
| 9 #include "chrome/common/json_pref_store.h" | 9 #include "chrome/common/json_pref_store.h" |
| 10 #include "chrome/service/cloud_print/cloud_print_consts.h" | 10 #include "chrome/service/cloud_print/cloud_print_consts.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 void CloudPrintProxy::EnableForUser(const std::string& lsid) { | 25 void CloudPrintProxy::EnableForUser(const std::string& lsid) { |
| 26 DCHECK(CalledOnValidThread()); | 26 DCHECK(CalledOnValidThread()); |
| 27 if (backend_.get()) | 27 if (backend_.get()) |
| 28 return; | 28 return; |
| 29 | 29 |
| 30 std::string proxy_id; | 30 std::string proxy_id; |
| 31 service_prefs_->prefs()->GetString(prefs::kCloudPrintProxyId, &proxy_id); | 31 service_prefs_->prefs()->GetString(prefs::kCloudPrintProxyId, &proxy_id); |
| 32 if (proxy_id.empty()) { | 32 if (proxy_id.empty()) { |
| 33 proxy_id = cloud_print::GenerateProxyId(); | 33 proxy_id = cloud_print::PrintSystem::GenerateProxyId(); |
| 34 service_prefs_->prefs()->SetString(prefs::kCloudPrintProxyId, proxy_id); | 34 service_prefs_->prefs()->SetString(prefs::kCloudPrintProxyId, proxy_id); |
| 35 service_prefs_->WritePrefs(); | 35 service_prefs_->WritePrefs(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Check if there is an override for the cloud print server URL. | 38 // Check if there is an override for the cloud print server URL. |
| 39 std::string cloud_print_server_url_str; | 39 std::string cloud_print_server_url_str; |
| 40 service_prefs_->prefs()->GetString(prefs::kCloudPrintServiceURL, | 40 service_prefs_->prefs()->GetString(prefs::kCloudPrintServiceURL, |
| 41 &cloud_print_server_url_str); | 41 &cloud_print_server_url_str); |
| 42 if (cloud_print_server_url_str.empty()) { | 42 if (cloud_print_server_url_str.empty()) { |
| 43 cloud_print_server_url_str = kDefaultCloudPrintServerUrl; | 43 cloud_print_server_url_str = kDefaultCloudPrintServerUrl; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 const std::string& email) { | 95 const std::string& email) { |
| 96 DCHECK(CalledOnValidThread()); | 96 DCHECK(CalledOnValidThread()); |
| 97 service_prefs_->prefs()->SetString(prefs::kCloudPrintAuthToken, | 97 service_prefs_->prefs()->SetString(prefs::kCloudPrintAuthToken, |
| 98 cloud_print_token); | 98 cloud_print_token); |
| 99 service_prefs_->prefs()->SetString(prefs::kCloudPrintXMPPAuthToken, | 99 service_prefs_->prefs()->SetString(prefs::kCloudPrintXMPPAuthToken, |
| 100 cloud_print_xmpp_token); | 100 cloud_print_xmpp_token); |
| 101 service_prefs_->prefs()->SetString(prefs::kCloudPrintEmail, email); | 101 service_prefs_->prefs()->SetString(prefs::kCloudPrintEmail, email); |
| 102 service_prefs_->WritePrefs(); | 102 service_prefs_->WritePrefs(); |
| 103 } | 103 } |
| 104 | 104 |
| OLD | NEW |