Chromium Code Reviews| Index: ui/base/x/selection_owner.cc |
| diff --git a/ui/base/x/selection_owner.cc b/ui/base/x/selection_owner.cc |
| index 37e8663c3bb321139878f1e1082889b5d85b475a..f5bf4217a8c95964728dcffdff5a1209627831d2 100644 |
| --- a/ui/base/x/selection_owner.cc |
| +++ b/ui/base/x/selection_owner.cc |
| @@ -35,6 +35,14 @@ SelectionOwner::SelectionOwner(Display* x_display, |
| } |
| SelectionOwner::~SelectionOwner() { |
| + Clear(); |
| +} |
| + |
| +void SelectionOwner::RetrieveTargets(std::vector<Atom>* targets) { |
|
Daniel Erat
2013/06/17 22:09:57
nit: either clear |targets| first here or document
|
| + for (SelectionFormatMap::const_iterator it = selection_data_->begin(); |
| + it != selection_data_->end(); ++it) { |
| + targets->push_back(it->first); |
| + } |
| } |
| void SelectionOwner::TakeOwnershipOfSelection( |
| @@ -73,10 +81,7 @@ void SelectionOwner::OnSelectionRequest(const XSelectionRequestEvent& event) { |
| // types we support. |
| std::vector<Atom> targets; |
| targets.push_back(targets_atom); |
| - for (SelectionFormatMap::const_iterator it = selection_data_->begin(); |
| - it != selection_data_->end(); ++it) { |
| - targets.push_back(it->first); |
| - } |
| + RetrieveTargets(&targets); |
| XChangeProperty(x_display_, event.requestor, event.property, XA_ATOM, 32, |
| PropModeReplace, |