| 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_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 scoped_refptr<base::RefCountedMemory>( | 120 scoped_refptr<base::RefCountedMemory>( |
| 121 base::RefCountedString::TakeString(&empty))); | 121 base::RefCountedString::TakeString(&empty))); |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool OSExchangeDataProviderAuraX11::DidOriginateFromRenderer() const { | 124 bool OSExchangeDataProviderAuraX11::DidOriginateFromRenderer() const { |
| 125 return format_map_.find(atom_cache_.GetAtom(kRendererTaint)) != | 125 return format_map_.find(atom_cache_.GetAtom(kRendererTaint)) != |
| 126 format_map_.end(); | 126 format_map_.end(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void OSExchangeDataProviderAuraX11::SetString(const base::string16& text_data) { | 129 void OSExchangeDataProviderAuraX11::SetString(const base::string16& text_data) { |
| 130 if (HasString()) |
| 131 return; |
| 132 |
| 130 std::string utf8 = base::UTF16ToUTF8(text_data); | 133 std::string utf8 = base::UTF16ToUTF8(text_data); |
| 131 scoped_refptr<base::RefCountedMemory> mem( | 134 scoped_refptr<base::RefCountedMemory> mem( |
| 132 base::RefCountedString::TakeString(&utf8)); | 135 base::RefCountedString::TakeString(&utf8)); |
| 133 | 136 |
| 134 format_map_.Insert(atom_cache_.GetAtom(Clipboard::kMimeTypeText), mem); | 137 format_map_.Insert(atom_cache_.GetAtom(Clipboard::kMimeTypeText), mem); |
| 135 format_map_.Insert(atom_cache_.GetAtom(kText), mem); | 138 format_map_.Insert(atom_cache_.GetAtom(kText), mem); |
| 136 format_map_.Insert(atom_cache_.GetAtom(kString), mem); | 139 format_map_.Insert(atom_cache_.GetAtom(kString), mem); |
| 137 format_map_.Insert(atom_cache_.GetAtom(kUtf8String), mem); | 140 format_map_.Insert(atom_cache_.GetAtom(kUtf8String), mem); |
| 138 } | 141 } |
| 139 | 142 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 544 |
| 542 /////////////////////////////////////////////////////////////////////////////// | 545 /////////////////////////////////////////////////////////////////////////////// |
| 543 // OSExchangeData, public: | 546 // OSExchangeData, public: |
| 544 | 547 |
| 545 // static | 548 // static |
| 546 OSExchangeData::Provider* OSExchangeData::CreateProvider() { | 549 OSExchangeData::Provider* OSExchangeData::CreateProvider() { |
| 547 return new OSExchangeDataProviderAuraX11(); | 550 return new OSExchangeDataProviderAuraX11(); |
| 548 } | 551 } |
| 549 | 552 |
| 550 } // namespace ui | 553 } // namespace ui |
| OLD | NEW |