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.
4
5#ifndef CONTENT_CHILD_WEBBLOBREGISTRY_IMPL_H_
6#define CONTENT_CHILD_WEBBLOBREGISTRY_IMPL_H_
7
8#include <string>
9
10#include "base/memory/ref_counted.h"
11#include "third_party/WebKit/public/platform/WebBlobRegistry.h"
12
13namespace content {
14class ThreadSafeSender;
15
16class WebBlobRegistryImpl : public blink::WebBlobRegistry {
17 public:
18  explicit WebBlobRegistryImpl(ThreadSafeSender* sender);
19  virtual ~WebBlobRegistryImpl();
20
21  virtual void registerBlobData(const blink::WebString& uuid,
22                                const blink::WebBlobData& data);
23  virtual void addBlobDataRef(const blink::WebString& uuid);
24  virtual void removeBlobDataRef(const blink::WebString& uuid);
25  virtual void registerPublicBlobURL(const blink::WebURL&,
26                                     const blink::WebString& uuid);
27  virtual void revokePublicBlobURL(const blink::WebURL&);
28
29  // Additional support for Streams.
30  virtual void registerStreamURL(const blink::WebURL& url,
31                                 const blink::WebString& content_type);
32  virtual void registerStreamURL(const blink::WebURL& url,
33                                 const blink::WebURL& src_url);
34  virtual void addDataToStream(const blink::WebURL& url,
35                               blink::WebThreadSafeData& data);
36  virtual void finalizeStream(const blink::WebURL& url);
37  virtual void abortStream(const blink::WebURL& url);
38  virtual void unregisterStreamURL(const blink::WebURL& url);
39
40 private:
41  void SendDataForBlob(const std::string& uuid_str,
42                       const blink::WebThreadSafeData& data);
43
44  scoped_refptr<ThreadSafeSender> sender_;
45};
46
47}  // namespace content
48
49#endif  // CONTENT_CHILD_FILEAPI_WEBBLOBREGISTRY_IMPL_H_
50