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

Side by Side Diff: chrome/browser/services/gcm/push_messaging_service_impl.cc

Issue 317823007: Hook PushMessagingMessageFilter up to GCMDriver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make push_messaging_service non-const Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/services/gcm/push_messaging_service_impl.h"
6
7 #include <vector>
8
9 #include "base/bind.h"
10 #include "chrome/browser/services/gcm/gcm_profile_service.h"
11 #include "components/gcm_driver/gcm_driver.h"
12
13 namespace gcm {
14
15 PushMessagingServiceImpl::PushMessagingServiceImpl(
16 GCMProfileService* gcm_profile_service)
17 : gcm_profile_service_(gcm_profile_service) {}
18
19 PushMessagingServiceImpl::~PushMessagingServiceImpl() {}
20
21 void PushMessagingServiceImpl::Register(
22 const std::string& app_id,
23 const std::string& sender_id,
24 const content::PushMessagingService::RegisterCallback& callback) {
25 // The GCMDriver could be NULL if GCMProfileService has been shut down.
26 if (!gcm_profile_service_->driver())
27 return;
28 std::vector<std::string> sender_ids(1, sender_id);
29 gcm_profile_service_->driver()->Register(
30 app_id,
31 sender_ids,
32 base::Bind(&PushMessagingServiceImpl::DidRegister,
33 base::Unretained(this),
fgorski 2014/06/09 17:43:49 This does not look safe, as you don't have any add
johnme 2014/06/09 19:04:45 I think it probably was safe, as this is a member
34 callback));
35 }
36
37 void PushMessagingServiceImpl::DidRegister(
38 const content::PushMessagingService::RegisterCallback& callback,
39 const std::string& registration_id,
40 GCMClient::Result result) {
41 GURL endpoint = GURL("https://android.googleapis.com/gcm/send");
42 bool error = (result != GCMClient::SUCCESS);
43 callback.Run(endpoint, registration_id, error);
44 }
45
46 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698