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

Side by Side Diff: webkit/blob/blob_data.cc

Issue 3108042: Support sending BlobData to browser process. Also support sending UploadData... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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/blob/blob_data.h ('k') | webkit/blob/blob_storage_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 #include "webkit/blob/blob_data.h"
6
7 #include "base/logging.h"
8 #include "base/time.h"
9 #include "third_party/WebKit/WebKit/chromium/public/WebBlobData.h"
10 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h"
11 #include "third_party/WebKit/WebKit/chromium/public/WebData.h"
12 #include "webkit/glue/webkit_glue.h"
13
14 using WebKit::WebBlobData;
15 using WebKit::WebData;
16 using WebKit::WebString;
17
18 namespace {
19
20 // Time::FromDoubleT() does not return empty Time object when dt is 0.
21 // We have to work around this problem here.
22 base::Time DoubleTToTime(double dt) {
23 return dt ? base::Time::FromDoubleT(dt) : base::Time();
24 }
25
26 }
27
28 namespace webkit_blob {
29
30 BlobData::BlobData(const WebBlobData& data) {
31 size_t i = 0;
32 WebBlobData::Item item;
33 while (data.itemAt(i++, item)) {
34 switch (item.type) {
35 case WebBlobData::Item::TypeData:
36 if (!item.data.isEmpty())
37 AppendData(item.data);
38 break;
39 case WebBlobData::Item::TypeFile:
40 AppendFile(
41 webkit_glue::WebStringToFilePath(item.filePath),
42 static_cast<uint64>(item.offset),
43 static_cast<uint64>(item.length),
44 DoubleTToTime(item.expectedModificationTime));
45 break;
46 case WebBlobData::Item::TypeBlob:
47 if (item.length) {
48 AppendBlob(
49 item.blobURL,
50 static_cast<uint64>(item.offset),
51 static_cast<uint64>(item.length));
52 }
53 break;
54 default:
55 NOTREACHED();
56 }
57 }
58 content_type_= data.contentType().utf8().data();
59 content_disposition_ = data.contentDisposition().utf8().data();
60 }
61
62 } // namespace webkit_blob
OLDNEW
« no previous file with comments | « webkit/blob/blob_data.h ('k') | webkit/blob/blob_storage_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698