Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6843)

Unified Diff: chrome/service/cloud_print/cloud_print_proxy.cc

Issue 208653010: Use service process to collect printers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/service/cloud_print/cloud_print_proxy.h ('k') | chrome/service/service_ipc_server.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/cloud_print/cloud_print_proxy.cc
diff --git a/chrome/service/cloud_print/cloud_print_proxy.cc b/chrome/service/cloud_print/cloud_print_proxy.cc
index 9e07db91d67c647b20515f7a1fc2f6059519b02c..6834eb91be8fd7d98e6729c0ee58775e6aa3cebe 100644
--- a/chrome/service/cloud_print/cloud_print_proxy.cc
+++ b/chrome/service/cloud_print/cloud_print_proxy.cc
@@ -143,7 +143,8 @@ bool CloudPrintProxy::CreateBackend() {
if (backend_.get())
return false;
- settings_.InitFrom(service_prefs_);
+ ConnectorSettings settings;
+ settings.InitFrom(service_prefs_);
// By default we don't poll for jobs when we lose XMPP connection. But this
// behavior can be overridden by a preference.
@@ -156,8 +157,8 @@ bool CloudPrintProxy::CreateBackend() {
oauth_client_info.client_secret =
google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_CLOUD_PRINT);
oauth_client_info.redirect_uri = "oob";
- backend_.reset(new CloudPrintProxyBackend(this, settings_, oauth_client_info,
- enable_job_poll));
+ backend_.reset(new CloudPrintProxyBackend(
+ this, settings, oauth_client_info, enable_job_poll));
return true;
}
@@ -188,12 +189,25 @@ void CloudPrintProxy::GetProxyInfo(CloudPrintProxyInfo* info) {
info->email.clear();
if (enabled_)
info->email = user_email();
- info->proxy_id = settings_.proxy_id();
- // If the Cloud Print service is not enabled, we may need to read the old
- // value of proxy_id from prefs.
- if (info->proxy_id.empty())
- info->proxy_id =
- service_prefs_->GetString(prefs::kCloudPrintProxyId, std::string());
+ ConnectorSettings settings;
+ settings.InitFrom(service_prefs_);
+ info->proxy_id = settings.proxy_id();
+}
+
+void CloudPrintProxy::GetPrinters(std::vector<std::string>* printers) {
+ ConnectorSettings settings;
+ settings.InitFrom(service_prefs_);
+ scoped_refptr<PrintSystem> print_system =
+ PrintSystem::CreateInstance(settings.print_system_settings());
+ if (!print_system)
+ return;
+ PrintSystem::PrintSystemResult result = print_system->Init();
+ if (!result.succeeded())
+ return;
+ printing::PrinterList printer_list;
+ print_system->EnumeratePrinters(&printer_list);
+ for (size_t i = 0; i < printer_list.size(); ++i)
+ printers->push_back(printer_list[i].printer_name);
}
void CloudPrintProxy::CheckCloudPrintProxyPolicy() {
@@ -253,7 +267,9 @@ void CloudPrintProxy::OnUnregisterPrinters(
UMA_HISTOGRAM_COUNTS_10000("CloudPrint.UnregisterPrinters",
printer_ids.size());
ShutdownBackend();
- wipeout_.reset(new CloudPrintWipeout(this, settings_.server_url()));
+ ConnectorSettings settings;
+ settings.InitFrom(service_prefs_);
+ wipeout_.reset(new CloudPrintWipeout(this, settings.server_url()));
wipeout_->UnregisterPrinters(auth_token, printer_ids);
}
« no previous file with comments | « chrome/service/cloud_print/cloud_print_proxy.h ('k') | chrome/service/service_ipc_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698