OLD | NEW |
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/dragdrop/os_exchange_data_provider_aurax11.h" | 5 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 std::vector<Atom>* targets) const { | 100 std::vector<Atom>* targets) const { |
101 selection_owner_.RetrieveTargets(targets); | 101 selection_owner_.RetrieveTargets(targets); |
102 } | 102 } |
103 | 103 |
104 SelectionFormatMap OSExchangeDataProviderAuraX11::GetFormatMap() const { | 104 SelectionFormatMap OSExchangeDataProviderAuraX11::GetFormatMap() const { |
105 // We return the |selection_owner_|'s format map instead of our own in case | 105 // We return the |selection_owner_|'s format map instead of our own in case |
106 // ours has been modified since TakeOwnershipOfSelection() was called. | 106 // ours has been modified since TakeOwnershipOfSelection() was called. |
107 return selection_owner_.selection_format_map(); | 107 return selection_owner_.selection_format_map(); |
108 } | 108 } |
109 | 109 |
110 OSExchangeData::Provider* OSExchangeDataProviderAuraX11::Clone() const { | 110 std::unique_ptr<OSExchangeData::Provider> |
111 OSExchangeDataProviderAuraX11* ret = new OSExchangeDataProviderAuraX11(); | 111 OSExchangeDataProviderAuraX11::Clone() const { |
| 112 std::unique_ptr<OSExchangeDataProviderAuraX11> ret( |
| 113 new OSExchangeDataProviderAuraX11()); |
112 ret->format_map_ = format_map_; | 114 ret->format_map_ = format_map_; |
113 return ret; | 115 return ret; |
114 } | 116 } |
115 | 117 |
116 void OSExchangeDataProviderAuraX11::MarkOriginatedFromRenderer() { | 118 void OSExchangeDataProviderAuraX11::MarkOriginatedFromRenderer() { |
117 std::string empty; | 119 std::string empty; |
118 format_map_.Insert(atom_cache_.GetAtom(kRendererTaint), | 120 format_map_.Insert(atom_cache_.GetAtom(kRendererTaint), |
119 scoped_refptr<base::RefCountedMemory>( | 121 scoped_refptr<base::RefCountedMemory>( |
120 base::RefCountedString::TakeString(&empty))); | 122 base::RefCountedString::TakeString(&empty))); |
121 } | 123 } |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 538 } |
537 } | 539 } |
538 | 540 |
539 return false; | 541 return false; |
540 } | 542 } |
541 | 543 |
542 std::vector< ::Atom> OSExchangeDataProviderAuraX11::GetTargets() const { | 544 std::vector< ::Atom> OSExchangeDataProviderAuraX11::GetTargets() const { |
543 return format_map_.GetTypes(); | 545 return format_map_.GetTypes(); |
544 } | 546 } |
545 | 547 |
546 /////////////////////////////////////////////////////////////////////////////// | |
547 // OSExchangeData, public: | |
548 | |
549 // static | |
550 OSExchangeData::Provider* OSExchangeData::CreateProvider() { | |
551 return new OSExchangeDataProviderAuraX11(); | |
552 } | |
553 | |
554 } // namespace ui | 548 } // namespace ui |
OLD | NEW |