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 COMPONENTS_GCM_DRIVER_GCM_ACCOUNT_MAPPER_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_ACCOUNT_MAPPER_H_ |
6 #define COMPONENTS_GCM_DRIVER_GCM_ACCOUNT_MAPPER_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_ACCOUNT_MAPPER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "components/gcm_driver/gcm_app_handler.h" | 15 #include "components/gcm_driver/gcm_app_handler.h" |
16 #include "components/gcm_driver/gcm_client.h" | 16 #include "components/gcm_driver/gcm_client.h" |
17 #include "components/gcm_driver/gcm_message_status.h" | |
17 #include "google_apis/gcm/engine/account_mapping.h" | 18 #include "google_apis/gcm/engine/account_mapping.h" |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 class Clock; | 21 class Clock; |
21 } | 22 } |
22 | 23 |
23 namespace gcm { | 24 namespace gcm { |
24 | 25 |
25 class GCMDriver; | 26 class GCMDriver; |
26 extern const char kGCMAccountMapperAppId[]; | 27 extern const char kGCMAccountMapperAppId[]; |
27 | 28 |
28 // Class for mapping signed-in GAIA accounts to the GCM Device ID. | 29 // Class for mapping signed-in GAIA accounts to the GCM Device ID. |
29 class GCMAccountMapper : public GCMAppHandler { | 30 class GCMAccountMapper : public GCMAppHandler { |
30 public: | 31 public: |
31 // List of account mappings. | 32 // List of account mappings. |
32 typedef std::vector<AccountMapping> AccountMappings; | 33 typedef std::vector<AccountMapping> AccountMappings; |
33 typedef base::Callback<void(const std::string& app_id, | 34 typedef base::Callback<void(const std::string& app_id, |
34 const IncomingMessage& message)> | 35 const IncomingMessage& message, |
36 const MessageReceiptCallback& callback)> | |
35 DispatchMessageCallback; | 37 DispatchMessageCallback; |
Peter Beverloo
2017/02/08 17:09:09
nit: I know you're just passing by, but mind updat
harkness
2017/02/09 16:27:29
Done.
| |
36 | 38 |
37 explicit GCMAccountMapper(GCMDriver* gcm_driver); | 39 explicit GCMAccountMapper(GCMDriver* gcm_driver); |
38 ~GCMAccountMapper() override; | 40 ~GCMAccountMapper() override; |
39 | 41 |
40 void Initialize(const AccountMappings& account_mappings, | 42 void Initialize(const AccountMappings& account_mappings, |
41 const DispatchMessageCallback& callback); | 43 const DispatchMessageCallback& callback); |
42 | 44 |
43 // Called by AccountTracker, when a new list of account tokens is available. | 45 // Called by AccountTracker, when a new list of account tokens is available. |
44 // This will cause a refresh of account mappings and sending updates to GCM. | 46 // This will cause a refresh of account mappings and sending updates to GCM. |
45 void SetAccountTokens( | 47 void SetAccountTokens( |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 bool initialized_; | 127 bool initialized_; |
126 | 128 |
127 base::WeakPtrFactory<GCMAccountMapper> weak_ptr_factory_; | 129 base::WeakPtrFactory<GCMAccountMapper> weak_ptr_factory_; |
128 | 130 |
129 DISALLOW_COPY_AND_ASSIGN(GCMAccountMapper); | 131 DISALLOW_COPY_AND_ASSIGN(GCMAccountMapper); |
130 }; | 132 }; |
131 | 133 |
132 } // namespace gcm | 134 } // namespace gcm |
133 | 135 |
134 #endif // COMPONENTS_GCM_DRIVER_GCM_ACCOUNT_MAPPER_H_ | 136 #endif // COMPONENTS_GCM_DRIVER_GCM_ACCOUNT_MAPPER_H_ |
OLD | NEW |