summaryrefslogtreecommitdiffstats
path: root/chrome/service/cloud_print/cloud_print_proxy.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/service/cloud_print/cloud_print_proxy.cc')
-rw-r--r--chrome/service/cloud_print/cloud_print_proxy.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/service/cloud_print/cloud_print_proxy.cc b/chrome/service/cloud_print/cloud_print_proxy.cc
index ea6139b..aff851a 100644
--- a/chrome/service/cloud_print/cloud_print_proxy.cc
+++ b/chrome/service/cloud_print/cloud_print_proxy.cc
@@ -17,6 +17,11 @@ void CloudPrintProxy::Initialize() {
void CloudPrintProxy::EnableForUser(const std::string& lsid,
const std::string& proxy_id) {
+ if (backend_.get())
+ return;
+
+ backend_.reset(new CloudPrintProxyBackend(this));
+ backend_->Initialize(lsid, proxy_id);
}
void CloudPrintProxy::DisableForUser() {
@@ -25,8 +30,23 @@ void CloudPrintProxy::DisableForUser() {
void CloudPrintProxy::HandlePrinterNotification(
const std::string& printer_id) {
+ if (backend_.get())
+ backend_->HandlePrinterNotification(printer_id);
}
void CloudPrintProxy::Shutdown() {
+ if (backend_.get())
+ backend_->Shutdown();
+ backend_.reset();
+}
+
+// Notification methods from the backend. Called on UI thread.
+void CloudPrintProxy::OnPrinterListAvailable(
+ const cloud_print::PrinterList& printer_list) {
+ // Here we will trim the list to eliminate printers already registered.
+ // If there are any more printers left in the list after trimming, we will
+ // show the print selection UI. Any printers left in the list after the user
+ // selection process will then be registered.
+ backend_->RegisterPrinters(printer_list);
}