summaryrefslogtreecommitdiffstats
path: root/ui/base/x
diff options
context:
space:
mode:
Diffstat (limited to 'ui/base/x')
-rw-r--r--ui/base/x/selection_utils.cc21
-rw-r--r--ui/base/x/selection_utils.h6
2 files changed, 12 insertions, 15 deletions
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|.