Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Side by Side Diff: content/renderer/renderer_clipboard_client.h

Issue 574273002: Rewrite clipboard write IPC handling to be easier to understand. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a small bug Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_RENDERER_CLIPBOARD_CLIENT_H_ 5 #ifndef CONTENT_RENDERER_RENDERER_CLIPBOARD_CLIENT_H_
6 #define CONTENT_RENDERER_RENDERER_CLIPBOARD_CLIENT_H_ 6 #define CONTENT_RENDERER_RENDERER_CLIPBOARD_CLIENT_H_
7 7
8 #include <stdint.h>
9 #include <map>
10 #include <string>
11 #include <vector>
12
8 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
9 #include "content/renderer/clipboard_client.h" 14 #include "base/strings/string16.h"
15 #include "content/common/clipboard_format.h"
16 #include "ui/base/clipboard/clipboard_types.h"
17
18 class GURL;
19 class SkBitmap;
10 20
11 namespace content { 21 namespace content {
12 22
13 // An implementation of ClipboardClient that gets and sends data over IPC. 23 // Renderer interface to read/write from the clipboard over IPC.
14 class RendererClipboardClient : public ClipboardClient { 24 class RendererClipboardClient {
jamesr 2014/09/22 22:38:41 this isn't a client thingy any more. if anything,
dcheng 2014/09/22 23:06:25 Done.
15 public: 25 public:
16 RendererClipboardClient(); 26 RendererClipboardClient();
17 virtual ~RendererClipboardClient();
18 27
19 virtual ui::Clipboard* GetClipboard() OVERRIDE; 28 uint64 GetSequenceNumber(ui::ClipboardType type);
20 virtual uint64 GetSequenceNumber(ui::ClipboardType type) OVERRIDE; 29 bool IsFormatAvailable(ClipboardFormat format, ui::ClipboardType type);
21 virtual bool IsFormatAvailable(ClipboardFormat format, 30 void Clear(ui::ClipboardType type);
22 ui::ClipboardType type) OVERRIDE; 31 void ReadAvailableTypes(ui::ClipboardType type,
23 virtual void Clear(ui::ClipboardType type) OVERRIDE; 32 std::vector<base::string16>* types,
24 virtual void ReadAvailableTypes(ui::ClipboardType type, 33 bool* contains_filenames);
25 std::vector<base::string16>* types, 34 void ReadText(ui::ClipboardType type, base::string16* result);
26 bool* contains_filenames) OVERRIDE; 35 void ReadHTML(ui::ClipboardType type,
27 virtual void ReadText(ui::ClipboardType type, 36 base::string16* markup,
28 base::string16* result) OVERRIDE; 37 GURL* url,
29 virtual void ReadHTML(ui::ClipboardType type, 38 uint32* fragment_start,
30 base::string16* markup, 39 uint32* fragment_end);
31 GURL* url, 40 void ReadRTF(ui::ClipboardType type, std::string* result);
32 uint32* fragment_start, 41 void ReadImage(ui::ClipboardType type, std::string* data);
33 uint32* fragment_end) OVERRIDE; 42 void ReadCustomData(ui::ClipboardType clipboard_type,
34 virtual void ReadRTF(ui::ClipboardType type, std::string* result) OVERRIDE; 43 const base::string16& type,
35 virtual void ReadImage(ui::ClipboardType type, std::string* data) OVERRIDE; 44 base::string16* data);
36 virtual void ReadCustomData(ui::ClipboardType clipboard_type, 45
37 const base::string16& type, 46 void WriteText(ui::ClipboardType type, const base::string16& text);
38 base::string16* data) OVERRIDE; 47 void WriteHTML(ui::ClipboardType type,
39 virtual WriteContext* CreateWriteContext() OVERRIDE; 48 const base::string16& markup,
49 const GURL& url);
50 void WriteSmartPasteMarker(ui::ClipboardType type);
51 void WriteCustomData(ui::ClipboardType type,
52 const std::map<base::string16, base::string16>& data);
53 void WriteBookmark(ui::ClipboardType type,
54 const GURL& url,
55 const base::string16& title);
56 bool WriteImage(ui::ClipboardType type, const SkBitmap& bitmap);
57 void CommitWrite(ui::ClipboardType type);
40 }; 58 };
41 59
42 } // namespace content 60 } // namespace content
43 61
44 #endif // CONTENT_RENDERER_RENDERER_CLIPBOARD_CLIENT_H_ 62 #endif // CONTENT_RENDERER_RENDERER_CLIPBOARD_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698