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

Side by Side Diff: ui/base/clipboard/clipboard_aurax11.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/clipboard/clipboard_aura.cc ('k') | ui/base/clipboard/clipboard_constants.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) 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 #include "ui/base/clipboard/clipboard_aurax11.h" 5 #include "ui/base/clipboard/clipboard_aurax11.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/extensions/Xfixes.h> 8 #include <X11/extensions/Xfixes.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 23 matching lines...) Expand all
34 #include "ui/gfx/geometry/size.h" 34 #include "ui/gfx/geometry/size.h"
35 #include "ui/gfx/x/x11_atom_cache.h" 35 #include "ui/gfx/x/x11_atom_cache.h"
36 36
37 namespace ui { 37 namespace ui {
38 38
39 namespace { 39 namespace {
40 40
41 const char kClipboard[] = "CLIPBOARD"; 41 const char kClipboard[] = "CLIPBOARD";
42 const char kClipboardManager[] = "CLIPBOARD_MANAGER"; 42 const char kClipboardManager[] = "CLIPBOARD_MANAGER";
43 const char kMimeTypeFilename[] = "chromium/filename"; 43 const char kMimeTypeFilename[] = "chromium/filename";
44 const char kMimeTypePepperCustomData[] = "chromium/x-pepper-custom-data";
45 const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste";
46 const char kSaveTargets[] = "SAVE_TARGETS"; 44 const char kSaveTargets[] = "SAVE_TARGETS";
47 const char kTargets[] = "TARGETS"; 45 const char kTargets[] = "TARGETS";
48 46
49 const char* kAtomsToCache[] = { 47 const char* kAtomsToCache[] = {kClipboard,
50 kClipboard, 48 kClipboardManager,
51 kClipboardManager, 49 Clipboard::kMimeTypePNG,
52 Clipboard::kMimeTypePNG, 50 kMimeTypeFilename,
53 kMimeTypeFilename, 51 Clipboard::kMimeTypeMozillaURL,
54 kMimeTypeMozillaURL, 52 Clipboard::kMimeTypeWebkitSmartPaste,
55 kMimeTypeWebkitSmartPaste, 53 kSaveTargets,
56 kSaveTargets, 54 kString,
57 kString, 55 kTargets,
58 kTargets, 56 kText,
59 kText, 57 kUtf8String,
60 kUtf8String, 58 nullptr};
61 NULL
62 };
63 59
64 /////////////////////////////////////////////////////////////////////////////// 60 ///////////////////////////////////////////////////////////////////////////////
65 61
66 // Uses the XFixes API to provide sequence numbers for GetSequenceNumber(). 62 // Uses the XFixes API to provide sequence numbers for GetSequenceNumber().
67 class SelectionChangeObserver : public ui::PlatformEventObserver { 63 class SelectionChangeObserver : public ui::PlatformEventObserver {
68 public: 64 public:
69 static SelectionChangeObserver* GetInstance(); 65 static SelectionChangeObserver* GetInstance();
70 66
71 uint64_t clipboard_sequence_number() const { 67 uint64_t clipboard_sequence_number() const {
72 return clipboard_sequence_number_; 68 return clipboard_sequence_number_;
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeURIList)); 586 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeURIList));
591 return type; 587 return type;
592 } 588 }
593 589
594 // static 590 // static
595 const Clipboard::FormatType& Clipboard::GetUrlWFormatType() { 591 const Clipboard::FormatType& Clipboard::GetUrlWFormatType() {
596 return GetUrlFormatType(); 592 return GetUrlFormatType();
597 } 593 }
598 594
599 // static 595 // static
596 const Clipboard::FormatType& Clipboard::GetMozUrlFormatType() {
597 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeMozillaURL));
598 return type;
599 }
600
601 // static
600 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { 602 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() {
601 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText)); 603 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText));
602 return type; 604 return type;
603 } 605 }
604 606
605 // static 607 // static
606 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() { 608 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() {
607 return GetPlainTextFormatType(); 609 return GetPlainTextFormatType();
608 } 610 }
609 611
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 if (format.Equals(GetBitmapFormatType())) 935 if (format.Equals(GetBitmapFormatType()))
934 return; 936 return;
935 937
936 std::vector<unsigned char> bytes(data_data, data_data + data_len); 938 std::vector<unsigned char> bytes(data_data, data_data + data_len);
937 scoped_refptr<base::RefCountedMemory> mem( 939 scoped_refptr<base::RefCountedMemory> mem(
938 base::RefCountedBytes::TakeVector(&bytes)); 940 base::RefCountedBytes::TakeVector(&bytes));
939 aurax11_details_->InsertMapping(format.ToString(), mem); 941 aurax11_details_->InsertMapping(format.ToString(), mem);
940 } 942 }
941 943
942 } // namespace ui 944 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_aura.cc ('k') | ui/base/clipboard/clipboard_constants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698