| 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 #include "chrome/browser/extensions/api/gcd_private/gcd_private_api.h" | 5 #include "chrome/browser/extensions/api/gcd_private/gcd_private_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 typedef std::map<std::string /* id_string */, | 142 typedef std::map<std::string /* id_string */, |
| 143 linked_ptr<api::gcd_private::GCDDevice> > GCDDeviceMap; | 143 linked_ptr<api::gcd_private::GCDDevice> > GCDDeviceMap; |
| 144 | 144 |
| 145 typedef std::map<int /* session id*/, linked_ptr<GcdPrivateSessionHolder> > | 145 typedef std::map<int /* session id*/, linked_ptr<GcdPrivateSessionHolder> > |
| 146 GCDSessionMap; | 146 GCDSessionMap; |
| 147 | 147 |
| 148 typedef std::map<std::string /* ssid */, std::string /* password */> | 148 typedef std::map<std::string /* ssid */, std::string /* password */> |
| 149 PasswordMap; | 149 PasswordMap; |
| 150 | 150 |
| 151 // EventRouter::Observer implementation. | 151 // EventRouter::Observer implementation. |
| 152 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | 152 virtual void OnListenerAdded(const EventListenerInfo& details) override; |
| 153 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; | 153 virtual void OnListenerRemoved(const EventListenerInfo& details) override; |
| 154 | 154 |
| 155 // local_discovery::PrivetDeviceLister implementation. | 155 // local_discovery::PrivetDeviceLister implementation. |
| 156 virtual void DeviceChanged( | 156 virtual void DeviceChanged( |
| 157 bool added, | 157 bool added, |
| 158 const std::string& name, | 158 const std::string& name, |
| 159 const local_discovery::DeviceDescription& description) OVERRIDE; | 159 const local_discovery::DeviceDescription& description) override; |
| 160 virtual void DeviceRemoved(const std::string& name) OVERRIDE; | 160 virtual void DeviceRemoved(const std::string& name) override; |
| 161 virtual void DeviceCacheFlushed() OVERRIDE; | 161 virtual void DeviceCacheFlushed() override; |
| 162 | 162 |
| 163 void SendMessageInternal(int session_id, | 163 void SendMessageInternal(int session_id, |
| 164 const std::string& api, | 164 const std::string& api, |
| 165 const base::DictionaryValue& input, | 165 const base::DictionaryValue& input, |
| 166 const MessageResponseCallback& callback); | 166 const MessageResponseCallback& callback); |
| 167 | 167 |
| 168 #if defined(ENABLE_WIFI_BOOTSTRAPPING) | 168 #if defined(ENABLE_WIFI_BOOTSTRAPPING) |
| 169 void OnWifiPassword(const SuccessCallback& callback, | 169 void OnWifiPassword(const SuccessCallback& callback, |
| 170 bool success, | 170 bool success, |
| 171 const std::string& ssid, | 171 const std::string& ssid, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 192 | 192 |
| 193 class GcdPrivateRequest : public local_discovery::PrivetV3Session::Request { | 193 class GcdPrivateRequest : public local_discovery::PrivetV3Session::Request { |
| 194 public: | 194 public: |
| 195 GcdPrivateRequest(const std::string& api, | 195 GcdPrivateRequest(const std::string& api, |
| 196 const base::DictionaryValue& input, | 196 const base::DictionaryValue& input, |
| 197 const GcdPrivateAPIImpl::MessageResponseCallback& callback, | 197 const GcdPrivateAPIImpl::MessageResponseCallback& callback, |
| 198 GcdPrivateSessionHolder* session_holder); | 198 GcdPrivateSessionHolder* session_holder); |
| 199 virtual ~GcdPrivateRequest(); | 199 virtual ~GcdPrivateRequest(); |
| 200 | 200 |
| 201 // local_discovery::PrivetV3Session::Request implementation. | 201 // local_discovery::PrivetV3Session::Request implementation. |
| 202 virtual std::string GetName() OVERRIDE; | 202 virtual std::string GetName() override; |
| 203 virtual const base::DictionaryValue& GetInput() OVERRIDE; | 203 virtual const base::DictionaryValue& GetInput() override; |
| 204 virtual void OnError( | 204 virtual void OnError( |
| 205 local_discovery::PrivetURLFetcher::ErrorType error) OVERRIDE; | 205 local_discovery::PrivetURLFetcher::ErrorType error) override; |
| 206 virtual void OnParsedJson(const base::DictionaryValue& value, | 206 virtual void OnParsedJson(const base::DictionaryValue& value, |
| 207 bool has_error) OVERRIDE; | 207 bool has_error) override; |
| 208 | 208 |
| 209 private: | 209 private: |
| 210 std::string api_; | 210 std::string api_; |
| 211 scoped_ptr<base::DictionaryValue> input_; | 211 scoped_ptr<base::DictionaryValue> input_; |
| 212 GcdPrivateAPIImpl::MessageResponseCallback callback_; | 212 GcdPrivateAPIImpl::MessageResponseCallback callback_; |
| 213 GcdPrivateSessionHolder* session_holder_; | 213 GcdPrivateSessionHolder* session_holder_; |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 class GcdPrivateSessionHolder | 216 class GcdPrivateSessionHolder |
| 217 : public local_discovery::PrivetV3Session::Delegate { | 217 : public local_discovery::PrivetV3Session::Delegate { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 235 void SendMessage(const std::string& api, | 235 void SendMessage(const std::string& api, |
| 236 const base::DictionaryValue& input, | 236 const base::DictionaryValue& input, |
| 237 GcdPrivateAPIImpl::MessageResponseCallback callback); | 237 GcdPrivateAPIImpl::MessageResponseCallback callback); |
| 238 | 238 |
| 239 void DeleteRequest(GcdPrivateRequest* request); | 239 void DeleteRequest(GcdPrivateRequest* request); |
| 240 | 240 |
| 241 private: | 241 private: |
| 242 // local_discovery::PrivetV3Session::Delegate implementation. | 242 // local_discovery::PrivetV3Session::Delegate implementation. |
| 243 virtual void OnSetupConfirmationNeeded( | 243 virtual void OnSetupConfirmationNeeded( |
| 244 const std::string& confirmation_code, | 244 const std::string& confirmation_code, |
| 245 api::gcd_private::ConfirmationType confirmation_type) OVERRIDE; | 245 api::gcd_private::ConfirmationType confirmation_type) override; |
| 246 virtual void OnSessionStatus(api::gcd_private::Status status) OVERRIDE; | 246 virtual void OnSessionStatus(api::gcd_private::Status status) override; |
| 247 | 247 |
| 248 scoped_ptr<local_discovery::PrivetHTTPClient> http_client_; | 248 scoped_ptr<local_discovery::PrivetHTTPClient> http_client_; |
| 249 scoped_ptr<local_discovery::PrivetV3Session> privet_session_; | 249 scoped_ptr<local_discovery::PrivetV3Session> privet_session_; |
| 250 typedef ScopedVector<GcdPrivateRequest> RequestVector; | 250 typedef ScopedVector<GcdPrivateRequest> RequestVector; |
| 251 RequestVector requests_; | 251 RequestVector requests_; |
| 252 | 252 |
| 253 ConfirmationCodeCallback confirm_callback_; | 253 ConfirmationCodeCallback confirm_callback_; |
| 254 GcdPrivateAPIImpl::SessionEstablishedCallback session_established_callback_; | 254 GcdPrivateAPIImpl::SessionEstablishedCallback session_established_callback_; |
| 255 }; | 255 }; |
| 256 | 256 |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 } | 931 } |
| 932 | 932 |
| 933 GcdPrivateGetCommandsListFunction::~GcdPrivateGetCommandsListFunction() { | 933 GcdPrivateGetCommandsListFunction::~GcdPrivateGetCommandsListFunction() { |
| 934 } | 934 } |
| 935 | 935 |
| 936 bool GcdPrivateGetCommandsListFunction::RunAsync() { | 936 bool GcdPrivateGetCommandsListFunction::RunAsync() { |
| 937 return false; | 937 return false; |
| 938 } | 938 } |
| 939 | 939 |
| 940 } // namespace extensions | 940 } // namespace extensions |
| OLD | NEW |