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

Side by Side Diff: content/browser/fileapi/chrome_blob_storage_context.cc

Issue 973993003: Instead of ArrayBuffer, pass blob with printerProvider.onPrintRequested (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase & add ext fun histogram Created 5 years, 9 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
OLDNEW
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 "content/browser/fileapi/chrome_blob_storage_context.h" 5 #include "content/browser/fileapi/chrome_blob_storage_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "content/public/browser/blob_handle.h" 9 #include "content/public/browser/blob_handle.h"
10 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 scoped_ptr<storage::BlobDataHandle> blob_data_handle = 75 scoped_ptr<storage::BlobDataHandle> blob_data_handle =
76 context_->AddFinishedBlob(&blob_data_builder); 76 context_->AddFinishedBlob(&blob_data_builder);
77 if (!blob_data_handle) 77 if (!blob_data_handle)
78 return scoped_ptr<BlobHandle>(); 78 return scoped_ptr<BlobHandle>();
79 79
80 scoped_ptr<BlobHandle> blob_handle( 80 scoped_ptr<BlobHandle> blob_handle(
81 new BlobHandleImpl(blob_data_handle.Pass())); 81 new BlobHandleImpl(blob_data_handle.Pass()));
82 return blob_handle.Pass(); 82 return blob_handle.Pass();
83 } 83 }
84 84
85 scoped_ptr<BlobHandle> ChromeBlobStorageContext::CreateFileBackedBlob(
86 const base::FilePath& path,
87 int64_t offset,
88 int64_t size,
89 const base::Time& expected_modification_time) {
90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
91
92 std::string uuid(base::GenerateGUID());
93 storage::BlobDataBuilder blob_data_builder(uuid);
94 blob_data_builder.AppendFile(path, offset, size, expected_modification_time);
95
96 scoped_ptr<storage::BlobDataHandle> blob_data_handle =
97 context_->AddFinishedBlob(&blob_data_builder);
98 if (!blob_data_handle)
99 return scoped_ptr<BlobHandle>();
100
101 scoped_ptr<BlobHandle> blob_handle(
102 new BlobHandleImpl(blob_data_handle.Pass()));
103 return blob_handle.Pass();
104 }
105
85 ChromeBlobStorageContext::~ChromeBlobStorageContext() {} 106 ChromeBlobStorageContext::~ChromeBlobStorageContext() {}
86 107
87 void ChromeBlobStorageContext::DeleteOnCorrectThread() const { 108 void ChromeBlobStorageContext::DeleteOnCorrectThread() const {
88 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && 109 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) &&
89 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { 110 !BrowserThread::CurrentlyOn(BrowserThread::IO)) {
90 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); 111 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
91 return; 112 return;
92 } 113 }
93 delete this; 114 delete this;
94 } 115 }
95 116
96 } // namespace content 117 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/chrome_blob_storage_context.h ('k') | content/public/browser/browser_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698