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 <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 // Sends a message to a given receiver. | 80 // Sends a message to a given receiver. |
81 // |app_id|: application ID. | 81 // |app_id|: application ID. |
82 // |receiver_id|: registration ID of the receiver party. | 82 // |receiver_id|: registration ID of the receiver party. |
83 // |message|: message to be sent. | 83 // |message|: message to be sent. |
84 // |callback|: to be called once the asynchronous operation is done. | 84 // |callback|: to be called once the asynchronous operation is done. |
85 virtual void Send(const std::string& app_id, | 85 virtual void Send(const std::string& app_id, |
86 const std::string& receiver_id, | 86 const std::string& receiver_id, |
87 const GCMClient::OutgoingMessage& message, | 87 const GCMClient::OutgoingMessage& message, |
88 SendCallback callback); | 88 SendCallback callback); |
89 | 89 |
90 // Returns true if the profile is signed in. | |
91 bool IsSignedIn(); | |
jianli
2014/02/27 00:49:34
nit: add const modifier
juyik
2014/03/01 00:21:57
Done.
| |
92 | |
90 // For testing purpose. | 93 // For testing purpose. |
91 void set_testing_delegate(TestingDelegate* testing_delegate) { | 94 void set_testing_delegate(TestingDelegate* testing_delegate) { |
92 testing_delegate_ = testing_delegate; | 95 testing_delegate_ = testing_delegate; |
93 } | 96 } |
94 | 97 |
98 // Returns the GCM client instance. Can be NULL. Callee owns the instance. | |
99 GCMClient* GetGCMClient(); | |
fgorski
2014/02/26 23:38:19
You should not expose the GCMClient that way.
Your
jianli
2014/02/27 00:49:34
GCMClient is supposed to be used only in IO thread
juyik
2014/03/01 00:21:57
Done. Switch between UI and IO thread thru GCM pro
| |
100 | |
95 protected: | 101 protected: |
96 // Flag that could be set by the testing code to enable GCM. Otherwise, | 102 // Flag that could be set by the testing code to enable GCM. Otherwise, |
97 // tests from official build will fail. | 103 // tests from official build will fail. |
98 static bool enable_gcm_for_testing_; | 104 static bool enable_gcm_for_testing_; |
99 | 105 |
100 private: | 106 private: |
101 friend class GCMProfileServiceTestConsumer; | 107 friend class GCMProfileServiceTestConsumer; |
102 | 108 |
103 class DelayedTaskController; | 109 class DelayedTaskController; |
104 class IOWorker; | 110 class IOWorker; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 | 223 |
218 // Used to pass a weak pointer to the IO worker. | 224 // Used to pass a weak pointer to the IO worker. |
219 base::WeakPtrFactory<GCMProfileService> weak_ptr_factory_; | 225 base::WeakPtrFactory<GCMProfileService> weak_ptr_factory_; |
220 | 226 |
221 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); | 227 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); |
222 }; | 228 }; |
223 | 229 |
224 } // namespace gcm | 230 } // namespace gcm |
225 | 231 |
226 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ | 232 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ |
OLD | NEW |