Home | History | Annotate | Download | only in glue
      1 // Copyright (c) 2011 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 WEBCLIPBOARD_IMPL_H_
      6 #define WEBCLIPBOARD_IMPL_H_
      7 
      8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebClipboard.h"
      9 #include "ui/base/clipboard/clipboard.h"
     10 
     11 #include <string>
     12 
     13 namespace webkit_glue {
     14 
     15 class WebClipboardImpl : public WebKit::WebClipboard {
     16  public:
     17   static std::string URLToMarkup(const WebKit::WebURL& url,
     18       const WebKit::WebString& title);
     19   static std::string URLToImageMarkup(const WebKit::WebURL& url,
     20       const WebKit::WebString& title);
     21 
     22   virtual ~WebClipboardImpl();
     23 
     24   // WebClipboard methods:
     25   virtual bool isFormatAvailable(Format, Buffer);
     26   virtual WebKit::WebString readPlainText(Buffer);
     27   virtual WebKit::WebString readHTML(Buffer, WebKit::WebURL* source_url);
     28   virtual WebKit::WebData readImage(Buffer);
     29   virtual void writeHTML(
     30       const WebKit::WebString& html_text,
     31       const WebKit::WebURL& source_url,
     32       const WebKit::WebString& plain_text,
     33       bool write_smart_paste);
     34   virtual void writePlainText(const WebKit::WebString& plain_text);
     35   virtual void writeURL(
     36       const WebKit::WebURL&,
     37       const WebKit::WebString& title);
     38   virtual void writeImage(
     39       const WebKit::WebImage&,
     40       const WebKit::WebURL& source_url,
     41       const WebKit::WebString& title);
     42   virtual void writeData(
     43       const WebKit::WebString& type,
     44       const WebKit::WebString& data,
     45       const WebKit::WebString& metadata);
     46 
     47   virtual WebKit::WebVector<WebKit::WebString> readAvailableTypes(
     48       Buffer, bool* contains_filenames);
     49   virtual bool readData(Buffer, const WebKit::WebString& type,
     50       WebKit::WebString* data, WebKit::WebString* metadata);
     51   virtual WebKit::WebVector<WebKit::WebString> readFilenames(Buffer);
     52 
     53  private:
     54   bool ConvertBufferType(Buffer, ui::Clipboard::Buffer*);
     55 };
     56 
     57 }  // namespace webkit_glue
     58 
     59 #endif  // WEBCLIPBOARD_IMPL_H_
     60