| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 void GcdPrivateCreateSessionFunction::OnSessionInitialized( | 305 void GcdPrivateCreateSessionFunction::OnSessionInitialized( |
| 306 int session_id, | 306 int session_id, |
| 307 api::gcd_private::Status status, | 307 api::gcd_private::Status status, |
| 308 const base::DictionaryValue& info) { | 308 const base::DictionaryValue& info) { |
| 309 std::vector<api::gcd_private::PairingType> pairing_types; | 309 std::vector<api::gcd_private::PairingType> pairing_types; |
| 310 | 310 |
| 311 // TODO(vitalybuka): Remove this parsing and |pairing_types| from callback. | 311 // TODO(vitalybuka): Remove this parsing and |pairing_types| from callback. |
| 312 if (status == gcd_private::STATUS_SUCCESS) { | 312 if (status == gcd_private::STATUS_SUCCESS) { |
| 313 const base::ListValue* pairing = nullptr; | 313 const base::ListValue* pairing = nullptr; |
| 314 if (info.GetList("authentication.pairing", &pairing)) { | 314 if (info.GetList("authentication.pairing", &pairing)) { |
| 315 for (const base::Value* value : *pairing) { | 315 for (const auto& value : *pairing) { |
| 316 std::string pairing_string; | 316 std::string pairing_string; |
| 317 if (value->GetAsString(&pairing_string)) { | 317 if (value->GetAsString(&pairing_string)) { |
| 318 api::gcd_private::PairingType pairing_type = | 318 api::gcd_private::PairingType pairing_type = |
| 319 api::gcd_private::ParsePairingType(pairing_string); | 319 api::gcd_private::ParsePairingType(pairing_string); |
| 320 if (pairing_type != api::gcd_private::PAIRING_TYPE_NONE) | 320 if (pairing_type != api::gcd_private::PAIRING_TYPE_NONE) |
| 321 pairing_types.push_back(pairing_type); | 321 pairing_types.push_back(pairing_type); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 } else { | 324 } else { |
| 325 status = gcd_private::STATUS_SESSIONERROR; | 325 status = gcd_private::STATUS_SESSIONERROR; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 437 |
| 438 GcdPrivateAPIImpl* gcd_api = GcdPrivateAPIImpl::Get(GetProfile()); | 438 GcdPrivateAPIImpl* gcd_api = GcdPrivateAPIImpl::Get(GetProfile()); |
| 439 | 439 |
| 440 gcd_api->RemoveSession(params->session_id); | 440 gcd_api->RemoveSession(params->session_id); |
| 441 | 441 |
| 442 SendResponse(true); | 442 SendResponse(true); |
| 443 return true; | 443 return true; |
| 444 } | 444 } |
| 445 | 445 |
| 446 } // namespace extensions | 446 } // namespace extensions |
| OLD | NEW |