| Index: ui/base/dragdrop/os_exchange_data_provider_aurax11.cc
|
| diff --git a/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc b/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc
|
| index 8123d3811f1623e64dce34b559514c5e5b9e0af7..1a6e9a1c78928cabdf96920d51f8ad071173fd20 100644
|
| --- a/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc
|
| +++ b/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc
|
| @@ -16,8 +16,8 @@
|
| #include "ui/base/clipboard/scoped_clipboard_writer.h"
|
| #include "ui/base/dragdrop/file_info.h"
|
| #include "ui/base/x/selection_utils.h"
|
| -#include "ui/base/x/x11_util.h"
|
| #include "ui/events/platform/platform_event_source.h"
|
| +#include "ui/gfx/x/x11_atom_cache.h"
|
|
|
| // Note: the GetBlah() methods are used immediately by the
|
| // web_contents_view_aura.cc:PrepareDropData(), while the omnibox is a
|
| @@ -43,7 +43,7 @@ OSExchangeDataProviderAuraX11::OSExchangeDataProviderAuraX11(
|
| own_window_(false),
|
| x_window_(x_window),
|
| format_map_(selection),
|
| - selection_owner_(x_display_, x_window_, GetAtom(kDndSelection)) {}
|
| + selection_owner_(x_display_, x_window_, gfx::GetAtom(kDndSelection)) {}
|
|
|
| OSExchangeDataProviderAuraX11::OSExchangeDataProviderAuraX11()
|
| : x_display_(gfx::GetXDisplay()),
|
| @@ -62,7 +62,7 @@ OSExchangeDataProviderAuraX11::OSExchangeDataProviderAuraX11()
|
| 0,
|
| NULL)),
|
| format_map_(),
|
| - selection_owner_(x_display_, x_window_, GetAtom(kDndSelection)) {
|
| + selection_owner_(x_display_, x_window_, gfx::GetAtom(kDndSelection)) {
|
| XStoreName(x_display_, x_window_, "Chromium Drag & Drop Window");
|
|
|
| PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
| @@ -100,13 +100,13 @@ OSExchangeDataProviderAuraX11::Clone() const {
|
|
|
| void OSExchangeDataProviderAuraX11::MarkOriginatedFromRenderer() {
|
| std::string empty;
|
| - format_map_.Insert(GetAtom(kRendererTaint),
|
| + format_map_.Insert(gfx::GetAtom(kRendererTaint),
|
| scoped_refptr<base::RefCountedMemory>(
|
| base::RefCountedString::TakeString(&empty)));
|
| }
|
|
|
| bool OSExchangeDataProviderAuraX11::DidOriginateFromRenderer() const {
|
| - return format_map_.find(GetAtom(kRendererTaint)) != format_map_.end();
|
| + return format_map_.find(gfx::GetAtom(kRendererTaint)) != format_map_.end();
|
| }
|
|
|
| void OSExchangeDataProviderAuraX11::SetString(const base::string16& text_data) {
|
| @@ -117,10 +117,10 @@ void OSExchangeDataProviderAuraX11::SetString(const base::string16& text_data) {
|
| scoped_refptr<base::RefCountedMemory> mem(
|
| base::RefCountedString::TakeString(&utf8));
|
|
|
| - format_map_.Insert(GetAtom(Clipboard::kMimeTypeText), mem);
|
| - format_map_.Insert(GetAtom(kText), mem);
|
| - format_map_.Insert(GetAtom(kString), mem);
|
| - format_map_.Insert(GetAtom(kUtf8String), mem);
|
| + format_map_.Insert(gfx::GetAtom(Clipboard::kMimeTypeText), mem);
|
| + format_map_.Insert(gfx::GetAtom(kText), mem);
|
| + format_map_.Insert(gfx::GetAtom(kString), mem);
|
| + format_map_.Insert(gfx::GetAtom(kUtf8String), mem);
|
| }
|
|
|
| void OSExchangeDataProviderAuraX11::SetURL(const GURL& url,
|
| @@ -138,7 +138,7 @@ void OSExchangeDataProviderAuraX11::SetURL(const GURL& url,
|
| scoped_refptr<base::RefCountedMemory> mem(
|
| base::RefCountedBytes::TakeVector(&data));
|
|
|
| - format_map_.Insert(GetAtom(Clipboard::kMimeTypeMozillaURL), mem);
|
| + format_map_.Insert(gfx::GetAtom(Clipboard::kMimeTypeMozillaURL), mem);
|
|
|
| // Set a string fallback as well.
|
| SetString(spec);
|
| @@ -158,7 +158,7 @@ void OSExchangeDataProviderAuraX11::SetURL(const GURL& url,
|
| std::string netscape_url = url.spec();
|
| netscape_url += "\n";
|
| netscape_url += base::UTF16ToUTF8(title);
|
| - format_map_.Insert(GetAtom(kNetscapeURL),
|
| + format_map_.Insert(gfx::GetAtom(kNetscapeURL),
|
| scoped_refptr<base::RefCountedMemory>(
|
| base::RefCountedString::TakeString(&netscape_url)));
|
| }
|
| @@ -184,7 +184,7 @@ void OSExchangeDataProviderAuraX11::SetFilenames(
|
| std::string joined_data = base::JoinString(paths, "\n");
|
| scoped_refptr<base::RefCountedMemory> mem(
|
| base::RefCountedString::TakeString(&joined_data));
|
| - format_map_.Insert(GetAtom(Clipboard::kMimeTypeURIList), mem);
|
| + format_map_.Insert(gfx::GetAtom(Clipboard::kMimeTypeURIList), mem);
|
| }
|
|
|
| void OSExchangeDataProviderAuraX11::SetPickledData(
|
| @@ -198,7 +198,7 @@ void OSExchangeDataProviderAuraX11::SetPickledData(
|
| scoped_refptr<base::RefCountedMemory> mem(
|
| base::RefCountedBytes::TakeVector(&bytes));
|
|
|
| - format_map_.Insert(GetAtom(format.ToString().c_str()), mem);
|
| + format_map_.Insert(gfx::GetAtom(format.ToString().c_str()), mem);
|
| }
|
|
|
| bool OSExchangeDataProviderAuraX11::GetString(base::string16* result) const {
|
| @@ -211,7 +211,7 @@ bool OSExchangeDataProviderAuraX11::GetString(base::string16* result) const {
|
|
|
| std::vector<::Atom> text_atoms = ui::GetTextAtomsFrom();
|
| std::vector< ::Atom> requested_types;
|
| - ui::GetAtomIntersection(text_atoms, GetTargets(), &requested_types);
|
| + GetAtomIntersection(text_atoms, GetTargets(), &requested_types);
|
|
|
| ui::SelectionData data(format_map_.GetFirstOf(requested_types));
|
| if (data.IsValid()) {
|
| @@ -229,7 +229,7 @@ bool OSExchangeDataProviderAuraX11::GetURLAndTitle(
|
| base::string16* title) const {
|
| std::vector<::Atom> url_atoms = ui::GetURLAtomsFrom();
|
| std::vector< ::Atom> requested_types;
|
| - ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
| + GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
|
|
| ui::SelectionData data(format_map_.GetFirstOf(requested_types));
|
| if (data.IsValid()) {
|
| @@ -237,7 +237,7 @@ bool OSExchangeDataProviderAuraX11::GetURLAndTitle(
|
| // but that doesn't match the assumptions of the rest of the system which
|
| // expect single types.
|
|
|
| - if (data.GetType() == GetAtom(Clipboard::kMimeTypeMozillaURL)) {
|
| + if (data.GetType() == gfx::GetAtom(Clipboard::kMimeTypeMozillaURL)) {
|
| // Mozilla URLs are (UTF16: URL, newline, title).
|
| base::string16 unparsed;
|
| data.AssignTo(&unparsed);
|
| @@ -254,7 +254,7 @@ bool OSExchangeDataProviderAuraX11::GetURLAndTitle(
|
| *url = GURL(tokens[0]);
|
| return true;
|
| }
|
| - } else if (data.GetType() == GetAtom(Clipboard::kMimeTypeURIList)) {
|
| + } else if (data.GetType() == gfx::GetAtom(Clipboard::kMimeTypeURIList)) {
|
| std::vector<std::string> tokens = ui::ParseURIList(data);
|
| for (std::vector<std::string>::const_iterator it = tokens.begin();
|
| it != tokens.end(); ++it) {
|
| @@ -286,7 +286,7 @@ bool OSExchangeDataProviderAuraX11::GetFilenames(
|
| std::vector<FileInfo>* filenames) const {
|
| std::vector<::Atom> url_atoms = ui::GetURIListAtomsFrom();
|
| std::vector< ::Atom> requested_types;
|
| - ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
| + GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
|
|
| filenames->clear();
|
| ui::SelectionData data(format_map_.GetFirstOf(requested_types));
|
| @@ -309,7 +309,7 @@ bool OSExchangeDataProviderAuraX11::GetPickledData(
|
| const Clipboard::FormatType& format,
|
| base::Pickle* pickle) const {
|
| std::vector< ::Atom> requested_types;
|
| - requested_types.push_back(GetAtom(format.ToString().c_str()));
|
| + requested_types.push_back(gfx::GetAtom(format.ToString().c_str()));
|
|
|
| ui::SelectionData data(format_map_.GetFirstOf(requested_types));
|
| if (data.IsValid()) {
|
| @@ -326,7 +326,7 @@ bool OSExchangeDataProviderAuraX11::GetPickledData(
|
| bool OSExchangeDataProviderAuraX11::HasString() const {
|
| std::vector<::Atom> text_atoms = ui::GetTextAtomsFrom();
|
| std::vector< ::Atom> requested_types;
|
| - ui::GetAtomIntersection(text_atoms, GetTargets(), &requested_types);
|
| + GetAtomIntersection(text_atoms, GetTargets(), &requested_types);
|
| return !requested_types.empty() && !HasFile();
|
| }
|
|
|
| @@ -334,7 +334,7 @@ bool OSExchangeDataProviderAuraX11::HasURL(
|
| OSExchangeData::FilenameToURLPolicy policy) const {
|
| std::vector<::Atom> url_atoms = ui::GetURLAtomsFrom();
|
| std::vector< ::Atom> requested_types;
|
| - ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
| + GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
|
|
| if (requested_types.empty())
|
| return false;
|
| @@ -343,10 +343,11 @@ bool OSExchangeDataProviderAuraX11::HasURL(
|
| // Windows does and stuffs all the data into one mime type.
|
| ui::SelectionData data(format_map_.GetFirstOf(requested_types));
|
| if (data.IsValid()) {
|
| - if (data.GetType() == GetAtom(Clipboard::kMimeTypeMozillaURL)) {
|
| + if (data.GetType() == gfx::GetAtom(Clipboard::kMimeTypeMozillaURL)) {
|
| // File managers shouldn't be using this type, so this is a URL.
|
| return true;
|
| - } else if (data.GetType() == GetAtom(ui::Clipboard::kMimeTypeURIList)) {
|
| + } else if (data.GetType() ==
|
| + gfx::GetAtom(ui::Clipboard::kMimeTypeURIList)) {
|
| std::vector<std::string> tokens = ui::ParseURIList(data);
|
| for (std::vector<std::string>::const_iterator it = tokens.begin();
|
| it != tokens.end(); ++it) {
|
| @@ -365,7 +366,7 @@ bool OSExchangeDataProviderAuraX11::HasURL(
|
| bool OSExchangeDataProviderAuraX11::HasFile() const {
|
| std::vector<::Atom> url_atoms = ui::GetURIListAtomsFrom();
|
| std::vector< ::Atom> requested_types;
|
| - ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
| + GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
|
|
| if (requested_types.empty())
|
| return false;
|
| @@ -391,9 +392,9 @@ bool OSExchangeDataProviderAuraX11::HasFile() const {
|
| bool OSExchangeDataProviderAuraX11::HasCustomFormat(
|
| const Clipboard::FormatType& format) const {
|
| std::vector< ::Atom> url_atoms;
|
| - url_atoms.push_back(GetAtom(format.ToString().c_str()));
|
| + url_atoms.push_back(gfx::GetAtom(format.ToString().c_str()));
|
| std::vector< ::Atom> requested_types;
|
| - ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
| + GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
|
|
| return !requested_types.empty();
|
| }
|
| @@ -403,7 +404,7 @@ void OSExchangeDataProviderAuraX11::SetFileContents(
|
| const std::string& file_contents) {
|
| DCHECK(!filename.empty());
|
| DCHECK(format_map_.end() ==
|
| - format_map_.find(GetAtom(Clipboard::kMimeTypeMozillaURL)));
|
| + format_map_.find(gfx::GetAtom(Clipboard::kMimeTypeMozillaURL)));
|
|
|
| file_contents_name_ = filename;
|
|
|
| @@ -423,12 +424,12 @@ void OSExchangeDataProviderAuraX11::SetFileContents(
|
| // things simpler for Chrome, we always 'fail' and let the destination do
|
| // the work.
|
| std::string failure("F");
|
| - format_map_.Insert(GetAtom("XdndDirectSave0"),
|
| + format_map_.Insert(gfx::GetAtom("XdndDirectSave0"),
|
| scoped_refptr<base::RefCountedMemory>(
|
| base::RefCountedString::TakeString(&failure)));
|
| std::string file_contents_copy = file_contents;
|
| format_map_.Insert(
|
| - GetAtom("application/octet-stream"),
|
| + gfx::GetAtom("application/octet-stream"),
|
| scoped_refptr<base::RefCountedMemory>(
|
| base::RefCountedString::TakeString(&file_contents_copy)));
|
| }
|
| @@ -444,15 +445,15 @@ void OSExchangeDataProviderAuraX11::SetHtml(const base::string16& html,
|
| scoped_refptr<base::RefCountedMemory> mem(
|
| base::RefCountedBytes::TakeVector(&bytes));
|
|
|
| - format_map_.Insert(GetAtom(Clipboard::kMimeTypeHTML), mem);
|
| + format_map_.Insert(gfx::GetAtom(Clipboard::kMimeTypeHTML), mem);
|
| }
|
|
|
| bool OSExchangeDataProviderAuraX11::GetHtml(base::string16* html,
|
| GURL* base_url) const {
|
| std::vector< ::Atom> url_atoms;
|
| - url_atoms.push_back(GetAtom(Clipboard::kMimeTypeHTML));
|
| + url_atoms.push_back(gfx::GetAtom(Clipboard::kMimeTypeHTML));
|
| std::vector< ::Atom> requested_types;
|
| - ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
| + GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
|
|
| ui::SelectionData data(format_map_.GetFirstOf(requested_types));
|
| if (data.IsValid()) {
|
| @@ -466,9 +467,9 @@ bool OSExchangeDataProviderAuraX11::GetHtml(base::string16* html,
|
|
|
| bool OSExchangeDataProviderAuraX11::HasHtml() const {
|
| std::vector< ::Atom> url_atoms;
|
| - url_atoms.push_back(GetAtom(Clipboard::kMimeTypeHTML));
|
| + url_atoms.push_back(gfx::GetAtom(Clipboard::kMimeTypeHTML));
|
| std::vector< ::Atom> requested_types;
|
| - ui::GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
| + GetAtomIntersection(url_atoms, GetTargets(), &requested_types);
|
|
|
| return !requested_types.empty();
|
| }
|
|
|