Don't announce clipboard events if the event target is not visible and focused.
[chromium-blink-merge.git] / ppapi / cpp / private / flash_clipboard.h
blob0df6028cf5a35b5f6e1da8d7c972ab834b255346
1 // Copyright (c) 2012 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.
5 #ifndef PPAPI_CPP_PRIVATE_FLASH_CLIPBOARD_H_
6 #define PPAPI_CPP_PRIVATE_FLASH_CLIPBOARD_H_
8 #include <string>
9 #include <vector>
11 #include "ppapi/c/private/ppb_flash_clipboard.h"
12 #include "ppapi/cpp/var.h"
14 namespace pp {
16 class InstanceHandle;
18 namespace flash {
20 class Clipboard {
21 public:
22 // Returns true if the required interface is available.
23 static bool IsAvailable();
25 // Returns a format ID on success or PP_FLASH_CLIPBOARD_FORMAT_INVALID on
26 // failure.
27 static uint32_t RegisterCustomFormat(const InstanceHandle& instance,
28 const std::string& format_name);
30 // Returns true if the given format is available from the given clipboard.
31 static bool IsFormatAvailable(const InstanceHandle& instance,
32 PP_Flash_Clipboard_Type clipboard_type,
33 uint32_t format);
35 // Returns true on success, in which case |out| will be filled with
36 // data read from the given clipboard in the given format.
37 static bool ReadData(const InstanceHandle& instance,
38 PP_Flash_Clipboard_Type clipboard_type,
39 uint32_t clipboard_format,
40 Var* out);
42 // Returns true on success in which case all of |data| will be written to
43 // the clipboard. Otherwise nothing will be written.
44 static bool WriteData(const InstanceHandle& instance,
45 PP_Flash_Clipboard_Type clipboard_type,
46 const std::vector<uint32_t>& formats,
47 const std::vector<Var>& data_items);
49 // Outputs a sequence number that uniquely identifies the clipboard state in
50 // |sequence_number| and returns true if successful.
51 static bool GetSequenceNumber(const InstanceHandle& instance,
52 PP_Flash_Clipboard_Type clipboard_type,
53 uint64_t* sequence_number);
56 } // namespace flash
57 } // namespace pp
59 #endif // PPAPI_CPP_PRIVATE_FLASH_CLIPBOARD_H_