Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: webkit/glue/resource_request_body.h

Issue 16831010: Move some classes out of webkit/glue/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move UploadDataStreamBuilder to content/browser Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/resource_loader_bridge.cc ('k') | webkit/glue/resource_request_body.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_
6 #define WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/supports_user_data.h"
13 #include "webkit/base/data_element.h"
14 #include "webkit/glue/webkit_glue_export.h"
15
16 namespace base {
17 class FilePath;
18 class TaskRunner;
19 }
20
21 namespace fileapi {
22 class FileSystemContext;
23 }
24
25 namespace net {
26 class UploadDataStream;
27 }
28
29 namespace webkit_blob {
30 class BlobStorageController;
31 }
32
33 namespace webkit_glue {
34
35 // A struct used to represent upload data. The data field is populated by
36 // WebURLLoader from the data given as WebHTTPBody.
37 class WEBKIT_GLUE_EXPORT ResourceRequestBody
38 : public base::RefCounted<ResourceRequestBody>,
39 public base::SupportsUserData {
40 public:
41 typedef webkit_base::DataElement Element;
42
43 ResourceRequestBody();
44
45 void AppendBytes(const char* bytes, int bytes_len);
46 void AppendFileRange(const base::FilePath& file_path,
47 uint64 offset, uint64 length,
48 const base::Time& expected_modification_time);
49 void AppendBlob(const GURL& blob_url);
50 void AppendFileSystemFileRange(const GURL& url, uint64 offset, uint64 length,
51 const base::Time& expected_modification_time);
52
53 // Creates a new UploadDataStream from this request body. This also resolves
54 // any blob references using given |blob_controller|. |file_system_context| is
55 // used to create FileStreamReader for files with filesystem URLs.
56 // |file_task_runner| is used to perform file operations when the data gets
57 // uploaded.
58 net::UploadDataStream* ResolveElementsAndCreateUploadDataStream(
59 webkit_blob::BlobStorageController* blob_controller,
60 fileapi::FileSystemContext* file_system_context,
61 base::TaskRunner* file_task_runner);
62
63 const std::vector<Element>* elements() const { return &elements_; }
64 std::vector<Element>* elements_mutable() { return &elements_; }
65 void swap_elements(std::vector<Element>* elements) {
66 elements_.swap(*elements);
67 }
68
69 // Identifies a particular upload instance, which is used by the cache to
70 // formulate a cache key. This value should be unique across browser
71 // sessions. A value of 0 is used to indicate an unspecified identifier.
72 void set_identifier(int64 id) { identifier_ = id; }
73 int64 identifier() const { return identifier_; }
74
75 private:
76 friend class base::RefCounted<ResourceRequestBody>;
77 virtual ~ResourceRequestBody();
78
79 // Resolves the |blob_url| using |blob_controller| and appends resolved
80 // items to |resolved_elements|.
81 void ResolveBlobReference(webkit_blob::BlobStorageController* blob_controller,
82 const GURL& blob_url,
83 std::vector<const Element*>* resolved_elements);
84
85 std::vector<Element> elements_;
86 int64 identifier_;
87
88 DISALLOW_COPY_AND_ASSIGN(ResourceRequestBody);
89 };
90
91 } // namespace webkit_glue
92
93 #endif // WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_
OLDNEW
« no previous file with comments | « webkit/glue/resource_loader_bridge.cc ('k') | webkit/glue/resource_request_body.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698