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

Side by Side Diff: ui/base/x/selection_utils.cc

Issue 2011833003: Implement ui::ClipboardMus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove static in test by creating forwarding clipboard subclass. Created 4 years, 6 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
« no previous file with comments | « ui/base/x/selection_utils.h ('k') | ui/views/mus/BUILD.gn » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/x/selection_utils.h" 5 #include "ui/base/x/selection_utils.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
11 11
12 #include "base/i18n/icu_string_conversions.h" 12 #include "base/i18n/icu_string_conversions.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "ui/base/clipboard/clipboard.h" 17 #include "ui/base/clipboard/clipboard.h"
18 #include "ui/base/x/x11_util.h" 18 #include "ui/base/x/x11_util.h"
19 #include "ui/gfx/x/x11_atom_cache.h" 19 #include "ui/gfx/x/x11_atom_cache.h"
20 20
21 namespace ui { 21 namespace ui {
22 22
23 const char kMimeTypeMozillaURL[] = "text/x-moz-url";
24 const char kString[] = "STRING"; 23 const char kString[] = "STRING";
25 const char kText[] = "TEXT"; 24 const char kText[] = "TEXT";
26 const char kTextPlain[] = "text/plain"; 25 const char kTextPlain[] = "text/plain";
27 const char kTextPlainUtf8[] = "text/plain;charset=utf-8"; 26 const char kTextPlainUtf8[] = "text/plain;charset=utf-8";
28 const char kUtf8String[] = "UTF8_STRING"; 27 const char kUtf8String[] = "UTF8_STRING";
29 28
30 const char* kSelectionDataAtoms[] = { 29 const char* kSelectionDataAtoms[] = {
31 Clipboard::kMimeTypeHTML, 30 Clipboard::kMimeTypeHTML,
32 kString, 31 kString,
33 kText, 32 kText,
34 kTextPlain, 33 kTextPlain,
35 kTextPlainUtf8, 34 kTextPlainUtf8,
36 kUtf8String, 35 kUtf8String,
37 NULL 36 NULL
38 }; 37 };
39 38
40 std::vector< ::Atom> GetTextAtomsFrom(const X11AtomCache* atom_cache) { 39 std::vector< ::Atom> GetTextAtomsFrom(const X11AtomCache* atom_cache) {
41 std::vector< ::Atom> atoms; 40 std::vector< ::Atom> atoms;
42 atoms.push_back(atom_cache->GetAtom(kUtf8String)); 41 atoms.push_back(atom_cache->GetAtom(kUtf8String));
43 atoms.push_back(atom_cache->GetAtom(kString)); 42 atoms.push_back(atom_cache->GetAtom(kString));
44 atoms.push_back(atom_cache->GetAtom(kText)); 43 atoms.push_back(atom_cache->GetAtom(kText));
45 atoms.push_back(atom_cache->GetAtom(kTextPlain)); 44 atoms.push_back(atom_cache->GetAtom(kTextPlain));
46 atoms.push_back(atom_cache->GetAtom(kTextPlainUtf8)); 45 atoms.push_back(atom_cache->GetAtom(kTextPlainUtf8));
47 return atoms; 46 return atoms;
48 } 47 }
49 48
50 std::vector< ::Atom> GetURLAtomsFrom(const X11AtomCache* atom_cache) { 49 std::vector< ::Atom> GetURLAtomsFrom(const X11AtomCache* atom_cache) {
51 std::vector< ::Atom> atoms; 50 std::vector< ::Atom> atoms;
52 atoms.push_back(atom_cache->GetAtom(Clipboard::kMimeTypeURIList)); 51 atoms.push_back(atom_cache->GetAtom(Clipboard::kMimeTypeURIList));
53 atoms.push_back(atom_cache->GetAtom(kMimeTypeMozillaURL)); 52 atoms.push_back(atom_cache->GetAtom(Clipboard::kMimeTypeMozillaURL));
54 return atoms; 53 return atoms;
55 } 54 }
56 55
57 std::vector< ::Atom> GetURIListAtomsFrom(const X11AtomCache* atom_cache) { 56 std::vector< ::Atom> GetURIListAtomsFrom(const X11AtomCache* atom_cache) {
58 std::vector< ::Atom> atoms; 57 std::vector< ::Atom> atoms;
59 atoms.push_back(atom_cache->GetAtom(Clipboard::kMimeTypeURIList)); 58 atoms.push_back(atom_cache->GetAtom(Clipboard::kMimeTypeURIList));
60 return atoms; 59 return atoms;
61 } 60 }
62 61
63 void GetAtomIntersection(const std::vector< ::Atom>& desired, 62 void GetAtomIntersection(const std::vector< ::Atom>& desired,
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 250
252 void SelectionData::AssignTo(std::string* result) const { 251 void SelectionData::AssignTo(std::string* result) const {
253 *result = RefCountedMemoryToString(memory_); 252 *result = RefCountedMemoryToString(memory_);
254 } 253 }
255 254
256 void SelectionData::AssignTo(base::string16* result) const { 255 void SelectionData::AssignTo(base::string16* result) const {
257 *result = RefCountedMemoryToString16(memory_); 256 *result = RefCountedMemoryToString16(memory_);
258 } 257 }
259 258
260 } // namespace ui 259 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/x/selection_utils.h ('k') | ui/views/mus/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698