Fix nullptr crash in OnEmbed
[chromium-blink-merge.git] / content / common / resource_request_body.cc
blob1de7f9e88653ef6dbd4f7bdc9e758b9b48489b79
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/common/resource_request_body.h"
7 namespace content {
9 ResourceRequestBody::ResourceRequestBody()
10 : identifier_(0) {
13 void ResourceRequestBody::AppendBytes(const char* bytes, int bytes_len) {
14 if (bytes_len > 0) {
15 elements_.push_back(Element());
16 elements_.back().SetToBytes(bytes, bytes_len);
20 void ResourceRequestBody::AppendFileRange(
21 const base::FilePath& file_path,
22 uint64 offset, uint64 length,
23 const base::Time& expected_modification_time) {
24 elements_.push_back(Element());
25 elements_.back().SetToFilePathRange(file_path, offset, length,
26 expected_modification_time);
29 void ResourceRequestBody::AppendBlob(const std::string& uuid) {
30 elements_.push_back(Element());
31 elements_.back().SetToBlob(uuid);
34 void ResourceRequestBody::AppendFileSystemFileRange(
35 const GURL& url, uint64 offset, uint64 length,
36 const base::Time& expected_modification_time) {
37 elements_.push_back(Element());
38 elements_.back().SetToFileSystemUrlRange(url, offset, length,
39 expected_modification_time);
42 ResourceRequestBody::~ResourceRequestBody() {
45 } // namespace content