| 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 "chrome/browser/extensions/blob_reader.h" | 5 #include "chrome/browser/extensions/blob_reader.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 void BlobReader::Start() { | 55 void BlobReader::Start() { |
| 56 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 56 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 57 fetcher_->Start(); | 57 fetcher_->Start(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Overridden from net::URLFetcherDelegate. | 60 // Overridden from net::URLFetcherDelegate. |
| 61 void BlobReader::OnURLFetchComplete(const net::URLFetcher* source) { | 61 void BlobReader::OnURLFetchComplete(const net::URLFetcher* source) { |
| 62 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 62 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 63 scoped_ptr<std::string> response(new std::string); | 63 std::unique_ptr<std::string> response(new std::string); |
| 64 int64_t first = 0, last = 0, length = 0; | 64 int64_t first = 0, last = 0, length = 0; |
| 65 source->GetResponseAsString(response.get()); | 65 source->GetResponseAsString(response.get()); |
| 66 source->GetResponseHeaders()->GetContentRange(&first, &last, &length); | 66 source->GetResponseHeaders()->GetContentRange(&first, &last, &length); |
| 67 callback_.Run(std::move(response), length); | 67 callback_.Run(std::move(response), length); |
| 68 | 68 |
| 69 delete this; | 69 delete this; |
| 70 } | 70 } |
| OLD | NEW |