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

Side by Side Diff: ui/base/clipboard/clipboard_aura.cc

Issue 8165016: Simple clipboard support for aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | views/controls/textfield/native_textfield_views_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 #include "ui/base/clipboard/clipboard.h" 5 #include "ui/base/clipboard/clipboard.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
9 10
10 namespace ui { 11 namespace ui {
11 12
12 namespace { 13 namespace {
13 const char kMimeTypeBitmap[] = "image/bmp"; 14 const char kMimeTypeBitmap[] = "image/bmp";
14 const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste"; 15 const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste";
16
17 // A mimimum clipboard implementation for simple text cut&paste.
18 class ClipboardData {
19 public:
20 ClipboardData() {}
21 virtual ~ClipboardData() {}
22
23 const std::string& text() const { return utf8_text_; }
24
25 void set_text(const std::string& text) {
26 utf8_text_ = text;
27 }
28
29 private:
30 std::string utf8_text_;
31
32 DISALLOW_COPY_AND_ASSIGN(ClipboardData);
33 };
34
35 ClipboardData* data = NULL;
36
37 ClipboardData* GetClipboardData() {
38 if (!data)
39 data = new ClipboardData();
40 return data;
15 } 41 }
16 42
43 } // namespace
44
17 Clipboard::Clipboard() { 45 Clipboard::Clipboard() {
18 NOTIMPLEMENTED(); 46 NOTIMPLEMENTED();
19 } 47 }
20 48
21 Clipboard::~Clipboard() { 49 Clipboard::~Clipboard() {
22 } 50 }
23 51
24 void Clipboard::WriteObjects(const ObjectMap& objects) { 52 void Clipboard::WriteObjects(const ObjectMap& objects) {
53 for (ObjectMap::const_iterator iter = objects.begin();
54 iter != objects.end(); ++iter) {
55 DispatchObject(static_cast<ObjectType>(iter->first), iter->second);
56 }
25 NOTIMPLEMENTED(); 57 NOTIMPLEMENTED();
sadrul 2011/10/06 19:53:59 Can this be removed now? Or are there more things
oshima 2011/10/06 20:01:05 removed.
26 } 58 }
27 59
28 60
29 void Clipboard::WriteObjects(const ObjectMap& objects, 61 void Clipboard::WriteObjects(const ObjectMap& objects,
30 base::ProcessHandle process) { 62 base::ProcessHandle process) {
31 NOTIMPLEMENTED(); 63 NOTIMPLEMENTED();
32 } 64 }
33 65
34 void Clipboard::DidWriteURL(const std::string& utf8_text) { 66 void Clipboard::DidWriteURL(const std::string& utf8_text) {
35 NOTIMPLEMENTED(); 67 NOTIMPLEMENTED();
(...skipping 10 matching lines...) Expand all
46 NOTIMPLEMENTED(); 78 NOTIMPLEMENTED();
47 return false; 79 return false;
48 } 80 }
49 81
50 void Clipboard::ReadAvailableTypes(Buffer buffer, std::vector<string16>* types, 82 void Clipboard::ReadAvailableTypes(Buffer buffer, std::vector<string16>* types,
51 bool* contains_filenames) const { 83 bool* contains_filenames) const {
52 NOTIMPLEMENTED(); 84 NOTIMPLEMENTED();
53 } 85 }
54 86
55 void Clipboard::ReadText(Buffer buffer, string16* result) const { 87 void Clipboard::ReadText(Buffer buffer, string16* result) const {
56 NOTIMPLEMENTED(); 88 *result = UTF8ToUTF16(GetClipboardData()->text());
57 } 89 }
58 90
59 void Clipboard::ReadAsciiText(Buffer buffer, std::string* result) const { 91 void Clipboard::ReadAsciiText(Buffer buffer, std::string* result) const {
60 NOTIMPLEMENTED(); 92 *result = GetClipboardData()->text();
61 } 93 }
62 94
63 void Clipboard::ReadHTML(Buffer buffer, string16* markup, 95 void Clipboard::ReadHTML(Buffer buffer, string16* markup,
64 std::string* src_url) const { 96 std::string* src_url) const {
65 NOTIMPLEMENTED(); 97 NOTIMPLEMENTED();
66 } 98 }
67 99
68 SkBitmap Clipboard::ReadImage(Buffer buffer) const { 100 SkBitmap Clipboard::ReadImage(Buffer buffer) const {
69 NOTIMPLEMENTED(); 101 NOTIMPLEMENTED();
70 return SkBitmap(); 102 return SkBitmap();
(...skipping 14 matching lines...) Expand all
85 void Clipboard::ReadData(const std::string& format, std::string* result) { 117 void Clipboard::ReadData(const std::string& format, std::string* result) {
86 NOTIMPLEMENTED(); 118 NOTIMPLEMENTED();
87 } 119 }
88 120
89 uint64 Clipboard::GetSequenceNumber() { 121 uint64 Clipboard::GetSequenceNumber() {
90 NOTIMPLEMENTED(); 122 NOTIMPLEMENTED();
91 return 0; 123 return 0;
92 } 124 }
93 125
94 void Clipboard::WriteText(const char* text_data, size_t text_len) { 126 void Clipboard::WriteText(const char* text_data, size_t text_len) {
95 NOTIMPLEMENTED(); 127 GetClipboardData()->set_text(std::string(text_data, text_len));
96 } 128 }
97 129
98 void Clipboard::WriteHTML(const char* markup_data, 130 void Clipboard::WriteHTML(const char* markup_data,
99 size_t markup_len, 131 size_t markup_len,
100 const char* url_data, 132 const char* url_data,
101 size_t url_len) { 133 size_t url_len) {
102 NOTIMPLEMENTED(); 134 NOTIMPLEMENTED();
103 } 135 }
104 136
105 void Clipboard::WriteBookmark(const char* title_data, 137 void Clipboard::WriteBookmark(const char* title_data,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 Clipboard::FormatType Clipboard::GetBitmapFormatType() { 173 Clipboard::FormatType Clipboard::GetBitmapFormatType() {
142 return std::string(kMimeTypeBitmap); 174 return std::string(kMimeTypeBitmap);
143 } 175 }
144 176
145 // static 177 // static
146 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { 178 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() {
147 return std::string(kMimeTypeWebkitSmartPaste); 179 return std::string(kMimeTypeWebkitSmartPaste);
148 } 180 }
149 181
150 } // namespace ui 182 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | views/controls/textfield/native_textfield_views_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698