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

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: Get registration from storage if necessary. Created 6 years, 5 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/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "components/gcm_driver/gcm_app_handler.h" 10 #include "components/gcm_driver/gcm_app_handler.h"
11 #include "components/gcm_driver/gcm_client.h" 11 #include "components/gcm_driver/gcm_client.h"
12 #include "content/public/browser/push_messaging_service.h" 12 #include "content/public/browser/push_messaging_service.h"
13 #include "content/public/common/push_messaging_status.h" 13 #include "content/public/common/push_messaging_status.h"
14 14
15 class Profile; 15 class Profile;
16 16
17 namespace user_prefs { 17 namespace user_prefs {
18 class PrefRegistrySyncable; 18 class PrefRegistrySyncable;
19 } 19 }
20 20
21 namespace content {
22 struct PushMessagingApplicationId;
23 class PushMessagingRouter;
24 }
25
21 namespace gcm { 26 namespace gcm {
22 27
23 class GCMProfileService; 28 class GCMProfileService;
24 29
25 class PushMessagingServiceImpl : public content::PushMessagingService, 30 class PushMessagingServiceImpl : public content::PushMessagingService,
26 public GCMAppHandler { 31 public GCMAppHandler {
27 public: 32 public:
28 // Register profile-specific prefs for GCM. 33 // Register profile-specific prefs for GCM.
29 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 34 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
30 35
(...skipping 17 matching lines...) Expand all
48 // content::PushMessagingService implementation: 53 // content::PushMessagingService implementation:
49 virtual void Register( 54 virtual void Register(
50 const std::string& app_id, 55 const std::string& app_id,
51 const std::string& sender_id, 56 const std::string& sender_id,
52 int renderer_id, 57 int renderer_id,
53 int render_frame_id, 58 int render_frame_id,
54 bool user_gesture, 59 bool user_gesture,
55 const content::PushMessagingService::RegisterCallback& callback) OVERRIDE; 60 const content::PushMessagingService::RegisterCallback& callback) OVERRIDE;
56 61
57 private: 62 private:
63 void SendMessageCallback(
64 const content::PushMessagingApplicationId& application_id,
65 const GCMClient::IncomingMessage& message,
66 content::PushMessagingStatus status);
67
58 void RegisterEnd( 68 void RegisterEnd(
59 const std::string& app_id, 69 const std::string& app_id,
60 const content::PushMessagingService::RegisterCallback& callback, 70 const content::PushMessagingService::RegisterCallback& callback,
61 const std::string& registration_id, 71 const std::string& registration_id,
62 content::PushMessagingStatus status); 72 content::PushMessagingStatus status);
63 73
64 void DidRegister( 74 void DidRegister(
65 const std::string& app_id, 75 const std::string& app_id,
66 const content::PushMessagingService::RegisterCallback& callback, 76 const content::PushMessagingService::RegisterCallback& callback,
67 const std::string& registration_id, 77 const std::string& registration_id,
68 GCMClient::Result result); 78 GCMClient::Result result);
69 79
70 void DidRequestPermission( 80 void DidRequestPermission(
71 const std::string& sender_id, 81 const std::string& sender_id,
72 const std::string& app_id, 82 const std::string& app_id,
73 const content::PushMessagingService::RegisterCallback& callback, 83 const content::PushMessagingService::RegisterCallback& callback,
74 bool allow); 84 bool allow);
75 85
76 GCMProfileService* gcm_profile_service_; // It owns us. 86 GCMProfileService* gcm_profile_service_; // It owns us.
77 87
78 Profile* profile_; // It owns our owner. 88 Profile* profile_; // It owns our owner.
79 89
90 scoped_ptr<content::PushMessagingRouter> push_messaging_router_;
91
80 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; 92 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_;
81 93
82 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); 94 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl);
83 }; 95 };
84 96
85 } // namespace gcm 97 } // namespace gcm
86 98
87 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ 99 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698