Chromium Code Reviews| 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/ptr_util.h" | |
| 8 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 12 #include "net/base/filename_util.h" | 13 #include "net/base/filename_util.h" |
| 13 #include "ui/base/clipboard/clipboard.h" | 14 #include "ui/base/clipboard/clipboard.h" |
| 14 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 15 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 15 #include "ui/base/dragdrop/file_info.h" | 16 #include "ui/base/dragdrop/file_info.h" |
| 16 #include "ui/base/x/selection_utils.h" | 17 #include "ui/base/x/selection_utils.h" |
| 17 #include "ui/base/x/x11_util.h" | 18 #include "ui/base/x/x11_util.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 } | 103 } |
| 103 | 104 |
| 104 SelectionFormatMap OSExchangeDataProviderAuraX11::GetFormatMap() const { | 105 SelectionFormatMap OSExchangeDataProviderAuraX11::GetFormatMap() const { |
| 105 // We return the |selection_owner_|'s format map instead of our own in case | 106 // We return the |selection_owner_|'s format map instead of our own in case |
| 106 // ours has been modified since TakeOwnershipOfSelection() was called. | 107 // ours has been modified since TakeOwnershipOfSelection() was called. |
| 107 return selection_owner_.selection_format_map(); | 108 return selection_owner_.selection_format_map(); |
| 108 } | 109 } |
| 109 | 110 |
| 110 std::unique_ptr<OSExchangeData::Provider> | 111 std::unique_ptr<OSExchangeData::Provider> |
| 111 OSExchangeDataProviderAuraX11::Clone() const { | 112 OSExchangeDataProviderAuraX11::Clone() const { |
| 112 std::unique_ptr<OSExchangeDataProviderAuraX11> ret( | 113 OSExchangeDataProviderAuraX11* ret = new OSExchangeDataProviderAuraX11(); |
| 113 new OSExchangeDataProviderAuraX11()); | |
| 114 ret->format_map_ = format_map_; | 114 ret->format_map_ = format_map_; |
| 115 return ret; | 115 |
|
dcheng
2016/07/27 17:05:44
Please keep the original code and just use std::mo
Mostyn Bramley-Moore
2016/07/27 17:34:11
Done.
| |
| 116 return base::WrapUnique<OSExchangeData::Provider>(ret); | |
| 116 } | 117 } |
| 117 | 118 |
| 118 void OSExchangeDataProviderAuraX11::MarkOriginatedFromRenderer() { | 119 void OSExchangeDataProviderAuraX11::MarkOriginatedFromRenderer() { |
| 119 std::string empty; | 120 std::string empty; |
| 120 format_map_.Insert(atom_cache_.GetAtom(kRendererTaint), | 121 format_map_.Insert(atom_cache_.GetAtom(kRendererTaint), |
| 121 scoped_refptr<base::RefCountedMemory>( | 122 scoped_refptr<base::RefCountedMemory>( |
| 122 base::RefCountedString::TakeString(&empty))); | 123 base::RefCountedString::TakeString(&empty))); |
| 123 } | 124 } |
| 124 | 125 |
| 125 bool OSExchangeDataProviderAuraX11::DidOriginateFromRenderer() const { | 126 bool OSExchangeDataProviderAuraX11::DidOriginateFromRenderer() const { |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 } | 540 } |
| 540 | 541 |
| 541 return false; | 542 return false; |
| 542 } | 543 } |
| 543 | 544 |
| 544 std::vector< ::Atom> OSExchangeDataProviderAuraX11::GetTargets() const { | 545 std::vector< ::Atom> OSExchangeDataProviderAuraX11::GetTargets() const { |
| 545 return format_map_.GetTypes(); | 546 return format_map_.GetTypes(); |
| 546 } | 547 } |
| 547 | 548 |
| 548 } // namespace ui | 549 } // namespace ui |
| OLD | NEW |