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

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

Issue 340773006: Dispatch push event to worker from PushServiceImpl#OnMessage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Debugging. 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
10 #include "components/gcm_driver/gcm_app_handler.h" 11 #include "components/gcm_driver/gcm_app_handler.h"
11 #include "components/gcm_driver/gcm_client.h" 12 #include "components/gcm_driver/gcm_client.h"
13 #include "content/common/service_worker/service_worker_status_code.h"
12 #include "content/public/browser/push_messaging_service.h" 14 #include "content/public/browser/push_messaging_service.h"
13 15
16 using content::ServiceWorkerStatusCode;
17
14 class Profile; 18 class Profile;
15 19
16 namespace user_prefs { 20 namespace user_prefs {
17 class PrefRegistrySyncable; 21 class PrefRegistrySyncable;
18 } 22 }
19 23
24 namespace content {
25 struct PushMessagingApplicationId;
26 class ServiceWorkerContextWrapper;
27 }
28
20 namespace gcm { 29 namespace gcm {
21 30
22 class GCMProfileService; 31 class GCMProfileService;
23 32
24 class PushMessagingServiceImpl : public content::PushMessagingService, 33 class PushMessagingServiceImpl : public content::PushMessagingService,
25 public GCMAppHandler { 34 public GCMAppHandler {
26 public: 35 public:
27 // Register profile-specific prefs for GCM. 36 // Register profile-specific prefs for GCM.
28 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 37 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
29 38
(...skipping 19 matching lines...) Expand all
49 const std::string& app_id, 58 const std::string& app_id,
50 const std::string& sender_id, 59 const std::string& sender_id,
51 const content::PushMessagingService::RegisterCallback& callback) OVERRIDE; 60 const content::PushMessagingService::RegisterCallback& callback) OVERRIDE;
52 61
53 private: 62 private:
54 void DidRegister( 63 void DidRegister(
55 const std::string& app_id, 64 const std::string& app_id,
56 const content::PushMessagingService::RegisterCallback& callback, 65 const content::PushMessagingService::RegisterCallback& callback,
57 const std::string& registration_id, 66 const std::string& registration_id,
58 GCMClient::Result result); 67 GCMClient::Result result);
68 void SendMessage(
69 const content::PushMessagingApplicationId& id,
70 const std::string& data,
71 scoped_refptr<content::ServiceWorkerContextWrapper> worker_context);
72 void SendMessageCallback(content::ServiceWorkerStatusCode status);
59 73
60 GCMProfileService* gcm_profile_service_; // It owns us. 74 GCMProfileService* gcm_profile_service_; // It owns us.
61 75
62 Profile* profile_; // It owns our owner. 76 Profile* profile_; // It owns our owner.
63 77
64 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; 78 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_;
65 79
66 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); 80 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl);
67 }; 81 };
68 82
69 } // namespace gcm 83 } // namespace gcm
70 84
71 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ 85 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698