| 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/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/string_util.h" | 8 #include "base/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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return success_; | 81 return success_; |
| 82 } | 82 } |
| 83 | 83 |
| 84 scoped_ptr<Value> RawDataPresenter::Result() { | 84 scoped_ptr<Value> RawDataPresenter::Result() { |
| 85 if (!success_) | 85 if (!success_) |
| 86 return scoped_ptr<Value>(); | 86 return scoped_ptr<Value>(); |
| 87 | 87 |
| 88 return list_.PassAs<Value>(); | 88 return list_.PassAs<Value>(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void RawDataPresenter::Abort() { | |
| 92 success_ = false; | |
| 93 list_.reset(); | |
| 94 } | |
| 95 | |
| 96 void RawDataPresenter::FeedNextBytes(const char* bytes, size_t size) { | 91 void RawDataPresenter::FeedNextBytes(const char* bytes, size_t size) { |
| 97 subtle::AppendKeyValuePair(keys::kRequestBodyRawBytesKey, | 92 subtle::AppendKeyValuePair(keys::kRequestBodyRawBytesKey, |
| 98 BinaryValue::CreateWithCopiedBuffer(bytes, size), | 93 BinaryValue::CreateWithCopiedBuffer(bytes, size), |
| 99 list_.get()); | 94 list_.get()); |
| 100 } | 95 } |
| 101 | 96 |
| 102 void RawDataPresenter::FeedNextFile(const std::string& filename) { | 97 void RawDataPresenter::FeedNextFile(const std::string& filename) { |
| 103 // 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. |
| 104 subtle::AppendKeyValuePair(keys::kRequestBodyRawFileKey, | 99 subtle::AppendKeyValuePair(keys::kRequestBodyRawFileKey, |
| 105 Value::CreateStringValue(filename), | 100 Value::CreateStringValue(filename), |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 dictionary_(success_ ? new DictionaryValue() : NULL) { | 157 dictionary_(success_ ? new DictionaryValue() : NULL) { |
| 163 } | 158 } |
| 164 | 159 |
| 165 void ParsedDataPresenter::Abort() { | 160 void ParsedDataPresenter::Abort() { |
| 166 success_ = false; | 161 success_ = false; |
| 167 dictionary_.reset(); | 162 dictionary_.reset(); |
| 168 parser_.reset(); | 163 parser_.reset(); |
| 169 } | 164 } |
| 170 | 165 |
| 171 } // namespace extensions | 166 } // namespace extensions |
| OLD | NEW |