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 "chrome/browser/extensions/api/web_request/upload_data_presenter.h" | 5 #include "chrome/browser/extensions/api/web_request/upload_data_presenter.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/api/web_request/form_data_parser.h" | 10 #include "chrome/browser/extensions/api/web_request/form_data_parser.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 void RawDataPresenter::FeedNextBytes(const char* bytes, size_t size) { | 91 void RawDataPresenter::FeedNextBytes(const char* bytes, size_t size) { |
92 subtle::AppendKeyValuePair(keys::kRequestBodyRawBytesKey, | 92 subtle::AppendKeyValuePair(keys::kRequestBodyRawBytesKey, |
93 BinaryValue::CreateWithCopiedBuffer(bytes, size), | 93 BinaryValue::CreateWithCopiedBuffer(bytes, size), |
94 list_.get()); | 94 list_.get()); |
95 } | 95 } |
96 | 96 |
97 void RawDataPresenter::FeedNextFile(const std::string& filename) { | 97 void RawDataPresenter::FeedNextFile(const std::string& filename) { |
98 // Insert the file path instead of the contents, which may be too large. | 98 // Insert the file path instead of the contents, which may be too large. |
99 subtle::AppendKeyValuePair(keys::kRequestBodyRawFileKey, | 99 subtle::AppendKeyValuePair(keys::kRequestBodyRawFileKey, |
100 Value::CreateStringValue(filename), | 100 new base::StringValue(filename), |
101 list_.get()); | 101 list_.get()); |
102 } | 102 } |
103 | 103 |
104 // Implementation of ParsedDataPresenter. | 104 // Implementation of ParsedDataPresenter. |
105 | 105 |
106 ParsedDataPresenter::ParsedDataPresenter(const net::URLRequest& request) | 106 ParsedDataPresenter::ParsedDataPresenter(const net::URLRequest& request) |
107 : parser_(FormDataParser::Create(request)), | 107 : parser_(FormDataParser::Create(request)), |
108 success_(parser_.get() != NULL), | 108 success_(parser_.get() != NULL), |
109 dictionary_(success_ ? new DictionaryValue() : NULL) { | 109 dictionary_(success_ ? new DictionaryValue() : NULL) { |
110 } | 110 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 dictionary_(success_ ? new DictionaryValue() : NULL) { | 157 dictionary_(success_ ? new DictionaryValue() : NULL) { |
158 } | 158 } |
159 | 159 |
160 void ParsedDataPresenter::Abort() { | 160 void ParsedDataPresenter::Abort() { |
161 success_ = false; | 161 success_ = false; |
162 dictionary_.reset(); | 162 dictionary_.reset(); |
163 parser_.reset(); | 163 parser_.reset(); |
164 } | 164 } |
165 | 165 |
166 } // namespace extensions | 166 } // namespace extensions |
OLD | NEW |