Rename CoalescedPermissionMessage to PermissionMessage
[chromium-blink-merge.git] / content / child / webblobregistry_impl.h
blob4c5dc942860dc73824eb1d67dd0810e1779f202e
1 // Copyright 2013 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 #ifndef CONTENT_CHILD_WEBBLOBREGISTRY_IMPL_H_
6 #define CONTENT_CHILD_WEBBLOBREGISTRY_IMPL_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/ref_counted.h"
12 #include "content/child/blob_storage/blob_consolidation.h"
13 #include "storage/common/data_element.h"
14 #include "third_party/WebKit/public/platform/WebBlobRegistry.h"
16 namespace blink {
17 class WebThreadSafeData;
18 } // namespace blink
20 namespace storage {
21 class DataElement;
24 namespace content {
25 class ThreadSafeSender;
27 class WebBlobRegistryImpl : public blink::WebBlobRegistry {
28 public:
29 explicit WebBlobRegistryImpl(ThreadSafeSender* sender);
30 virtual ~WebBlobRegistryImpl();
32 // TODO(dmurph): remove this after moving to createBuilder. crbug.com/504583
33 virtual void registerBlobData(const blink::WebString& uuid,
34 const blink::WebBlobData& data);
36 virtual blink::WebBlobRegistry::Builder* createBuilder(
37 const blink::WebString& uuid,
38 const blink::WebString& content_type);
40 virtual void addBlobDataRef(const blink::WebString& uuid);
41 virtual void removeBlobDataRef(const blink::WebString& uuid);
42 virtual void registerPublicBlobURL(const blink::WebURL&,
43 const blink::WebString& uuid);
44 virtual void revokePublicBlobURL(const blink::WebURL&);
46 // Additional support for Streams.
47 virtual void registerStreamURL(const blink::WebURL& url,
48 const blink::WebString& content_type);
49 virtual void registerStreamURL(const blink::WebURL& url,
50 const blink::WebURL& src_url);
51 virtual void addDataToStream(const blink::WebURL& url,
52 const char* data, size_t length);
53 virtual void flushStream(const blink::WebURL& url);
54 virtual void finalizeStream(const blink::WebURL& url);
55 virtual void abortStream(const blink::WebURL& url);
56 virtual void unregisterStreamURL(const blink::WebURL& url);
58 private:
59 // Handles all of the IPCs sent for building a blob.
60 class BuilderImpl : public blink::WebBlobRegistry::Builder {
61 public:
62 BuilderImpl(const blink::WebString& uuid,
63 const blink::WebString& contentType,
64 ThreadSafeSender* sender);
65 virtual ~BuilderImpl();
67 virtual void appendData(const blink::WebThreadSafeData&);
68 virtual void appendFile(const blink::WebString& path,
69 uint64_t offset,
70 uint64_t length,
71 double expected_modification_time);
72 virtual void appendBlob(const blink::WebString& uuid,
73 uint64_t offset,
74 uint64_t length) override;
75 virtual void appendFileSystemURL(const blink::WebURL&,
76 uint64_t offset,
77 uint64_t length,
78 double expected_modification_time);
80 void build() override;
82 private:
83 // Sends data that is larger than the threshold.
84 void SendOversizedDataForBlob(size_t consolidated_item_index);
86 const std::string uuid_;
87 const std::string content_type_;
88 BlobConsolidation consolidation_;
89 scoped_refptr<ThreadSafeSender> sender_;
92 scoped_refptr<ThreadSafeSender> sender_;
95 } // namespace content
97 #endif // CONTENT_CHILD_WEBBLOBREGISTRY_IMPL_H_