1// Copyright 2014 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 MOJO_SERVICES_HTML_VIEWER_WEBCLIPBOARD_IMPL_H_
6#define MOJO_SERVICES_HTML_VIEWER_WEBCLIPBOARD_IMPL_H_
7
8#include "mojo/services/public/interfaces/clipboard/clipboard.mojom.h"
9#include "third_party/WebKit/public/platform/WebClipboard.h"
10
11namespace mojo {
12
13class WebClipboardImpl : public blink::WebClipboard {
14 public:
15  WebClipboardImpl(ClipboardPtr clipboard);
16  virtual ~WebClipboardImpl();
17
18  // blink::WebClipboard methods:
19  virtual uint64_t sequenceNumber(Buffer);
20  virtual bool isFormatAvailable(Format, Buffer);
21  virtual blink::WebVector<blink::WebString> readAvailableTypes(
22      Buffer,
23      bool* containsFilenames);
24  virtual blink::WebString readPlainText(Buffer);
25  virtual blink::WebString readHTML(Buffer buffer,
26                                    blink::WebURL* pageURL,
27                                    unsigned* fragmentStart,
28                                    unsigned* fragmentEnd);
29  // TODO(erg): readImage()
30  virtual blink::WebString readCustomData(Buffer, const blink::WebString& type);
31  virtual void writePlainText(const blink::WebString&);
32  virtual void writeHTML(const blink::WebString& htmlText,
33                         const blink::WebURL&,
34                         const blink::WebString& plainText,
35                         bool writeSmartPaste);
36
37 private:
38  // Changes webkit buffers to mojo Clipboard::Types.
39  mojo::Clipboard::Type ConvertBufferType(Buffer buffer);
40
41  ClipboardPtr clipboard_;
42
43  DISALLOW_COPY_AND_ASSIGN(WebClipboardImpl);
44};
45
46}  // namespace mojo
47
48#endif  // MOJO_SERVICES_HTML_VIEWER_WEBCLIPBOARD_IMPL_H_
49