Service Worker: Release controllees upon activation failure.
[chromium-blink-merge.git] / content / browser / renderer_host / clipboard_message_filter.h
blobf563ed514323e8bc680bc70550ad3f5c89e0276c
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 CONTENT_BROWSER_RENDERER_HOST_CLIPBOARD_MESSAGE_FILTER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_CLIPBOARD_MESSAGE_FILTER_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/memory/shared_memory.h"
13 #include "content/common/clipboard_format.h"
14 #include "content/common/content_export.h"
15 #include "content/public/browser/browser_message_filter.h"
16 #include "ui/base/clipboard/clipboard.h"
18 class GURL;
20 namespace ui {
21 class ScopedClipboardWriter;
22 } // namespace ui
24 namespace content {
26 class ClipboardMessageFilterTest;
28 class CONTENT_EXPORT ClipboardMessageFilter : public BrowserMessageFilter {
29 public:
30 ClipboardMessageFilter();
32 void OverrideThreadForMessage(const IPC::Message& message,
33 BrowserThread::ID* thread) override;
34 bool OnMessageReceived(const IPC::Message& message) override;
36 private:
37 friend class ClipboardMessageFilterTest;
39 ~ClipboardMessageFilter() override;
41 void OnGetSequenceNumber(const ui::ClipboardType type,
42 uint64* sequence_number);
43 void OnIsFormatAvailable(ClipboardFormat format,
44 ui::ClipboardType type,
45 bool* result);
46 void OnClear(ui::ClipboardType type);
47 void OnReadAvailableTypes(ui::ClipboardType type,
48 std::vector<base::string16>* types,
49 bool* contains_filenames);
50 void OnReadText(ui::ClipboardType type, base::string16* result);
51 void OnReadHTML(ui::ClipboardType type,
52 base::string16* markup,
53 GURL* url,
54 uint32* fragment_start,
55 uint32* fragment_end);
56 void OnReadRTF(ui::ClipboardType type, std::string* result);
57 void OnReadImage(ui::ClipboardType type, IPC::Message* reply_msg);
58 void OnReadImageReply(const SkBitmap& bitmap, IPC::Message* reply_msg);
59 void OnReadCustomData(ui::ClipboardType clipboard_type,
60 const base::string16& type,
61 base::string16* result);
62 void OnReadData(const ui::Clipboard::FormatType& format,
63 std::string* data);
65 void OnWriteText(ui::ClipboardType clipboard_type,
66 const base::string16& text);
67 void OnWriteHTML(ui::ClipboardType clipboard_type,
68 const base::string16& markup,
69 const GURL& url);
70 void OnWriteSmartPasteMarker(ui::ClipboardType clipboard_type);
71 void OnWriteCustomData(ui::ClipboardType clipboard_type,
72 const std::map<base::string16, base::string16>& data);
73 void OnWriteBookmark(ui::ClipboardType clipboard_type,
74 const std::string& url,
75 const base::string16& title);
76 void OnWriteImage(ui::ClipboardType clipboard_type,
77 const gfx::Size& size,
78 base::SharedMemoryHandle handle);
79 void OnCommitWrite(ui::ClipboardType clipboard_type);
81 #if defined(OS_MACOSX)
82 void OnFindPboardWriteString(const base::string16& text);
83 #endif
85 // We have our own clipboard because we want to access the clipboard on the
86 // IO thread instead of forwarding (possibly synchronous) messages to the UI
87 // thread. This instance of the clipboard should be accessed only on the IO
88 // thread.
89 static ui::Clipboard* GetClipboard();
91 scoped_ptr<ui::ScopedClipboardWriter> clipboard_writer_;
93 DISALLOW_COPY_AND_ASSIGN(ClipboardMessageFilter);
96 } // namespace content
98 #endif // CONTENT_BROWSER_RENDERER_HOST_CLIPBOARD_MESSAGE_FILTER_H_