| 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 "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 | 14 |
| 14 class Profile; | 15 class Profile; |
| 15 | 16 |
| 16 namespace user_prefs { | 17 namespace user_prefs { |
| 17 class PrefRegistrySyncable; | 18 class PrefRegistrySyncable; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace gcm { | 21 namespace gcm { |
| 21 | 22 |
| 22 class GCMProfileService; | 23 class GCMProfileService; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 47 // content::PushMessagingService implementation: | 48 // content::PushMessagingService implementation: |
| 48 virtual void Register( | 49 virtual void Register( |
| 49 const std::string& app_id, | 50 const std::string& app_id, |
| 50 const std::string& sender_id, | 51 const std::string& sender_id, |
| 51 int renderer_id, | 52 int renderer_id, |
| 52 int render_frame_id, | 53 int render_frame_id, |
| 53 bool user_gesture, | 54 bool user_gesture, |
| 54 const content::PushMessagingService::RegisterCallback& callback) OVERRIDE; | 55 const content::PushMessagingService::RegisterCallback& callback) OVERRIDE; |
| 55 | 56 |
| 56 private: | 57 private: |
| 58 void RegisterEnd( |
| 59 const std::string& app_id, |
| 60 const content::PushMessagingService::RegisterCallback& callback, |
| 61 const std::string& registration_id, |
| 62 content::PushMessagingStatus status); |
| 63 |
| 57 void DidRegister( | 64 void DidRegister( |
| 58 const std::string& app_id, | 65 const std::string& app_id, |
| 59 const content::PushMessagingService::RegisterCallback& callback, | 66 const content::PushMessagingService::RegisterCallback& callback, |
| 60 const std::string& registration_id, | 67 const std::string& registration_id, |
| 61 GCMClient::Result result); | 68 GCMClient::Result result); |
| 62 | 69 |
| 63 void DidRequestPermission( | 70 void DidRequestPermission( |
| 64 const std::string& sender_id, | 71 const std::string& sender_id, |
| 65 const std::string& app_id, | 72 const std::string& app_id, |
| 66 const content::PushMessagingService::RegisterCallback& callback, | 73 const content::PushMessagingService::RegisterCallback& callback, |
| 67 bool allow); | 74 bool allow); |
| 68 | 75 |
| 69 GCMProfileService* gcm_profile_service_; // It owns us. | 76 GCMProfileService* gcm_profile_service_; // It owns us. |
| 70 | 77 |
| 71 Profile* profile_; // It owns our owner. | 78 Profile* profile_; // It owns our owner. |
| 72 | 79 |
| 73 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; | 80 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; |
| 74 | 81 |
| 75 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); | 82 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); |
| 76 }; | 83 }; |
| 77 | 84 |
| 78 } // namespace gcm | 85 } // namespace gcm |
| 79 | 86 |
| 80 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ | 87 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ |
| OLD | NEW |