Home | History | Annotate | Download | only in browser
      1 // Copyright (c) 2010 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 CHROME_BROWSER_CLIPBOARD_DISPATCHER_H_
      6 #define CHROME_BROWSER_CLIPBOARD_DISPATCHER_H_
      7 #pragma once
      8 
      9 #include <vector>
     10 
     11 #include "base/basictypes.h"
     12 #include "base/string16.h"
     13 #include "ui/base/clipboard/clipboard.h"
     14 
     15 // This class backs IPC requests from the renderer for clipboard data. In this
     16 // context, clipboard does not only refer to the usual concept of a clipboard
     17 // for copy/paste, which is why it's not in app/clipboard/clipboard.h. It can
     18 // refer to one of three different types of clipboards:
     19 // - The copy/paste clipboard, which contains data that has been copied/cut.
     20 // - The dragging clipboard, which contains data that is currently being
     21 //   dragged.
     22 // - On X, the selection clipboard, which contains data for the current
     23 //   selection.
     24 class ClipboardDispatcher {
     25  public:
     26   static bool ReadAvailableTypes(ui::Clipboard::Buffer buffer,
     27                                  std::vector<string16>* types,
     28                                  bool* contains_filenames);
     29   static bool ReadData(ui::Clipboard::Buffer buffer, const string16& type,
     30                        string16* data, string16* metadata);
     31   static bool ReadFilenames(ui::Clipboard::Buffer buffer,
     32                             std::vector<string16>* filenames);
     33 
     34  private:
     35   // This class is not meant to be instantiated. All public members are static.
     36   ClipboardDispatcher();
     37 
     38   DISALLOW_COPY_AND_ASSIGN(ClipboardDispatcher);
     39 };
     40 
     41 #endif  // CHROME_BROWSER_CLIPBOARD_DISPATCHER_H_
     42