| 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 | 9 |
| 9 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| 10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 11 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 #include "net/http/http_request_headers.h" | 15 #include "net/http/http_request_headers.h" |
| 15 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
| 16 #include "net/url_request/url_fetcher.h" | 17 #include "net/url_request/url_fetcher.h" |
| 17 #include "net/url_request/url_request_context.h" | 18 #include "net/url_request/url_request_context.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 fetcher_->Start(); | 57 fetcher_->Start(); |
| 57 } | 58 } |
| 58 | 59 |
| 59 // Overridden from net::URLFetcherDelegate. | 60 // Overridden from net::URLFetcherDelegate. |
| 60 void BlobReader::OnURLFetchComplete(const net::URLFetcher* source) { | 61 void BlobReader::OnURLFetchComplete(const net::URLFetcher* source) { |
| 61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 62 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 62 scoped_ptr<std::string> response(new std::string); | 63 scoped_ptr<std::string> response(new std::string); |
| 63 int64_t first = 0, last = 0, length = 0; | 64 int64_t first = 0, last = 0, length = 0; |
| 64 source->GetResponseAsString(response.get()); | 65 source->GetResponseAsString(response.get()); |
| 65 source->GetResponseHeaders()->GetContentRange(&first, &last, &length); | 66 source->GetResponseHeaders()->GetContentRange(&first, &last, &length); |
| 66 callback_.Run(response.Pass(), length); | 67 callback_.Run(std::move(response), length); |
| 67 | 68 |
| 68 delete this; | 69 delete this; |
| 69 } | 70 } |
| OLD | NEW |