OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/loader/certificate_resource_handler.h" | 5 #include "content/browser/loader/certificate_resource_handler.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "content/browser/loader/resource_request_info_impl.h" | 8 #include "content/browser/loader/resource_request_info_impl.h" |
9 #include "content/public/browser/content_browser_client.h" | 9 #include "content/public/browser/content_browser_client.h" |
10 #include "content/public/common/resource_response.h" | 10 #include "content/public/common/resource_response.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 bool* defer) { | 84 bool* defer) { |
85 if (!bytes_read) | 85 if (!bytes_read) |
86 return true; | 86 return true; |
87 | 87 |
88 // We have more data to read. | 88 // We have more data to read. |
89 DCHECK(read_buffer_.get()); | 89 DCHECK(read_buffer_.get()); |
90 content_length_ += bytes_read; | 90 content_length_ += bytes_read; |
91 | 91 |
92 // Release the ownership of the buffer, and store a reference | 92 // Release the ownership of the buffer, and store a reference |
93 // to it. A new one will be allocated in OnWillRead(). | 93 // to it. A new one will be allocated in OnWillRead(). |
94 net::IOBuffer* buffer = NULL; | 94 scoped_refptr<net::IOBuffer> buffer; |
95 read_buffer_.swap(&buffer); | 95 read_buffer_.swap(buffer); |
96 // TODO(gauravsh): Should this be handled by a separate thread? | 96 // TODO(gauravsh): Should this be handled by a separate thread? |
97 buffer_.push_back(std::make_pair(buffer, bytes_read)); | 97 buffer_.push_back(std::make_pair(buffer, bytes_read)); |
98 | 98 |
99 return true; | 99 return true; |
100 } | 100 } |
101 | 101 |
102 void CertificateResourceHandler::OnResponseCompleted( | 102 void CertificateResourceHandler::OnResponseCompleted( |
103 int request_id, | 103 int request_id, |
104 const net::URLRequestStatus& urs, | 104 const net::URLRequestStatus& urs, |
105 const std::string& sec_info, | 105 const std::string& sec_info, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 DCHECK_EQ(content_length_, bytes_copied); | 144 DCHECK_EQ(content_length_, bytes_copied); |
145 } | 145 } |
146 | 146 |
147 void CertificateResourceHandler::OnDataDownloaded( | 147 void CertificateResourceHandler::OnDataDownloaded( |
148 int request_id, | 148 int request_id, |
149 int bytes_downloaded) { | 149 int bytes_downloaded) { |
150 NOTREACHED(); | 150 NOTREACHED(); |
151 } | 151 } |
152 | 152 |
153 } // namespace content | 153 } // namespace content |
OLD | NEW |