summaryrefslogtreecommitdiffstats
path: root/components/html_viewer/web_clipboard_impl.h
blob: 407ef816a54f93e3eb39f99ce411676e34a3cf8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_HTML_VIEWER_WEB_CLIPBOARD_IMPL_H_
#define COMPONENTS_HTML_VIEWER_WEB_CLIPBOARD_IMPL_H_

#include "components/clipboard/public/interfaces/clipboard.mojom.h"
#include "third_party/WebKit/public/platform/WebClipboard.h"

namespace html_viewer {

class WebClipboardImpl : public blink::WebClipboard {
 public:
  WebClipboardImpl(mojo::ClipboardPtr clipboard);
  virtual ~WebClipboardImpl();

  // blink::WebClipboard methods:
  virtual uint64_t sequenceNumber(Buffer);
  virtual bool isFormatAvailable(Format, Buffer);
  virtual blink::WebVector<blink::WebString> readAvailableTypes(
      Buffer buffer,
      bool* contains_filenames);
  virtual blink::WebString readPlainText(Buffer buffer);
  virtual blink::WebString readHTML(Buffer buffer,
                                    blink::WebURL* page_url,
                                    unsigned* fragment_start,
                                    unsigned* fragment_end);
  // TODO(erg): readImage()
  virtual blink::WebString readCustomData(Buffer buffer,
                                          const blink::WebString& type);
  virtual void writePlainText(const blink::WebString& plain_text);
  virtual void writeHTML(const blink::WebString& html_text,
                         const blink::WebURL& source_url,
                         const blink::WebString& plain_text,
                         bool write_smart_paste);

 private:
  // Changes webkit buffers to mojo Clipboard::Types.
  mojo::Clipboard::Type ConvertBufferType(Buffer buffer);

  mojo::ClipboardPtr clipboard_;

  DISALLOW_COPY_AND_ASSIGN(WebClipboardImpl);
};

}  // namespace html_viewer

#endif  // COMPONENTS_HTML_VIEWER_WEB_CLIPBOARD_IMPL_H_