diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-10 09:57:46 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-10 09:57:46 +0000 |
commit | 52684ff36ea0b4e46d53176a8ac623c5f982a374 (patch) | |
tree | c0e22ec7d5ec446d8781d83c63b68a588c4e555d /ui/base | |
parent | 8ad3c5a758ba0d46bee600f559a7af88d3038ea6 (diff) | |
download | chromium_src-52684ff36ea0b4e46d53176a8ac623c5f982a374.zip chromium_src-52684ff36ea0b4e46d53176a8ac623c5f982a374.tar.gz chromium_src-52684ff36ea0b4e46d53176a8ac623c5f982a374.tar.bz2 |
linux_aura: Fix unicode characters on the clipboard.
This reorders the list of text atoms so that we prefer UTF-8 strings
over Latin-1 strings, and fixes the one place where we had the ordering
backwards.
BUG=295795
Review URL: https://codereview.chromium.org/25671004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227906 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base')
-rw-r--r-- | ui/base/clipboard/clipboard_aurax11.cc | 2 | ||||
-rw-r--r-- | ui/base/x/selection_utils.cc | 21 | ||||
-rw-r--r-- | ui/base/x/selection_utils.h | 6 |
3 files changed, 13 insertions, 16 deletions
diff --git a/ui/base/clipboard/clipboard_aurax11.cc b/ui/base/clipboard/clipboard_aurax11.cc index e8d263e..81f3dcc 100644 --- a/ui/base/clipboard/clipboard_aurax11.cc +++ b/ui/base/clipboard/clipboard_aurax11.cc @@ -404,7 +404,7 @@ SelectionData Clipboard::AuraX11Details::RequestAndWaitForTypes( SelectionRequestor* receiver = GetSelectionRequestorForBuffer(buffer); std::vector< ::Atom> intersection; - ui::GetAtomIntersection(targets.target_list(), types, &intersection); + ui::GetAtomIntersection(types, targets.target_list(), &intersection); return receiver->RequestAndWaitForTypes(intersection); } diff --git a/ui/base/x/selection_utils.cc b/ui/base/x/selection_utils.cc index b4aac34..a3f8494 100644 --- a/ui/base/x/selection_utils.cc +++ b/ui/base/x/selection_utils.cc @@ -30,9 +30,9 @@ const char* kSelectionDataAtoms[] = { std::vector< ::Atom> GetTextAtomsFrom(const X11AtomCache* atom_cache) { std::vector< ::Atom> atoms; + atoms.push_back(atom_cache->GetAtom(kUtf8String)); atoms.push_back(atom_cache->GetAtom(kString)); atoms.push_back(atom_cache->GetAtom(kText)); - atoms.push_back(atom_cache->GetAtom(kUtf8String)); return atoms; } @@ -43,18 +43,15 @@ std::vector< ::Atom> GetURLAtomsFrom(const X11AtomCache* atom_cache) { return atoms; } -void GetAtomIntersection(const std::vector< ::Atom>& one, - const std::vector< ::Atom>& two, +void GetAtomIntersection(const std::vector< ::Atom>& desired, + const std::vector< ::Atom>& offered, std::vector< ::Atom>* output) { - for (std::vector< ::Atom>::const_iterator it = one.begin(); it != one.end(); - ++it) { - for (std::vector< ::Atom>::const_iterator jt = two.begin(); jt != two.end(); - ++jt) { - if (*it == *jt) { - output->push_back(*it); - break; - } - } + for (std::vector< ::Atom>::const_iterator it = desired.begin(); + it != desired.end(); ++it) { + std::vector< ::Atom>::const_iterator jt = + std::find(offered.begin(), offered.end(), *it); + if (jt != offered.end()) + output->push_back(*it); } } diff --git a/ui/base/x/selection_utils.h b/ui/base/x/selection_utils.h index c0d7b80..350f383 100644 --- a/ui/base/x/selection_utils.h +++ b/ui/base/x/selection_utils.h @@ -32,9 +32,9 @@ UI_EXPORT std::vector< ::Atom> GetTextAtomsFrom(const X11AtomCache* atom_cache); UI_EXPORT std::vector< ::Atom> GetURLAtomsFrom(const X11AtomCache* atom_cache); -// Places the intersection of |one| and |two| into |output|. -UI_EXPORT void GetAtomIntersection(const std::vector< ::Atom>& one, - const std::vector< ::Atom>& two, +// Places the intersection of |desired| and |offered| into |output|. +UI_EXPORT void GetAtomIntersection(const std::vector< ::Atom>& desired, + const std::vector< ::Atom>& offered, std::vector< ::Atom>* output); // Takes the raw bytes of the string16 and copies them into |bytes|. |