| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_GCM_PROFILE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ | 6 #define CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // TODO(jianli): obsolete methods that are going to be removed soon. | 47 // TODO(jianli): obsolete methods that are going to be removed soon. |
| 48 void AddAppHandler(const std::string& app_id, GCMAppHandler* handler); | 48 void AddAppHandler(const std::string& app_id, GCMAppHandler* handler); |
| 49 void RemoveAppHandler(const std::string& app_id); | 49 void RemoveAppHandler(const std::string& app_id); |
| 50 void Register(const std::string& app_id, | 50 void Register(const std::string& app_id, |
| 51 const std::vector<std::string>& sender_ids, | 51 const std::vector<std::string>& sender_ids, |
| 52 const GCMDriver::RegisterCallback& callback); | 52 const GCMDriver::RegisterCallback& callback); |
| 53 | 53 |
| 54 // KeyedService: | 54 // KeyedService: |
| 55 virtual void Shutdown() OVERRIDE; | 55 virtual void Shutdown() OVERRIDE; |
| 56 | 56 |
| 57 // Returns the user name if the profile is signed in or an empty string |
| 58 // otherwise. |
| 59 // TODO(jianli): To be removed when sign-in enforcement is dropped. |
| 60 std::string SignedInUserName() const; |
| 61 |
| 57 // For testing purpose. | 62 // For testing purpose. |
| 58 void SetDriverForTesting(GCMDriver* driver); | 63 void SetDriverForTesting(GCMDriver* driver); |
| 59 | 64 |
| 60 GCMDriver* driver() const { return driver_.get(); } | 65 GCMDriver* driver() const { return driver_.get(); } |
| 61 | 66 |
| 62 content::PushMessagingService* push_messaging_service() { | 67 content::PushMessagingService* push_messaging_service() { |
| 63 return &push_messaging_service_; | 68 return &push_messaging_service_; |
| 64 } | 69 } |
| 65 | 70 |
| 66 protected: | 71 protected: |
| 67 // Used for constructing fake GCMProfileService for testing purpose. | 72 // Used for constructing fake GCMProfileService for testing purpose. |
| 68 GCMProfileService(); | 73 GCMProfileService(); |
| 69 | 74 |
| 70 private: | 75 private: |
| 71 // The profile which owns this object. | 76 // The profile which owns this object. |
| 72 Profile* profile_; | 77 Profile* profile_; |
| 73 | 78 |
| 74 scoped_ptr<GCMDriver> driver_; | 79 scoped_ptr<GCMDriver> driver_; |
| 75 | 80 |
| 76 // Implementation of content::PushMessagingService using GCMProfileService. | 81 // Implementation of content::PushMessagingService using GCMProfileService. |
| 77 PushMessagingServiceImpl push_messaging_service_; | 82 PushMessagingServiceImpl push_messaging_service_; |
| 78 | 83 |
| 84 // TODO(jianli): To be removed when sign-in enforcement is dropped. |
| 85 #if !defined(OS_ANDROID) |
| 86 class IdentityObserver; |
| 87 scoped_ptr<IdentityObserver> identity_observer_; |
| 88 #endif |
| 89 |
| 79 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); | 90 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); |
| 80 }; | 91 }; |
| 81 | 92 |
| 82 } // namespace gcm | 93 } // namespace gcm |
| 83 | 94 |
| 84 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ | 95 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ |
| OLD | NEW |