Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <vector> | |
|
Michael van Ouwerkerk
2014/06/19 10:16:11
Nit: move this to push_messaging_service_impl.cc w
Miguel Garcia
2014/06/19 17:49:28
Done.
| |
| 9 | |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 9 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 10 #include "components/gcm_driver/gcm_client.h" | 12 #include "components/gcm_driver/gcm_client.h" |
| 11 #include "content/public/browser/push_messaging_service.h" | 13 #include "content/public/browser/push_messaging_service.h" |
| 12 | 14 |
| 13 namespace gcm { | 15 namespace gcm { |
| 14 | 16 |
| 15 class GCMProfileService; | 17 class GCMProfileService; |
| 16 | 18 |
| 17 class PushMessagingServiceImpl : public content::PushMessagingService { | 19 class PushMessagingServiceImpl : public content::PushMessagingService { |
| 18 public: | 20 public: |
| 19 explicit PushMessagingServiceImpl(GCMProfileService* gcm_profile_service); | 21 explicit PushMessagingServiceImpl(GCMProfileService* gcm_profile_service); |
| 20 virtual ~PushMessagingServiceImpl(); | 22 virtual ~PushMessagingServiceImpl(); |
| 21 | 23 |
| 22 // content::PushMessagingService implementation: | 24 // content::PushMessagingService implementation: |
| 23 virtual void Register( | 25 virtual void Register( |
| 24 const std::string& app_id, | 26 const std::string& app_id, |
| 25 const std::string& sender_id, | 27 const std::string& sender_id, |
| 28 const int renderer_id, | |
| 29 const int router_id, | |
| 26 const content::PushMessagingService::RegisterCallback& callback) OVERRIDE; | 30 const content::PushMessagingService::RegisterCallback& callback) OVERRIDE; |
| 27 | 31 |
| 28 private: | 32 private: |
| 29 void DidRegister( | 33 void DidRegister( |
| 30 const content::PushMessagingService::RegisterCallback& callback, | 34 const content::PushMessagingService::RegisterCallback& callback, |
| 31 const std::string& registration_id, | 35 const std::string& registration_id, |
| 32 GCMClient::Result result); | 36 GCMClient::Result result); |
| 33 | 37 |
| 38 void ShouldProceed( | |
| 39 const std::string& sender_id, | |
| 40 const std::string& app_id, | |
| 41 const content::PushMessagingService::RegisterCallback& callback, | |
| 42 bool allow); | |
| 43 | |
| 34 GCMProfileService* gcm_profile_service_; // It owns us. | 44 GCMProfileService* gcm_profile_service_; // It owns us. |
| 35 | 45 |
| 36 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 46 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
| 37 | 47 |
| 38 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 48 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
| 39 }; | 49 }; |
| 40 | 50 |
| 41 } // namespace gcm | 51 } // namespace gcm |
| 42 | 52 |
| 43 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ | 53 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ |
| OLD | NEW |