| 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_DRIVER_DESKTOP_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 
| 6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 
| 7 | 7 | 
| 8 #include <map> | 8 #include <map> | 
| 9 #include <memory> | 9 #include <memory> | 
| 10 #include <string> | 10 #include <string> | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 51       const std::string& user_agent, | 51       const std::string& user_agent, | 
| 52       PrefService* prefs, | 52       PrefService* prefs, | 
| 53       const base::FilePath& store_path, | 53       const base::FilePath& store_path, | 
| 54       const scoped_refptr<net::URLRequestContextGetter>& request_context, | 54       const scoped_refptr<net::URLRequestContextGetter>& request_context, | 
| 55       const scoped_refptr<base::SequencedTaskRunner>& ui_thread, | 55       const scoped_refptr<base::SequencedTaskRunner>& ui_thread, | 
| 56       const scoped_refptr<base::SequencedTaskRunner>& io_thread, | 56       const scoped_refptr<base::SequencedTaskRunner>& io_thread, | 
| 57       const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); | 57       const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); | 
| 58   ~GCMDriverDesktop() override; | 58   ~GCMDriverDesktop() override; | 
| 59 | 59 | 
| 60   // GCMDriver implementation: | 60   // GCMDriver implementation: | 
|  | 61   void ValidateRegistration( | 
|  | 62       const std::string& app_id, | 
|  | 63       const std::vector<std::string>& sender_ids, | 
|  | 64       const std::string& registration_id, | 
|  | 65       const ValidateRegistrationCallback& callback) override; | 
| 61   void Shutdown() override; | 66   void Shutdown() override; | 
| 62   void OnSignedIn() override; | 67   void OnSignedIn() override; | 
| 63   void OnSignedOut() override; | 68   void OnSignedOut() override; | 
| 64   void AddAppHandler(const std::string& app_id, | 69   void AddAppHandler(const std::string& app_id, | 
| 65                      GCMAppHandler* handler) override; | 70                      GCMAppHandler* handler) override; | 
| 66   void RemoveAppHandler(const std::string& app_id) override; | 71   void RemoveAppHandler(const std::string& app_id) override; | 
| 67   void AddConnectionObserver(GCMConnectionObserver* observer) override; | 72   void AddConnectionObserver(GCMConnectionObserver* observer) override; | 
| 68   void RemoveConnectionObserver(GCMConnectionObserver* observer) override; | 73   void RemoveConnectionObserver(GCMConnectionObserver* observer) override; | 
| 69   void Enable() override; | 74   void Enable() override; | 
| 70   void Disable() override; | 75   void Disable() override; | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 104   void RecordDecryptionFailure(const std::string& app_id, | 109   void RecordDecryptionFailure(const std::string& app_id, | 
| 105                                GCMEncryptionProvider::DecryptionResult result) | 110                                GCMEncryptionProvider::DecryptionResult result) | 
| 106       override; | 111       override; | 
| 107 | 112 | 
| 108   // InstanceIDHandler implementation: | 113   // InstanceIDHandler implementation: | 
| 109   void GetToken(const std::string& app_id, | 114   void GetToken(const std::string& app_id, | 
| 110                 const std::string& authorized_entity, | 115                 const std::string& authorized_entity, | 
| 111                 const std::string& scope, | 116                 const std::string& scope, | 
| 112                 const std::map<std::string, std::string>& options, | 117                 const std::map<std::string, std::string>& options, | 
| 113                 const GetTokenCallback& callback) override; | 118                 const GetTokenCallback& callback) override; | 
|  | 119   void ValidateToken(const std::string& app_id, | 
|  | 120                      const std::string& authorized_entity, | 
|  | 121                      const std::string& scope, | 
|  | 122                      const std::string& token, | 
|  | 123                      const ValidateTokenCallback& callback) override; | 
| 114   void DeleteToken(const std::string& app_id, | 124   void DeleteToken(const std::string& app_id, | 
| 115                    const std::string& authorized_entity, | 125                    const std::string& authorized_entity, | 
| 116                    const std::string& scope, | 126                    const std::string& scope, | 
| 117                    const DeleteTokenCallback& callback) override; | 127                    const DeleteTokenCallback& callback) override; | 
| 118   void AddInstanceIDData(const std::string& app_id, | 128   void AddInstanceIDData(const std::string& app_id, | 
| 119                          const std::string& instance_id, | 129                          const std::string& instance_id, | 
| 120                          const std::string& extra_data) override; | 130                          const std::string& extra_data) override; | 
| 121   void RemoveInstanceIDData(const std::string& app_id) override; | 131   void RemoveInstanceIDData(const std::string& app_id) override; | 
| 122   void GetInstanceIDData(const std::string& app_id, | 132   void GetInstanceIDData(const std::string& app_id, | 
| 123                          const GetInstanceIDDataCallback& callback) override; | 133                          const GetInstanceIDDataCallback& callback) override; | 
| 124 | 134 | 
| 125  private: | 135  private: | 
| 126   class IOWorker; | 136   class IOWorker; | 
| 127 | 137 | 
| 128   typedef std::tuple<std::string, std::string, std::string> TokenTuple; | 138   typedef std::tuple<std::string, std::string, std::string> TokenTuple; | 
| 129   struct TokenTupleComparer { | 139   struct TokenTupleComparer { | 
| 130     bool operator()(const TokenTuple& a, const TokenTuple& b) const; | 140     bool operator()(const TokenTuple& a, const TokenTuple& b) const; | 
| 131   }; | 141   }; | 
| 132 | 142 | 
|  | 143   void DoValidateRegistration( | 
|  | 144       std::unique_ptr<RegistrationInfo> registration_info, | 
|  | 145       const std::string& registration_id, | 
|  | 146       const ValidateRegistrationCallback& callback); | 
|  | 147 | 
| 133   //  Stops the GCM service. It can be restarted by calling EnsureStarted again. | 148   //  Stops the GCM service. It can be restarted by calling EnsureStarted again. | 
| 134   void Stop(); | 149   void Stop(); | 
| 135 | 150 | 
| 136   // Remove cached data when GCM service is stopped. | 151   // Remove cached data when GCM service is stopped. | 
| 137   void RemoveCachedData(); | 152   void RemoveCachedData(); | 
| 138 | 153 | 
| 139   void DoRegister(const std::string& app_id, | 154   void DoRegister(const std::string& app_id, | 
| 140                   const std::vector<std::string>& sender_ids); | 155                   const std::vector<std::string>& sender_ids); | 
| 141   void DoUnregister(const std::string& app_id); | 156   void DoUnregister(const std::string& app_id); | 
| 142   void DoSend(const std::string& app_id, | 157   void DoSend(const std::string& app_id, | 
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 236 | 251 | 
| 237   // Used to pass a weak pointer to the IO worker. | 252   // Used to pass a weak pointer to the IO worker. | 
| 238   base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_; | 253   base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_; | 
| 239 | 254 | 
| 240   DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop); | 255   DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop); | 
| 241 }; | 256 }; | 
| 242 | 257 | 
| 243 }  // namespace gcm | 258 }  // namespace gcm | 
| 244 | 259 | 
| 245 #endif  // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 260 #endif  // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 
| OLD | NEW | 
|---|