| 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/privet_v3_session.h" | 5 #include "chrome/browser/extensions/api/gcd_private/privet_v3_session.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 << ", error: " << source->GetStatus().error() | 152 << ", error: " << source->GetStatus().error() |
| 153 << ", response code: " << source->GetResponseCode(); | 153 << ", response code: " << source->GetResponseCode(); |
| 154 | 154 |
| 155 scoped_ptr<base::DictionaryValue> value = GetJson(source); | 155 scoped_ptr<base::DictionaryValue> value = GetJson(source); |
| 156 if (!value) { | 156 if (!value) { |
| 157 return ReplyAndDestroyItself(Result::STATUS_CONNECTIONERROR, | 157 return ReplyAndDestroyItself(Result::STATUS_CONNECTIONERROR, |
| 158 base::DictionaryValue()); | 158 base::DictionaryValue()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool has_error = value->HasKey(kPrivetV3KeyError); | 161 bool has_error = value->HasKey(kPrivetV3KeyError); |
| 162 LOG_IF(ERROR, has_error) << "Response: " << value; | 162 LOG_IF(ERROR, has_error) << "Response: " << value.get(); |
| 163 ReplyAndDestroyItself( | 163 ReplyAndDestroyItself( |
| 164 has_error ? Result::STATUS_DEVICEERROR : Result::STATUS_SUCCESS, *value); | 164 has_error ? Result::STATUS_DEVICEERROR : Result::STATUS_SUCCESS, *value); |
| 165 } | 165 } |
| 166 | 166 |
| 167 net::URLFetcher* PrivetV3Session::FetcherDelegate::CreateURLFetcher( | 167 net::URLFetcher* PrivetV3Session::FetcherDelegate::CreateURLFetcher( |
| 168 const GURL& url, | 168 const GURL& url, |
| 169 net::URLFetcher::RequestType request_type, | 169 net::URLFetcher::RequestType request_type, |
| 170 bool orphaned) { | 170 bool orphaned) { |
| 171 DCHECK(!url_fetcher_); | 171 DCHECK(!url_fetcher_); |
| 172 DCHECK(session_); | 172 DCHECK(session_); |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 // Only session with pairing in process needs to be canceled. Paired sessions | 507 // Only session with pairing in process needs to be canceled. Paired sessions |
| 508 // (in https mode) does not need to be canceled. | 508 // (in https mode) does not need to be canceled. |
| 509 if (session_id_.empty() || use_https_) | 509 if (session_id_.empty() || use_https_) |
| 510 return; | 510 return; |
| 511 base::DictionaryValue input; | 511 base::DictionaryValue input; |
| 512 input.SetString(kPrivetV3KeySessionId, session_id_); | 512 input.SetString(kPrivetV3KeySessionId, session_id_); |
| 513 StartPostRequest(kPrivetV3PairingCancelPath, input, MessageCallback()); | 513 StartPostRequest(kPrivetV3PairingCancelPath, input, MessageCallback()); |
| 514 } | 514 } |
| 515 | 515 |
| 516 } // namespace extensions | 516 } // namespace extensions |
| OLD | NEW |