| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "remoting/host/setup/service_client.h" | 5 #include "remoting/host/setup/service_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 break; | 144 break; |
| 145 case PENDING_REQUEST_REGISTER_HOST: | 145 case PENDING_REQUEST_REGISTER_HOST: |
| 146 { | 146 { |
| 147 std::string data; | 147 std::string data; |
| 148 source->GetResponseAsString(&data); | 148 source->GetResponseAsString(&data); |
| 149 std::unique_ptr<base::Value> message_value = | 149 std::unique_ptr<base::Value> message_value = |
| 150 base::JSONReader::Read(data); | 150 base::JSONReader::Read(data); |
| 151 base::DictionaryValue *dict; | 151 base::DictionaryValue *dict; |
| 152 std::string code; | 152 std::string code; |
| 153 if (message_value.get() && | 153 if (message_value.get() && |
| 154 message_value->IsType(base::Value::TYPE_DICTIONARY) && | 154 message_value->IsType(base::Value::Type::DICTIONARY) && |
| 155 message_value->GetAsDictionary(&dict) && | 155 message_value->GetAsDictionary(&dict) && |
| 156 dict->GetString("data.authorizationCode", &code)) { | 156 dict->GetString("data.authorizationCode", &code)) { |
| 157 delegate_->OnHostRegistered(code); | 157 delegate_->OnHostRegistered(code); |
| 158 } else { | 158 } else { |
| 159 delegate_->OnHostRegistered(std::string()); | 159 delegate_->OnHostRegistered(std::string()); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 break; | 162 break; |
| 163 case PENDING_REQUEST_UNREGISTER_HOST: | 163 case PENDING_REQUEST_UNREGISTER_HOST: |
| 164 delegate_->OnHostUnregistered(); | 164 delegate_->OnHostUnregistered(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 void ServiceClient::UnregisterHost( | 191 void ServiceClient::UnregisterHost( |
| 192 const std::string& host_id, | 192 const std::string& host_id, |
| 193 const std::string& oauth_access_token, | 193 const std::string& oauth_access_token, |
| 194 Delegate* delegate) { | 194 Delegate* delegate) { |
| 195 return core_->UnregisterHost(host_id, oauth_access_token, delegate); | 195 return core_->UnregisterHost(host_id, oauth_access_token, delegate); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace gaia | 198 } // namespace gaia |
| OLD | NEW |