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

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

Issue 3425021: Switched the cloud print proxy to use the Google push notifications.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Some comment changes Created 10 years, 3 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_consts.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/cloud_print/cloud_print_proxy_backend.cc
===================================================================
--- chrome/service/cloud_print/cloud_print_proxy_backend.cc (revision 60292)
+++ chrome/service/cloud_print/cloud_print_proxy_backend.cc (working copy)
@@ -18,13 +18,13 @@
#include "chrome/service/gaia/service_gaia_authenticator.h"
#include "chrome/service/service_process.h"
#include "jingle/notifier/base/notifier_options.h"
-#include "jingle/notifier/listener/mediator_thread_impl.h"
+#include "jingle/notifier/listener/push_notifications_thread.h"
#include "jingle/notifier/listener/talk_mediator_impl.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_status.h"
-// The real guts of SyncBackendHost, to keep the public client API clean.
+// The real guts of CloudPrintProxyBackend, to keep the public client API clean.
class CloudPrintProxyBackend::Core
: public base::RefCountedThreadSafe<CloudPrintProxyBackend::Core>,
public URLFetcherDelegate,
@@ -42,7 +42,7 @@
//
// The Do* methods are the various entry points from CloudPrintProxyBackend
// It calls us on a dedicated thread to actually perform synchronous
- // (and potentially blocking) syncapi operations.
+ // (and potentially blocking) operations.
//
// Called on the CloudPrintProxyBackend core_thread_ to perform
// initialization. When we are passed in an LSID we authenticate using that
@@ -179,6 +179,9 @@
bool notifications_enabled_;
// Indicates whether a task to poll for jobs has been scheduled.
bool job_poll_scheduled_;
+ // The channel we are interested in receiving push notifications for.
+ // This is "cloudprint.google.com/proxy/<proxy_id>"
+ std::string push_notifications_channel_;
DISALLOW_COPY_AND_ASSIGN(Core);
};
@@ -319,9 +322,13 @@
const notifier::NotifierOptions kNotifierOptions;
const bool kInvalidateXmppAuthToken = false;
talk_mediator_.reset(new notifier::TalkMediatorImpl(
- new notifier::MediatorThreadImpl(kNotifierOptions),
+ new notifier::PushNotificationsThread(kNotifierOptions,
+ kCloudPrintPushNotificationsSource),
kInvalidateXmppAuthToken));
- talk_mediator_->AddSubscribedServiceUrl(kCloudPrintTalkServiceUrl);
+ push_notifications_channel_ = kCloudPrintPushNotificationsSource;
+ push_notifications_channel_.append("/proxy/");
+ push_notifications_channel_.append(proxy_id);
+ talk_mediator_->AddSubscribedServiceUrl(push_notifications_channel_);
talk_mediator_->SetDelegate(this);
talk_mediator_->SetAuthToken(email, cloud_print_xmpp_token,
kSyncGaiaServiceId);
@@ -727,8 +734,8 @@
const IncomingNotificationData& notification_data) {
DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop());
LOG(INFO) << "CP_PROXY: Incoming notification.";
- if (0 == base::strcasecmp(kCloudPrintTalkServiceUrl,
- notification_data.service_url.c_str())) {
+ if (0 == base::strcasecmp(push_notifications_channel_.c_str(),
+ notification_data.service_url.c_str())) {
HandlePrinterNotification(notification_data.service_specific_data);
}
}
« no previous file with comments | « chrome/service/cloud_print/cloud_print_consts.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698