Move ui::GetAtom to gfx::GetAtom
This CL is a followup to [1]. However, unlike that CL, this one
should have no functional changes as it is purely a refactoring.
This CL adds gfx::GetAtom (and renames the ::ui namespace in
x11_atom_cache to ::gfx) and updates all references that used to point
to ui::GetAtom to gfx::GetAtom.
Also update PRESUBMIT.py to include exceptions for 2 files that use
XInternAtom appropriately.
[1] https://codereview.chromium.org/2914103002/
BUG=730889
[email protected]
[email protected]
Review-Url: https://codereview.chromium.org/2924343002
Cr-Commit-Position: refs/heads/master@{#478103}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index c0324ab8..46e16be0 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -191,11 +191,12 @@
(
r'XInternAtom|xcb_intern_atom',
(
- 'Use ui::GetAtom() or ui::X11AtomCache::GetAtom() instead of',
- 'interning atoms directly.',
+ 'Use gfx::GetAtom() instead of interning atoms directly.',
),
True,
(
+ r"^gpu[\\\/]ipc[\\\/]service[\\\/]gpu_watchdog_thread\.cc$",
+ r"^remoting[\\\/]host[\\\/]linux[\\\/]x_server_clipboard\.cc$",
r"^ui[\\\/]gfx[\\\/]x[\\\/]x11_atom_cache\.cc$",
),
),
diff --git a/ash/host/ash_window_tree_host_x11.cc b/ash/host/ash_window_tree_host_x11.cc
index 68d864a..1ac912f2 100644
--- a/ash/host/ash_window_tree_host_x11.cc
+++ b/ash/host/ash_window_tree_host_x11.cc
@@ -217,7 +217,7 @@
if (!ui::IsXInput2Available())
return;
// Temporarily pause tap-to-click when the cursor is hidden.
- Atom prop = ui::X11AtomCache::GetInstance()->GetAtom("Tap Paused");
+ Atom prop = gfx::GetAtom("Tap Paused");
unsigned char value = state;
const XIDeviceList& dev_list =
ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(xdisplay());
diff --git a/chrome/browser/media/webrtc/window_icon_util_x11.cc b/chrome/browser/media/webrtc/window_icon_util_x11.cc
index e9b34ae5..927b938 100644
--- a/chrome/browser/media/webrtc/window_icon_util_x11.cc
+++ b/chrome/browser/media/webrtc/window_icon_util_x11.cc
@@ -8,6 +8,7 @@
#include <X11/Xutil.h>
#include "ui/base/x/x11_util.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/x11_error_tracker.h"
#include "ui/gfx/x/x11_types.h"
@@ -15,7 +16,7 @@
DCHECK(id.type == content::DesktopMediaID::TYPE_WINDOW);
Display* display = gfx::GetXDisplay();
- Atom property = ui::GetAtom("_NET_WM_ICON");
+ Atom property = gfx::GetAtom("_NET_WM_ICON");
Atom actual_type;
int actual_format;
unsigned long bytes_after; // NOLINT: type required by XGetWindowProperty
diff --git a/ui/aura/test/ui_controls_factory_aurax11.cc b/ui/aura/test/ui_controls_factory_aurax11.cc
index 1342645..3dd019980 100644
--- a/ui/aura/test/ui_controls_factory_aurax11.cc
+++ b/ui/aura/test/ui_controls_factory_aurax11.cc
@@ -16,10 +16,10 @@
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/test/ui_controls_aura.h"
-#include "ui/base/x/x11_util.h"
#include "ui/compositor/dip_util.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
#include "ui/events/test/platform_event_waiter.h"
+#include "ui/gfx/x/x11_atom_cache.h"
namespace aura {
namespace test {
@@ -38,7 +38,7 @@
// Returns atom that indidates that the XEvent is marker event.
Atom MarkerEventAtom() {
- return ui::GetAtom("marker_event");
+ return gfx::GetAtom("marker_event");
}
// Returns true when the event is a marker event.
diff --git a/ui/aura/window_tree_host_x11.cc b/ui/aura/window_tree_host_x11.cc
index f59d99e..0635b7a 100644
--- a/ui/aura/window_tree_host_x11.cc
+++ b/ui/aura/window_tree_host_x11.cc
@@ -51,6 +51,7 @@
#include "ui/events/platform/platform_event_observer.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/platform/x11/x11_event_source.h"
+#include "ui/gfx/x/x11_atom_cache.h"
using std::max;
using std::min;
@@ -145,8 +146,8 @@
// should listen for activation events and anything else that GTK+ listens
// for, and do something useful.
::Atom protocols[2];
- protocols[0] = ui::GetAtom("WM_DELETE_WINDOW");
- protocols[1] = ui::GetAtom("_NET_WM_PING");
+ protocols[0] = gfx::GetAtom("WM_DELETE_WINDOW");
+ protocols[1] = gfx::GetAtom("_NET_WM_PING");
XSetWMProtocols(xdisplay_, xwindow_, protocols, 2);
// We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with
@@ -160,7 +161,7 @@
static_assert(sizeof(long) >= sizeof(pid_t),
"pid_t should not be larger than long");
long pid = getpid();
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_PID"), XA_CARDINAL,
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_PID"), XA_CARDINAL,
32, PropModeReplace, reinterpret_cast<unsigned char*>(&pid),
1);
@@ -307,10 +308,10 @@
break;
case ClientMessage: {
Atom message_type = static_cast<Atom>(xev->xclient.data.l[0]);
- if (message_type == ui::GetAtom("WM_DELETE_WINDOW")) {
+ if (message_type == gfx::GetAtom("WM_DELETE_WINDOW")) {
// We have received a close message from the window manager.
OnHostCloseRequested();
- } else if (message_type == ui::GetAtom("_NET_WM_PING")) {
+ } else if (message_type == gfx::GetAtom("_NET_WM_PING")) {
XEvent reply_event = *xev;
reply_event.xclient.window = x_root_window_;
diff --git a/ui/base/clipboard/clipboard_aurax11.cc b/ui/base/clipboard/clipboard_aurax11.cc
index 3def226..f7f2d74d 100644
--- a/ui/base/clipboard/clipboard_aurax11.cc
+++ b/ui/base/clipboard/clipboard_aurax11.cc
@@ -34,6 +34,7 @@
#include "ui/events/platform/platform_event_source.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/x/x11_atom_cache.h"
namespace ui {
@@ -82,7 +83,7 @@
primary_sequence_number_(0) {
int ignored;
if (XFixesQueryExtension(gfx::GetXDisplay(), &event_base_, &ignored)) {
- clipboard_atom_ = GetAtom(kClipboard);
+ clipboard_atom_ = gfx::GetAtom(kClipboard);
XFixesSelectSelectionInput(gfx::GetXDisplay(), GetX11RootWindow(),
clipboard_atom_,
XFixesSetSelectionOwnerNotifyMask |
@@ -159,7 +160,7 @@
bool TargetList::ContainsFormat(
const Clipboard::FormatType& format_type) const {
- ::Atom atom = GetAtom(format_type.ToString().c_str());
+ ::Atom atom = gfx::GetAtom(format_type.ToString().c_str());
return ContainsAtom(atom);
}
@@ -314,7 +315,7 @@
0,
NULL)),
selection_requestor_(x_display_, x_window_, this),
- clipboard_owner_(x_display_, x_window_, GetAtom(kClipboard)),
+ clipboard_owner_(x_display_, x_window_, gfx::GetAtom(kClipboard)),
primary_owner_(x_display_, x_window_, XA_PRIMARY) {
XStoreName(x_display_, x_window_, "Chromium clipboard");
x_window_events_.reset(
@@ -340,7 +341,7 @@
}
::Atom ClipboardAuraX11::AuraX11Details::GetCopyPasteSelection() const {
- return GetAtom(kClipboard);
+ return gfx::GetAtom(kClipboard);
}
const SelectionFormatMap&
@@ -359,7 +360,7 @@
void ClipboardAuraX11::AuraX11Details::InsertMapping(
const std::string& key,
const scoped_refptr<base::RefCountedMemory>& memory) {
- ::Atom atom_key = GetAtom(key.c_str());
+ ::Atom atom_key = gfx::GetAtom(key.c_str());
clipboard_data_.Insert(atom_key, memory);
}
@@ -391,7 +392,7 @@
::Atom selection_name = LookupSelectionForClipboardType(type);
std::vector< ::Atom> intersection;
- ui::GetAtomIntersection(types, targets.target_list(), &intersection);
+ GetAtomIntersection(types, targets.target_list(), &intersection);
return selection_requestor_.RequestAndWaitForTypes(selection_name,
intersection);
}
@@ -417,10 +418,10 @@
::Atom out_type = None;
if (selection_requestor_.PerformBlockingConvertSelection(
- selection_name, GetAtom(kTargets), &data, &out_data_items,
+ selection_name, gfx::GetAtom(kTargets), &data, &out_data_items,
&out_type)) {
// Some apps return an |out_type| of "TARGETS". (crbug.com/377893)
- if (out_type == XA_ATOM || out_type == GetAtom(kTargets)) {
+ if (out_type == XA_ATOM || out_type == gfx::GetAtom(kTargets)) {
const ::Atom* atom_array =
reinterpret_cast<const ::Atom*>(data->front());
for (size_t i = 0; i < out_data_items; ++i)
@@ -459,7 +460,7 @@
std::vector<::Atom> ClipboardAuraX11::AuraX11Details::GetAtomsForFormat(
const Clipboard::FormatType& format) {
std::vector< ::Atom> atoms;
- atoms.push_back(GetAtom(format.ToString().c_str()));
+ atoms.push_back(gfx::GetAtom(format.ToString().c_str()));
return atoms;
}
@@ -475,7 +476,7 @@
if (XGetSelectionOwner(x_display_, selection) != x_window_)
return;
- ::Atom clipboard_manager_atom = GetAtom(kClipboardManager);
+ ::Atom clipboard_manager_atom = gfx::GetAtom(kClipboardManager);
if (XGetSelectionOwner(x_display_, clipboard_manager_atom) == None)
return;
@@ -486,7 +487,7 @@
base::TimeTicks start = base::TimeTicks::Now();
selection_requestor_.PerformBlockingConvertSelectionWithParameter(
- GetAtom(kClipboardManager), GetAtom(kSaveTargets), targets);
+ gfx::GetAtom(kClipboardManager), gfx::GetAtom(kSaveTargets), targets);
UMA_HISTOGRAM_TIMES("Clipboard.X11StoreCopyPasteDuration",
base::TimeTicks::Now() - start);
}
diff --git a/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc b/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc
index 8123d38..1a6e9a1 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
*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 @@
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 @@
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::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 @@
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 @@
// 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::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::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 @@
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 @@
// 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 @@
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::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();
}
diff --git a/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc b/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc
index c96661c4..8714f03 100644
--- a/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc
+++ b/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc
@@ -13,8 +13,8 @@
#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/dragdrop/file_info.h"
-#include "ui/base/x/x11_util.h"
#include "ui/events/platform/x11/x11_event_source_glib.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "url/gurl.h"
const char kFileURL[] = "file:///home/user/file.txt";
@@ -33,7 +33,8 @@
scoped_refptr<base::RefCountedMemory> mem(
base::RefCountedString::TakeString(&contents_copy));
- provider.format_map_.Insert(GetAtom(ui::Clipboard::kMimeTypeURIList), mem);
+ provider.format_map_.Insert(gfx::GetAtom(ui::Clipboard::kMimeTypeURIList),
+ mem);
}
protected:
diff --git a/ui/base/idle/screensaver_window_finder_x11.cc b/ui/base/idle/screensaver_window_finder_x11.cc
index 74228ba4..e01cd24 100644
--- a/ui/base/idle/screensaver_window_finder_x11.cc
+++ b/ui/base/idle/screensaver_window_finder_x11.cc
@@ -7,6 +7,7 @@
#include <X11/extensions/scrnsaver.h>
#include "ui/base/x/x11_util.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/x11_error_tracker.h"
namespace ui {
@@ -32,7 +33,7 @@
// info.state == ScreenSaverOff or info.state == ScreenSaverDisabled does not
// necessarily mean that a screensaver is not active, so add a special check
// for xscreensaver.
- static XAtom lock_atom = GetAtom("LOCK");
+ XAtom lock_atom = gfx::GetAtom("LOCK");
std::vector<int> atom_properties;
if (GetIntArrayProperty(root, "_SCREENSAVER_STATUS", &atom_properties) &&
atom_properties.size() > 0) {
diff --git a/ui/base/x/selection_owner.cc b/ui/base/x/selection_owner.cc
index fa8c321..76e6d9f 100644
--- a/ui/base/x/selection_owner.cc
+++ b/ui/base/x/selection_owner.cc
@@ -11,9 +11,9 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "ui/base/x/selection_utils.h"
-#include "ui/base/x/x11_util.h"
#include "ui/base/x/x11_window_event_manager.h"
#include "ui/events/platform/x11/x11_event_source.h"
+#include "ui/gfx/x/x11_atom_cache.h"
namespace ui {
@@ -144,7 +144,7 @@
reply.xselection.property = None; // Indicates failure
reply.xselection.time = event.xselectionrequest.time;
- if (requested_target == GetAtom(kMultiple)) {
+ if (requested_target == gfx::GetAtom(kMultiple)) {
// The contents of |requested_property| should be a list of
// <target,property> pairs.
std::vector<std::pair<XAtom,XAtom> > conversions;
@@ -164,8 +164,8 @@
// Set the property to indicate which conversions succeeded. This matches
// what GTK does.
XChangeProperty(
- x_display_, requestor, requested_property, GetAtom(kAtomPair), 32,
- PropModeReplace,
+ x_display_, requestor, requested_property, gfx::GetAtom(kAtomPair),
+ 32, PropModeReplace,
reinterpret_cast<const unsigned char*>(&conversion_results.front()),
conversion_results.size());
@@ -206,10 +206,10 @@
bool SelectionOwner::ProcessTarget(XAtom target,
XID requestor,
XAtom property) {
- XAtom multiple_atom = GetAtom(kMultiple);
- XAtom save_targets_atom = GetAtom(kSaveTargets);
- XAtom targets_atom = GetAtom(kTargets);
- XAtom timestamp_atom = GetAtom(kTimestamp);
+ XAtom multiple_atom = gfx::GetAtom(kMultiple);
+ XAtom save_targets_atom = gfx::GetAtom(kSaveTargets);
+ XAtom targets_atom = gfx::GetAtom(kTargets);
+ XAtom timestamp_atom = gfx::GetAtom(kTimestamp);
if (target == multiple_atom || target == save_targets_atom)
return false;
@@ -246,7 +246,7 @@
// the size of X requests. Notify the selection requestor that the data
// will be sent incrementally by returning data of type "INCR".
long length = it->second->size();
- XChangeProperty(x_display_, requestor, property, GetAtom(kIncr), 32,
+ XChangeProperty(x_display_, requestor, property, gfx::GetAtom(kIncr), 32,
PropModeReplace,
reinterpret_cast<unsigned char*>(&length), 1);
diff --git a/ui/base/x/selection_requestor.cc b/ui/base/x/selection_requestor.cc
index a6e402c..c4b8a7ec 100644
--- a/ui/base/x/selection_requestor.cc
+++ b/ui/base/x/selection_requestor.cc
@@ -13,6 +13,7 @@
#include "ui/base/x/x11_util.h"
#include "ui/events/platform/platform_event_dispatcher.h"
#include "ui/events/platform/platform_event_source.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/x11_types.h"
namespace ui {
@@ -62,7 +63,7 @@
x_property_(None),
dispatcher_(dispatcher),
current_request_index_(0u) {
- x_property_ = GetAtom(kChromeSelection);
+ x_property_ = gfx::GetAtom(kChromeSelection);
}
SelectionRequestor::~SelectionRequestor() {}
@@ -162,7 +163,7 @@
if (event_property != None)
XDeleteProperty(x_display_, x_window_, event_property);
- if (request->out_type == GetAtom(kIncr)) {
+ if (request->out_type == gfx::GetAtom(kIncr)) {
request->data_sent_incrementally = true;
request->out_data.clear();
request->out_data_items = 0u;
diff --git a/ui/base/x/selection_requestor_unittest.cc b/ui/base/x/selection_requestor_unittest.cc
index 5a94412..d1b14674 100644
--- a/ui/base/x/selection_requestor_unittest.cc
+++ b/ui/base/x/selection_requestor_unittest.cc
@@ -15,6 +15,7 @@
#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"
#include "ui/gfx/x/x11_types.h"
#include <X11/Xlib.h>
@@ -34,8 +35,8 @@
void SendSelectionNotify(XAtom selection,
XAtom target,
const std::string& value) {
- ui::SetStringProperty(x_window_, requestor_->x_property_, GetAtom("STRING"),
- value);
+ ui::SetStringProperty(x_window_, requestor_->x_property_,
+ gfx::GetAtom("STRING"), value);
XEvent xev;
xev.type = SelectionNotify;
@@ -106,7 +107,7 @@
selection, target, &out_data, &out_data_items, &out_type));
EXPECT_EQ(expected_data, ui::RefCountedMemoryToString(out_data));
EXPECT_EQ(expected_data.size(), out_data_items);
- EXPECT_EQ(GetAtom("STRING"), out_type);
+ EXPECT_EQ(gfx::GetAtom("STRING"), out_type);
}
} // namespace
@@ -117,10 +118,10 @@
// Assume that |selection| will have no owner. If there is an owner, the owner
// will set the property passed into the XConvertSelection() request which is
// undesirable.
- XAtom selection = GetAtom("FAKE_SELECTION");
+ XAtom selection = gfx::GetAtom("FAKE_SELECTION");
- XAtom target1 = GetAtom("TARGET1");
- XAtom target2 = GetAtom("TARGET2");
+ XAtom target1 = gfx::GetAtom("TARGET1");
+ XAtom target2 = gfx::GetAtom("TARGET2");
base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
loop->task_runner()->PostTask(
diff --git a/ui/base/x/selection_utils.cc b/ui/base/x/selection_utils.cc
index 48eff62..3ab3c842 100644
--- a/ui/base/x/selection_utils.cc
+++ b/ui/base/x/selection_utils.cc
@@ -15,7 +15,7 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/base/clipboard/clipboard.h"
-#include "ui/base/x/x11_util.h"
+#include "ui/gfx/x/x11_atom_cache.h"
namespace ui {
@@ -27,24 +27,24 @@
std::vector<::Atom> GetTextAtomsFrom() {
std::vector< ::Atom> atoms;
- atoms.push_back(GetAtom(kUtf8String));
- atoms.push_back(GetAtom(kString));
- atoms.push_back(GetAtom(kText));
- atoms.push_back(GetAtom(kTextPlain));
- atoms.push_back(GetAtom(kTextPlainUtf8));
+ atoms.push_back(gfx::GetAtom(kUtf8String));
+ atoms.push_back(gfx::GetAtom(kString));
+ atoms.push_back(gfx::GetAtom(kText));
+ atoms.push_back(gfx::GetAtom(kTextPlain));
+ atoms.push_back(gfx::GetAtom(kTextPlainUtf8));
return atoms;
}
std::vector<::Atom> GetURLAtomsFrom() {
std::vector< ::Atom> atoms;
- atoms.push_back(GetAtom(Clipboard::kMimeTypeURIList));
- atoms.push_back(GetAtom(Clipboard::kMimeTypeMozillaURL));
+ atoms.push_back(gfx::GetAtom(Clipboard::kMimeTypeURIList));
+ atoms.push_back(gfx::GetAtom(Clipboard::kMimeTypeMozillaURL));
return atoms;
}
std::vector<::Atom> GetURIListAtomsFrom() {
std::vector< ::Atom> atoms;
- atoms.push_back(GetAtom(Clipboard::kMimeTypeURIList));
+ atoms.push_back(gfx::GetAtom(Clipboard::kMimeTypeURIList));
return atoms;
}
@@ -181,10 +181,11 @@
}
std::string SelectionData::GetText() const {
- if (type_ == GetAtom(kUtf8String) || type_ == GetAtom(kText) ||
- type_ == GetAtom(kTextPlainUtf8)) {
+ if (type_ == gfx::GetAtom(kUtf8String) || type_ == gfx::GetAtom(kText) ||
+ type_ == gfx::GetAtom(kTextPlainUtf8)) {
return RefCountedMemoryToString(memory_);
- } else if (type_ == GetAtom(kString) || type_ == GetAtom(kTextPlain)) {
+ } else if (type_ == gfx::GetAtom(kString) ||
+ type_ == gfx::GetAtom(kTextPlain)) {
std::string result;
base::ConvertToUtf8AndNormalize(RefCountedMemoryToString(memory_),
base::kCodepageLatin1,
@@ -201,7 +202,7 @@
base::string16 SelectionData::GetHtml() const {
base::string16 markup;
- if (type_ == GetAtom(Clipboard::kMimeTypeHTML)) {
+ if (type_ == gfx::GetAtom(Clipboard::kMimeTypeHTML)) {
const unsigned char* data = GetData();
size_t size = GetSize();
diff --git a/ui/base/x/x11_menu_list.cc b/ui/base/x/x11_menu_list.cc
index a7c2fda..876865b 100644
--- a/ui/base/x/x11_menu_list.cc
+++ b/ui/base/x/x11_menu_list.cc
@@ -8,6 +8,7 @@
#include "base/memory/singleton.h"
#include "ui/base/x/x11_util.h"
+#include "ui/gfx/x/x11_atom_cache.h"
namespace ui {
@@ -17,8 +18,7 @@
}
XMenuList::XMenuList()
- : menu_type_atom_(GetAtom("_NET_WM_WINDOW_TYPE_MENU")) {
-}
+ : menu_type_atom_(gfx::GetAtom("_NET_WM_WINDOW_TYPE_MENU")) {}
XMenuList::~XMenuList() {
menus_.clear();
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index bf3231c..c2ff09a0 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -94,7 +94,7 @@
bool GetProperty(XID window, const std::string& property_name, long max_length,
XAtom* type, int* format, unsigned long* num_items,
unsigned char** property) {
- XAtom property_atom = GetAtom(property_name.c_str());
+ XAtom property_atom = gfx::GetAtom(property_name.c_str());
unsigned long remaining_bytes = 0;
return XGetWindowProperty(gfx::GetXDisplay(),
window,
@@ -442,7 +442,7 @@
motif_hints.flags = (1L << 1);
motif_hints.decorations = use_os_window_frame ? 1 : 0;
- XAtom hint_atom = GetAtom("_MOTIF_WM_HINTS");
+ XAtom hint_atom = gfx::GetAtom("_MOTIF_WM_HINTS");
XChangeProperty(gfx::GetXDisplay(),
window,
hint_atom,
@@ -472,14 +472,11 @@
HideTitlebarWhenMaximized property) {
// XChangeProperty() expects "hide" to be long.
unsigned long hide = property;
- XChangeProperty(gfx::GetXDisplay(),
- window,
- GetAtom("_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED"),
- XA_CARDINAL,
- 32, // size in bits
- PropModeReplace,
- reinterpret_cast<unsigned char*>(&hide),
- 1);
+ XChangeProperty(gfx::GetXDisplay(), window,
+ gfx::GetAtom("_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED"),
+ XA_CARDINAL,
+ 32, // size in bits
+ PropModeReplace, reinterpret_cast<unsigned char*>(&hide), 1);
}
void ClearX11DefaultRootWindow() {
@@ -514,7 +511,7 @@
// Minimized windows are not visible.
std::vector<XAtom> wm_states;
if (GetAtomArrayProperty(window, "_NET_WM_STATE", &wm_states)) {
- XAtom hidden_atom = GetAtom("_NET_WM_STATE_HIDDEN");
+ XAtom hidden_atom = gfx::GetAtom("_NET_WM_STATE_HIDDEN");
if (base::ContainsValue(wm_states, hidden_atom))
return false;
}
@@ -825,8 +822,8 @@
const std::string& type,
const std::vector<int>& value) {
DCHECK(!value.empty());
- XAtom name_atom = GetAtom(name.c_str());
- XAtom type_atom = GetAtom(type.c_str());
+ XAtom name_atom = gfx::GetAtom(name.c_str());
+ XAtom type_atom = gfx::GetAtom(type.c_str());
// XChangeProperty() expects values of type 32 to be longs.
std::unique_ptr<long[]> data(new long[value.size()]);
@@ -858,8 +855,8 @@
const std::string& type,
const std::vector<XAtom>& value) {
DCHECK(!value.empty());
- XAtom name_atom = GetAtom(name.c_str());
- XAtom type_atom = GetAtom(type.c_str());
+ XAtom name_atom = gfx::GetAtom(name.c_str());
+ XAtom type_atom = gfx::GetAtom(type.c_str());
// XChangeProperty() expects values of type 32 to be longs.
std::unique_ptr<XAtom[]> data(new XAtom[value.size()]);
@@ -894,10 +891,6 @@
return !err_tracker.FoundNewError();
}
-XAtom GetAtom(const char* name) {
- return X11AtomCache::GetInstance()->GetAtom(name);
-}
-
void SetWindowClassHint(XDisplay* display,
XID window,
const std::string& res_name,
@@ -913,13 +906,12 @@
void SetWindowRole(XDisplay* display, XID window, const std::string& role) {
if (role.empty()) {
- XDeleteProperty(display, window, GetAtom("WM_WINDOW_ROLE"));
+ XDeleteProperty(display, window, gfx::GetAtom("WM_WINDOW_ROLE"));
} else {
char* role_c = const_cast<char*>(role.c_str());
- XChangeProperty(display, window, GetAtom("WM_WINDOW_ROLE"), XA_STRING, 8,
- PropModeReplace,
- reinterpret_cast<unsigned char*>(role_c),
- role.size());
+ XChangeProperty(display, window, gfx::GetAtom("WM_WINDOW_ROLE"), XA_STRING,
+ 8, PropModeReplace,
+ reinterpret_cast<unsigned char*>(role_c), role.size());
}
}
@@ -1185,7 +1177,8 @@
bool IsCompositingManagerPresent() {
static bool is_compositing_manager_present =
- XGetSelectionOwner(gfx::GetXDisplay(), GetAtom("_NET_WM_CM_S0")) != None;
+ XGetSelectionOwner(gfx::GetXDisplay(), gfx::GetAtom("_NET_WM_CM_S0")) !=
+ None;
return is_compositing_manager_present;
}
@@ -1197,7 +1190,7 @@
// If _NET_WM_STATE_FULLSCREEN is in _NET_SUPPORTED, use the presence or
// absence of _NET_WM_STATE_FULLSCREEN in _NET_WM_STATE to determine
// whether we're fullscreen.
- XAtom fullscreen_atom = GetAtom("_NET_WM_STATE_FULLSCREEN");
+ XAtom fullscreen_atom = gfx::GetAtom("_NET_WM_STATE_FULLSCREEN");
if (WmSupportsHint(fullscreen_atom)) {
std::vector<XAtom> atom_properties;
if (GetAtomArrayProperty(window,
@@ -1391,7 +1384,7 @@
for (int i = 0; i < visuals_len; ++i)
visuals_[visual_list[i].visualid].reset(new XVisualData(visual_list[i]));
- XAtom NET_WM_CM_S0 = GetAtom("_NET_WM_CM_S0");
+ XAtom NET_WM_CM_S0 = gfx::GetAtom("_NET_WM_CM_S0");
using_compositing_wm_ = XGetSelectionOwner(display_, NET_WM_CM_S0) != None;
// Choose the opaque visual.
diff --git a/ui/base/x/x11_util.h b/ui/base/x/x11_util.h
index 3dfdcb1..c47ce28 100644
--- a/ui/base/x/x11_util.h
+++ b/ui/base/x/x11_util.h
@@ -177,9 +177,6 @@
XAtom type,
const std::string& value);
-// Gets the X atom for default display corresponding to atom_name.
-UI_BASE_X_EXPORT XAtom GetAtom(const char* atom_name);
-
// Sets the WM_CLASS attribute for a given X11 window.
UI_BASE_X_EXPORT void SetWindowClassHint(XDisplay* display,
XID window,
diff --git a/ui/display/manager/chromeos/x11/native_display_delegate_x11.cc b/ui/display/manager/chromeos/x11/native_display_delegate_x11.cc
index d94e618a..df9af54 100644
--- a/ui/display/manager/chromeos/x11/native_display_delegate_x11.cc
+++ b/ui/display/manager/chromeos/x11/native_display_delegate_x11.cc
@@ -16,7 +16,6 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "ui/base/x/x11_util.h"
#include "ui/display/manager/chromeos/x11/display_mode_x11.h"
#include "ui/display/manager/chromeos/x11/display_snapshot_x11.h"
#include "ui/display/manager/chromeos/x11/display_util_x11.h"
@@ -25,6 +24,7 @@
#include "ui/display/util/x11/edid_parser_x11.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/x11_error_tracker.h"
#include "ui/gfx/x/x11_types.h"
@@ -403,7 +403,7 @@
Atom actual_type = None;
int success = 0;
RROutput output_id = static_cast<const DisplaySnapshotX11&>(output).output();
- Atom prop = ui::GetAtom(kContentProtectionAtomName);
+ Atom prop = gfx::GetAtom(kContentProtectionAtomName);
// TODO(kcwu): Move this to x11_util (similar method calls in this file and
// output_util.cc)
@@ -430,11 +430,11 @@
if (success == Success && actual_type == XA_ATOM && actual_format == 32 &&
nitems == 1) {
Atom value = reinterpret_cast<Atom*>(values)[0];
- if (value == ui::GetAtom(kProtectionUndesiredAtomName)) {
+ if (value == gfx::GetAtom(kProtectionUndesiredAtomName)) {
*state = HDCP_STATE_UNDESIRED;
- } else if (value == ui::GetAtom(kProtectionDesiredAtomName)) {
+ } else if (value == gfx::GetAtom(kProtectionDesiredAtomName)) {
*state = HDCP_STATE_DESIRED;
- } else if (value == ui::GetAtom(kProtectionEnabledAtomName)) {
+ } else if (value == gfx::GetAtom(kProtectionEnabledAtomName)) {
*state = HDCP_STATE_ENABLED;
} else {
LOG(ERROR) << "Unknown " << kContentProtectionAtomName
@@ -459,14 +459,14 @@
bool NativeDisplayDelegateX11::SetHDCPState(const DisplaySnapshot& output,
HDCPState state) {
- Atom name = ui::GetAtom(kContentProtectionAtomName);
+ Atom name = gfx::GetAtom(kContentProtectionAtomName);
Atom value = None;
switch (state) {
case HDCP_STATE_UNDESIRED:
- value = ui::GetAtom(kProtectionUndesiredAtomName);
+ value = gfx::GetAtom(kProtectionUndesiredAtomName);
break;
case HDCP_STATE_DESIRED:
- value = ui::GetAtom(kProtectionDesiredAtomName);
+ value = gfx::GetAtom(kProtectionDesiredAtomName);
break;
default:
NOTREACHED() << "Invalid HDCP state: " << state;
@@ -543,8 +543,8 @@
}
bool NativeDisplayDelegateX11::IsOutputAspectPreservingScaling(RROutput id) {
- Atom scaling_prop = ui::GetAtom("scaling mode");
- Atom full_aspect_atom = ui::GetAtom("Full aspect");
+ Atom scaling_prop = gfx::GetAtom("scaling mode");
+ Atom full_aspect_atom = gfx::GetAtom("Full aspect");
if (scaling_prop == None || full_aspect_atom == None)
return false;
diff --git a/ui/display/util/x11/edid_parser_x11.cc b/ui/display/util/x11/edid_parser_x11.cc
index a394708..4c5f682 100644
--- a/ui/display/util/x11/edid_parser_x11.cc
+++ b/ui/display/util/x11/edid_parser_x11.cc
@@ -34,8 +34,7 @@
Display* display = gfx::GetXDisplay();
- static Atom edid_property =
- ui::X11AtomCache::GetInstance()->GetAtom(RR_PROPERTY_RANDR_EDID);
+ Atom edid_property = gfx::GetAtom(RR_PROPERTY_RANDR_EDID);
bool has_edid_property = false;
int num_properties = 0;
diff --git a/ui/events/devices/x11/device_data_manager_x11.cc b/ui/events/devices/x11/device_data_manager_x11.cc
index abc70fc..f218275 100644
--- a/ui/events/devices/x11/device_data_manager_x11.cc
+++ b/ui/events/devices/x11/device_data_manager_x11.cc
@@ -243,7 +243,7 @@
// Find all the touchpad devices.
const XDeviceList& dev_list =
ui::DeviceListCacheX11::GetInstance()->GetXDeviceList(display);
- Atom xi_touchpad = ui::X11AtomCache::GetInstance()->GetAtom(XI_TOUCHPAD);
+ Atom xi_touchpad = gfx::GetAtom(XI_TOUCHPAD);
for (int i = 0; i < dev_list.count; ++i)
if (dev_list[i].type == xi_touchpad)
touchpads_[dev_list[i].id] = true;
@@ -256,8 +256,7 @@
ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(display);
Atom atoms[DT_LAST_ENTRY];
for (int data_type = 0; data_type < DT_LAST_ENTRY; ++data_type)
- atoms[data_type] =
- ui::X11AtomCache::GetInstance()->GetAtom(kCachedAtoms[data_type]);
+ atoms[data_type] = gfx::GetAtom(kCachedAtoms[data_type]);
for (int i = 0; i < info_list.count; ++i) {
const XIDeviceInfo& info = info_list[i];
diff --git a/ui/events/platform/x11/x11_event_source.cc b/ui/events/platform/x11/x11_event_source.cc
index 6f2d835..b27acd8 100644
--- a/ui/events/platform/x11/x11_event_source.cc
+++ b/ui/events/platform/x11/x11_event_source.cc
@@ -157,7 +157,7 @@
// Create a new Window and Atom that will be used for the property change.
dummy_window_ = XCreateSimpleWindow(display_, DefaultRootWindow(display_),
0, 0, 1, 1, 0, 0, 0);
- dummy_atom_ = X11AtomCache::GetInstance()->GetAtom("CHROMIUM_TIMESTAMP");
+ dummy_atom_ = gfx::GetAtom("CHROMIUM_TIMESTAMP");
dummy_window_events_.reset(
new XScopedEventSelector(dummy_window_, PropertyChangeMask));
dummy_initialized_ = true;
diff --git a/ui/events/platform/x11/x11_hotplug_event_handler.cc b/ui/events/platform/x11/x11_hotplug_event_handler.cc
index f6f6b15..0cb25684 100644
--- a/ui/events/platform/x11/x11_hotplug_event_handler.cc
+++ b/ui/events/platform/x11/x11_hotplug_event_handler.cc
@@ -25,7 +25,6 @@
#include "base/sys_info.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/threading/worker_pool.h"
-#include "ui/base/x/x11_util.h"
#include "ui/events/devices/device_data_manager.h"
#include "ui/events/devices/device_hotplug_event_observer.h"
#include "ui/events/devices/device_util_linux.h"
@@ -197,7 +196,7 @@
// Input device has a property "Device Node" pointing to its dev input node,
// e.g. Device Node (250): "/dev/input/event8"
- Atom device_node = ui::X11AtomCache::GetInstance()->GetAtom("Device Node");
+ Atom device_node = gfx::GetAtom("Device Node");
if (device_node == None)
return base::FilePath();
@@ -423,13 +422,13 @@
continue;
Atom type = device_list_xi[i].type;
- if (type == GetAtom(XI_KEYBOARD))
+ if (type == gfx::GetAtom(XI_KEYBOARD))
device_types[id] = DEVICE_TYPE_KEYBOARD;
- else if (type == GetAtom(XI_MOUSE))
+ else if (type == gfx::GetAtom(XI_MOUSE))
device_types[id] = DEVICE_TYPE_MOUSE;
- else if (type == GetAtom(XI_TOUCHPAD))
+ else if (type == gfx::GetAtom(XI_TOUCHPAD))
device_types[id] = DEVICE_TYPE_TOUCHPAD;
- else if (type == GetAtom(XI_TOUCHSCREEN))
+ else if (type == gfx::GetAtom(XI_TOUCHSCREEN))
device_types[id] = DEVICE_TYPE_TOUCHSCREEN;
}
@@ -454,8 +453,9 @@
uint16_t vendor = 0;
uint16_t product = 0;
if (XIGetProperty(gfx::GetXDisplay(), device.deviceid,
- GetAtom(XI_PROP_PRODUCT_ID), 0, 2, 0, XA_INTEGER, &type,
- &format_return, &num_items_return, &bytes_after_return,
+ gfx::GetAtom(XI_PROP_PRODUCT_ID), 0, 2, 0, XA_INTEGER,
+ &type, &format_return, &num_items_return,
+ &bytes_after_return,
reinterpret_cast<unsigned char**>(&product_info)) == 0 &&
product_info) {
if (num_items_return == 2) {
@@ -471,8 +471,8 @@
// X11 is not thread safe, so first get all the required state.
DisplayState display_state;
- display_state.mt_position_x = GetAtom("Abs MT Position X");
- display_state.mt_position_y = GetAtom("Abs MT Position Y");
+ display_state.mt_position_x = gfx::GetAtom("Abs MT Position X");
+ display_state.mt_position_y = gfx::GetAtom("Abs MT Position Y");
UiCallbacks callbacks;
callbacks.keyboard_callback = base::Bind(&OnKeyboardDevices);
diff --git a/ui/gfx/icc_profile_x11.cc b/ui/gfx/icc_profile_x11.cc
index b2d7ca1..819c8a6d 100644
--- a/ui/gfx/icc_profile_x11.cc
+++ b/ui/gfx/icc_profile_x11.cc
@@ -25,7 +25,7 @@
ICCProfile icc_profile;
if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless))
return icc_profile;
- Atom property = ui::X11AtomCache::GetInstance()->GetAtom("_ICC_PROFILE");
+ Atom property = GetAtom("_ICC_PROFILE");
if (property != None) {
Atom prop_type = None;
int prop_format = 0;
diff --git a/ui/gfx/x/x11_atom_cache.cc b/ui/gfx/x/x11_atom_cache.cc
index a5ce809..893d6ad 100644
--- a/ui/gfx/x/x11_atom_cache.cc
+++ b/ui/gfx/x/x11_atom_cache.cc
@@ -156,7 +156,11 @@
} // namespace
-namespace ui {
+namespace gfx {
+
+XAtom GetAtom(const char* name) {
+ return X11AtomCache::GetInstance()->GetAtom(name);
+}
X11AtomCache* X11AtomCache::GetInstance() {
return base::Singleton<X11AtomCache>::get();
@@ -191,4 +195,4 @@
return it->second;
}
-} // namespace ui
+} // namespace gfx
diff --git a/ui/gfx/x/x11_atom_cache.h b/ui/gfx/x/x11_atom_cache.h
index 91e68786..19bebbe 100644
--- a/ui/gfx/x/x11_atom_cache.h
+++ b/ui/gfx/x/x11_atom_cache.h
@@ -17,7 +17,10 @@
struct DefaultSingletonTraits;
}
-namespace ui {
+namespace gfx {
+
+// Gets the X atom for default display corresponding to atom_name.
+GFX_EXPORT XAtom GetAtom(const char* atom_name);
// Pre-caches all Atoms on first use to minimize roundtrips to the X11
// server. By default, GetAtom() will CHECK() that atoms accessed through
@@ -27,15 +30,16 @@
public:
static X11AtomCache* GetInstance();
- // Returns the pre-interned Atom without having to go to the x server.
- XAtom GetAtom(const char*) const;
-
private:
+ friend XAtom GetAtom(const char* atom_name);
friend struct base::DefaultSingletonTraits<X11AtomCache>;
X11AtomCache();
~X11AtomCache();
+ // Returns the pre-interned Atom without having to go to the x server.
+ XAtom GetAtom(const char*) const;
+
XDisplay* xdisplay_;
mutable std::map<std::string, XAtom> cached_atoms_;
@@ -43,6 +47,6 @@
DISALLOW_COPY_AND_ASSIGN(X11AtomCache);
};
-} // namespace ui
+} // namespace gfx
#endif // UI_GFX_X_X11_ATOM_CACHE_H_
diff --git a/ui/platform_window/x11/x11_window_base.cc b/ui/platform_window/x11/x11_window_base.cc
index 61d555d..4e8de81 100644
--- a/ui/platform_window/x11/x11_window_base.cc
+++ b/ui/platform_window/x11/x11_window_base.cc
@@ -13,7 +13,6 @@
#include "base/strings/utf_string_conversions.h"
#include "ui/base/platform_window_defaults.h"
-#include "ui/base/x/x11_util.h"
#include "ui/base/x/x11_window_event_manager.h"
#include "ui/events/devices/x11/touch_factory_x11.h"
#include "ui/events/event.h"
@@ -22,6 +21,7 @@
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/platform_window/platform_window_delegate.h"
namespace ui {
@@ -113,8 +113,8 @@
XFlush(xdisplay_);
::Atom protocols[2];
- protocols[0] = GetAtom("WM_DELETE_WINDOW");
- protocols[1] = GetAtom("_NET_WM_PING");
+ protocols[0] = gfx::GetAtom("WM_DELETE_WINDOW");
+ protocols[1] = gfx::GetAtom("_NET_WM_PING");
XSetWMProtocols(xdisplay_, xwindow_, protocols, 2);
// We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with
@@ -127,8 +127,9 @@
static_assert(sizeof(long) >= sizeof(pid_t),
"pid_t should not be larger than long");
long pid = getpid();
- XChangeProperty(xdisplay_, xwindow_, GetAtom("_NET_WM_PID"), XA_CARDINAL, 32,
- PropModeReplace, reinterpret_cast<unsigned char*>(&pid), 1);
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_PID"), XA_CARDINAL,
+ 32, PropModeReplace, reinterpret_cast<unsigned char*>(&pid),
+ 1);
// Before we map the window, set size hints. Otherwise, some window managers
// will ignore toplevel XMoveWindow commands.
XSizeHints size_hints;
@@ -214,8 +215,8 @@
return;
window_title_ = title;
std::string utf8str = base::UTF16ToUTF8(title);
- XChangeProperty(xdisplay_, xwindow_, GetAtom("_NET_WM_NAME"),
- GetAtom("UTF8_STRING"), 8, PropModeReplace,
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_NAME"),
+ gfx::GetAtom("UTF8_STRING"), 8, PropModeReplace,
reinterpret_cast<const unsigned char*>(utf8str.c_str()),
utf8str.size());
XTextProperty xtp;
@@ -293,9 +294,9 @@
case ClientMessage: {
Atom message = static_cast<Atom>(xev->xclient.data.l[0]);
- if (message == GetAtom("WM_DELETE_WINDOW")) {
+ if (message == gfx::GetAtom("WM_DELETE_WINDOW")) {
delegate_->OnCloseRequest();
- } else if (message == GetAtom("_NET_WM_PING")) {
+ } else if (message == gfx::GetAtom("_NET_WM_PING")) {
XEvent reply_event = *xev;
reply_event.xclient.window = xroot_window_;
diff --git a/ui/views/test/ui_controls_factory_desktop_aurax11.cc b/ui/views/test/ui_controls_factory_desktop_aurax11.cc
index c43e67b5..534e0c4 100644
--- a/ui/views/test/ui_controls_factory_desktop_aurax11.cc
+++ b/ui/views/test/ui_controls_factory_desktop_aurax11.cc
@@ -24,6 +24,7 @@
#include "ui/compositor/dip_util.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
#include "ui/events/test/platform_event_waiter.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/x11_connection.h"
#include "ui/views/test/test_desktop_screen_x11.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
@@ -45,7 +46,7 @@
// Returns atom that indidates that the XEvent is marker event.
Atom MarkerEventAtom() {
- return ui::GetAtom("marker_event");
+ return gfx::GetAtom("marker_event");
}
// Returns true when the event is a marker event.
diff --git a/ui/views/test/x11_property_change_waiter.cc b/ui/views/test/x11_property_change_waiter.cc
index b9937b3..d267b82 100644
--- a/ui/views/test/x11_property_change_waiter.cc
+++ b/ui/views/test/x11_property_change_waiter.cc
@@ -7,10 +7,10 @@
#include <X11/Xlib.h>
#include "base/run_loop.h"
-#include "ui/base/x/x11_util.h"
#include "ui/base/x/x11_window_event_manager.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/platform/scoped_event_dispatcher.h"
+#include "ui/gfx/x/x11_atom_cache.h"
namespace views {
@@ -58,7 +58,7 @@
const ui::PlatformEvent& event) {
if (!wait_ || event->type != PropertyNotify ||
event->xproperty.window != x_window_ ||
- event->xproperty.atom != ui::GetAtom(property_) ||
+ event->xproperty.atom != gfx::GetAtom(property_) ||
ShouldKeepOnWaiting(event)) {
return ui::POST_DISPATCH_PERFORM_DEFAULT;
}
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
index 175ae23..d53d9c7 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
@@ -26,13 +26,13 @@
#include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h"
#include "ui/base/layout.h"
#include "ui/base/x/selection_utils.h"
-#include "ui/base/x/x11_util.h"
#include "ui/base/x/x11_window_event_manager.h"
#include "ui/display/screen.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/gfx/image/image_skia.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h"
#include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
@@ -312,8 +312,7 @@
bool get_types_from_property = ((event.data.l[1] & 1) != 0);
if (get_types_from_property) {
- if (!ui::GetAtomArrayProperty(source_window_,
- kXdndTypeList,
+ if (!ui::GetAtomArrayProperty(source_window_, kXdndTypeList,
&unfetched_targets_)) {
return;
}
@@ -391,8 +390,8 @@
::Atom target = unfetched_targets_.back();
unfetched_targets_.pop_back();
- XConvertSelection(gfx::GetXDisplay(), ui::GetAtom(kXdndSelection), target,
- ui::GetAtom(kChromiumDragReciever), local_window_,
+ XConvertSelection(gfx::GetXDisplay(), gfx::GetAtom(kXdndSelection), target,
+ gfx::GetAtom(kChromiumDragReciever), local_window_,
position_time_stamp_);
}
@@ -408,7 +407,7 @@
DVLOG(1) << "SelectionNotify, format " << event.target;
if (event.property != None) {
- DCHECK_EQ(event.property, ui::GetAtom(kChromiumDragReciever));
+ DCHECK_EQ(event.property, gfx::GetAtom(kChromiumDragReciever));
scoped_refptr<base::RefCountedMemory> data;
::Atom type = None;
@@ -436,8 +435,7 @@
void DesktopDragDropClientAuraX11::X11DragContext::ReadActions() {
if (!source_client_) {
std::vector<::Atom> atom_array;
- if (!ui::GetAtomArrayProperty(source_window_,
- kXdndActionList,
+ if (!ui::GetAtomArrayProperty(source_window_, kXdndActionList,
&atom_array)) {
actions_.clear();
} else {
@@ -466,11 +464,11 @@
void DesktopDragDropClientAuraX11::X11DragContext::MaskOperation(
::Atom xdnd_operation,
int* drag_operation) const {
- if (xdnd_operation == ui::GetAtom(kXdndActionCopy))
+ if (xdnd_operation == gfx::GetAtom(kXdndActionCopy))
*drag_operation |= ui::DragDropTypes::DRAG_COPY;
- else if (xdnd_operation == ui::GetAtom(kXdndActionMove))
+ else if (xdnd_operation == gfx::GetAtom(kXdndActionMove))
*drag_operation |= ui::DragDropTypes::DRAG_MOVE;
- else if (xdnd_operation == ui::GetAtom(kXdndActionLink))
+ else if (xdnd_operation == gfx::GetAtom(kXdndActionLink))
*drag_operation |= ui::DragDropTypes::DRAG_LINK;
}
@@ -482,7 +480,7 @@
uint32_t DesktopDragDropClientAuraX11::X11DragContext::DispatchEvent(
const ui::PlatformEvent& event) {
if (event->type == PropertyNotify &&
- event->xproperty.atom == ui::GetAtom(kXdndActionList)) {
+ event->xproperty.atom == gfx::GetAtom(kXdndActionList)) {
ReadActions();
return ui::POST_DISPATCH_STOP_PROPAGATION;
}
@@ -516,7 +514,7 @@
// Mark that we are aware of drag and drop concepts.
unsigned long xdnd_version = kMaxXdndVersion;
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom(kXdndAware), XA_ATOM, 32,
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom(kXdndAware), XA_ATOM, 32,
PropModeReplace,
reinterpret_cast<unsigned char*>(&xdnd_version), 1);
}
@@ -726,7 +724,7 @@
XEvent xev;
xev.xclient.type = ClientMessage;
- xev.xclient.message_type = ui::GetAtom(kXdndFinished);
+ xev.xclient.message_type = gfx::GetAtom(kXdndFinished);
xev.xclient.format = 32;
xev.xclient.window = source_window;
xev.xclient.data.l[0] = xwindow_;
@@ -775,10 +773,10 @@
std::vector<::Atom> actions = GetOfferedDragOperations();
if (!source_provider_->file_contents_name().empty()) {
- actions.push_back(ui::GetAtom(kXdndActionDirectSave));
+ actions.push_back(gfx::GetAtom(kXdndActionDirectSave));
ui::SetStringProperty(
- xwindow_, ui::GetAtom(kXdndDirectSave0),
- ui::GetAtom(ui::Clipboard::kMimeTypeText),
+ xwindow_, gfx::GetAtom(kXdndDirectSave0),
+ gfx::GetAtom(ui::Clipboard::kMimeTypeText),
source_provider_->file_contents_name().AsUTF8Unsafe());
}
ui::SetAtomArrayProperty(xwindow_, kXdndActionList, "ATOM", actions);
@@ -820,8 +818,8 @@
source_provider_ = NULL;
g_current_drag_drop_client = NULL;
drag_operation_ = 0;
- XDeleteProperty(xdisplay_, xwindow_, ui::GetAtom(kXdndActionList));
- XDeleteProperty(xdisplay_, xwindow_, ui::GetAtom(kXdndDirectSave0));
+ XDeleteProperty(xdisplay_, xwindow_, gfx::GetAtom(kXdndActionList));
+ XDeleteProperty(xdisplay_, xwindow_, gfx::GetAtom(kXdndDirectSave0));
return negotiated_operation_;
}
@@ -962,22 +960,22 @@
DesktopDragDropClientAuraX11* short_circuit = GetForWindow(xid);
if (short_circuit) {
Atom message_type = xev->xclient.message_type;
- if (message_type == ui::GetAtom(kXdndEnter)) {
+ if (message_type == gfx::GetAtom(kXdndEnter)) {
short_circuit->OnXdndEnter(xev->xclient);
return;
- } else if (message_type == ui::GetAtom(kXdndLeave)) {
+ } else if (message_type == gfx::GetAtom(kXdndLeave)) {
short_circuit->OnXdndLeave(xev->xclient);
return;
- } else if (message_type == ui::GetAtom(kXdndPosition)) {
+ } else if (message_type == gfx::GetAtom(kXdndPosition)) {
short_circuit->OnXdndPosition(xev->xclient);
return;
- } else if (message_type == ui::GetAtom(kXdndStatus)) {
+ } else if (message_type == gfx::GetAtom(kXdndStatus)) {
short_circuit->OnXdndStatus(xev->xclient);
return;
- } else if (message_type == ui::GetAtom(kXdndFinished)) {
+ } else if (message_type == gfx::GetAtom(kXdndFinished)) {
short_circuit->OnXdndFinished(xev->xclient);
return;
- } else if (message_type == ui::GetAtom(kXdndDrop)) {
+ } else if (message_type == gfx::GetAtom(kXdndDrop)) {
short_circuit->OnXdndDrop(xev->xclient);
return;
}
@@ -1115,22 +1113,22 @@
::Atom DesktopDragDropClientAuraX11::DragOperationToAtom(
int drag_operation) {
if (drag_operation & ui::DragDropTypes::DRAG_COPY)
- return ui::GetAtom(kXdndActionCopy);
+ return gfx::GetAtom(kXdndActionCopy);
if (drag_operation & ui::DragDropTypes::DRAG_MOVE)
- return ui::GetAtom(kXdndActionMove);
+ return gfx::GetAtom(kXdndActionMove);
if (drag_operation & ui::DragDropTypes::DRAG_LINK)
- return ui::GetAtom(kXdndActionLink);
+ return gfx::GetAtom(kXdndActionLink);
return None;
}
ui::DragDropTypes::DragOperation
DesktopDragDropClientAuraX11::AtomToDragOperation(::Atom atom) {
- if (atom == ui::GetAtom(kXdndActionCopy))
+ if (atom == gfx::GetAtom(kXdndActionCopy))
return ui::DragDropTypes::DRAG_COPY;
- if (atom == ui::GetAtom(kXdndActionMove))
+ if (atom == gfx::GetAtom(kXdndActionMove))
return ui::DragDropTypes::DRAG_MOVE;
- if (atom == ui::GetAtom(kXdndActionLink))
+ if (atom == gfx::GetAtom(kXdndActionLink))
return ui::DragDropTypes::DRAG_LINK;
return ui::DragDropTypes::DRAG_NONE;
@@ -1139,11 +1137,11 @@
std::vector<::Atom> DesktopDragDropClientAuraX11::GetOfferedDragOperations() {
std::vector<::Atom> operations;
if (drag_operation_ & ui::DragDropTypes::DRAG_COPY)
- operations.push_back(ui::GetAtom(kXdndActionCopy));
+ operations.push_back(gfx::GetAtom(kXdndActionCopy));
if (drag_operation_ & ui::DragDropTypes::DRAG_MOVE)
- operations.push_back(ui::GetAtom(kXdndActionMove));
+ operations.push_back(gfx::GetAtom(kXdndActionMove));
if (drag_operation_ & ui::DragDropTypes::DRAG_LINK)
- operations.push_back(ui::GetAtom(kXdndActionLink));
+ operations.push_back(gfx::GetAtom(kXdndActionLink));
return operations;
}
@@ -1171,7 +1169,7 @@
// sets this nor respects it if set.
XEvent xev;
xev.xclient.type = ClientMessage;
- xev.xclient.message_type = ui::GetAtom(kXdndStatus);
+ xev.xclient.message_type = gfx::GetAtom(kXdndStatus);
xev.xclient.format = 32;
xev.xclient.window = source_window;
xev.xclient.data.l[0] = xwindow_;
@@ -1187,7 +1185,7 @@
void DesktopDragDropClientAuraX11::SendXdndEnter(::Window dest_window) {
XEvent xev;
xev.xclient.type = ClientMessage;
- xev.xclient.message_type = ui::GetAtom(kXdndEnter);
+ xev.xclient.message_type = gfx::GetAtom(kXdndEnter);
xev.xclient.format = 32;
xev.xclient.window = dest_window;
xev.xclient.data.l[0] = xwindow_;
@@ -1214,7 +1212,7 @@
void DesktopDragDropClientAuraX11::SendXdndLeave(::Window dest_window) {
XEvent xev;
xev.xclient.type = ClientMessage;
- xev.xclient.message_type = ui::GetAtom(kXdndLeave);
+ xev.xclient.message_type = gfx::GetAtom(kXdndLeave);
xev.xclient.format = 32;
xev.xclient.window = dest_window;
xev.xclient.data.l[0] = xwindow_;
@@ -1233,7 +1231,7 @@
XEvent xev;
xev.xclient.type = ClientMessage;
- xev.xclient.message_type = ui::GetAtom(kXdndPosition);
+ xev.xclient.message_type = gfx::GetAtom(kXdndPosition);
xev.xclient.format = 32;
xev.xclient.window = dest_window;
xev.xclient.data.l[0] = xwindow_;
@@ -1258,7 +1256,7 @@
void DesktopDragDropClientAuraX11::SendXdndDrop(::Window dest_window) {
XEvent xev;
xev.xclient.type = ClientMessage;
- xev.xclient.message_type = ui::GetAtom(kXdndDrop);
+ xev.xclient.message_type = gfx::GetAtom(kXdndDrop);
xev.xclient.format = 32;
xev.xclient.window = dest_window;
xev.xclient.data.l[0] = xwindow_;
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc
index 862d806..b2ee3f926a 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc
@@ -24,6 +24,7 @@
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/x/x11_util.h"
#include "ui/events/event_utils.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/x11_types.h"
#include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h"
#include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h"
@@ -301,7 +302,7 @@
}
Atom TestDragDropClient::GetAtom(const char* name) {
- return ui::GetAtom(name);
+ return gfx::GetAtom(name);
}
bool TestDragDropClient::MessageHasType(const XClientMessageEvent& event,
diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
index 17145e38..d7b8a33 100644
--- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc
@@ -27,6 +27,7 @@
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/native_widget_types.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/x11_types.h"
#include "ui/views/linux_ui/linux_ui.h"
#include "ui/views/widget/desktop_aura/desktop_screen.h"
@@ -235,7 +236,7 @@
event->type - xrandr_event_base_ == RRNotify ||
(event->type == PropertyNotify &&
event->xproperty.window == x_root_window_ &&
- event->xproperty.atom == ui::GetAtom("_NET_WORKAREA"));
+ event->xproperty.atom == gfx::GetAtom("_NET_WORKAREA"));
}
uint32_t DesktopScreenX11::DispatchEvent(const ui::PlatformEvent& event) {
@@ -244,7 +245,7 @@
XRRUpdateConfiguration(event);
} else if (event->type - xrandr_event_base_ == RRNotify ||
(event->type == PropertyNotify &&
- event->xproperty.atom == ui::GetAtom("_NET_WORKAREA"))) {
+ event->xproperty.atom == gfx::GetAtom("_NET_WORKAREA"))) {
// There's some sort of observer dispatch going on here, but I don't think
// it's the screen's?
if (configure_timer_.get() && configure_timer_->IsRunning()) {
diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc b/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc
index 15d8bd4..25c923b 100644
--- a/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc
+++ b/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc
@@ -15,10 +15,10 @@
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/hit_test.h"
-#include "ui/base/x/x11_util.h"
#include "ui/display/display_observer.h"
#include "ui/events/test/event_generator.h"
#include "ui/gfx/font_render_params.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/x11_types.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
@@ -304,7 +304,7 @@
// Tests that the window is maximized in response to a double click event.
TEST_F(DesktopScreenX11Test, DoubleClickHeaderMaximizes) {
- if (!ui::WmSupportsHint(ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT")))
+ if (!ui::WmSupportsHint(gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT")))
return;
Widget* widget = BuildTopLevelDesktopWidget(gfx::Rect(0, 0, 100, 100), true);
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index aacca36c..1414ba2 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -48,6 +48,7 @@
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/path.h"
#include "ui/gfx/path_x11.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/views/corewm/tooltip_aura.h"
#include "ui/views/linux_ui/linux_ui.h"
#include "ui/views/views_delegate.h"
@@ -731,7 +732,7 @@
// https://code.google.com/p/wmii/issues/detail?id=266
static bool wm_supports_active_window =
ui::GuessWindowManager() != ui::WM_WMII &&
- ui::WmSupportsHint(ui::GetAtom("_NET_ACTIVE_WINDOW"));
+ ui::WmSupportsHint(gfx::GetAtom("_NET_ACTIVE_WINDOW"));
Time timestamp = ui::X11EventSource::GetInstance()->GetTimestamp();
@@ -740,7 +741,7 @@
memset(&xclient, 0, sizeof(xclient));
xclient.type = ClientMessage;
xclient.xclient.window = xwindow_;
- xclient.xclient.message_type = ui::GetAtom("_NET_ACTIVE_WINDOW");
+ xclient.xclient.message_type = gfx::GetAtom("_NET_ACTIVE_WINDOW");
xclient.xclient.format = 32;
xclient.xclient.data.l[0] = 1; // Specified we are an app.
xclient.xclient.data.l[1] = timestamp;
@@ -797,7 +798,7 @@
void DesktopWindowTreeHostX11::Maximize() {
if (HasWMSpecProperty("_NET_WM_STATE_FULLSCREEN")) {
// Unfullscreen the window if it is fullscreen.
- SetWMSpecState(false, ui::GetAtom("_NET_WM_STATE_FULLSCREEN"), None);
+ SetWMSpecState(false, gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"), None);
// Resize the window so that it does not have the same size as a monitor.
// (Otherwise, some window managers immediately put the window back in
@@ -817,8 +818,8 @@
// heuristics that are in the PropertyNotify and ConfigureNotify handlers.
restored_bounds_in_pixels_ = bounds_in_pixels_;
- SetWMSpecState(true, ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"),
- ui::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ"));
+ SetWMSpecState(true, gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"),
+ gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ"));
if (IsMinimized())
ShowWindowWithState(ui::SHOW_STATE_NORMAL);
}
@@ -830,8 +831,8 @@
void DesktopWindowTreeHostX11::Restore() {
should_maximize_after_map_ = false;
- SetWMSpecState(false, ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"),
- ui::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ"));
+ SetWMSpecState(false, gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"),
+ gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ"));
if (IsMinimized())
ShowWindowWithState(ui::SHOW_STATE_NORMAL);
}
@@ -851,7 +852,7 @@
void DesktopWindowTreeHostX11::SetAlwaysOnTop(bool always_on_top) {
is_always_on_top_ = always_on_top;
- SetWMSpecState(always_on_top, ui::GetAtom("_NET_WM_STATE_ABOVE"), None);
+ SetWMSpecState(always_on_top, gfx::GetAtom("_NET_WM_STATE_ABOVE"), None);
}
bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const {
@@ -859,7 +860,7 @@
}
void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) {
- SetWMSpecState(always_visible, ui::GetAtom("_NET_WM_STATE_STICKY"), None);
+ SetWMSpecState(always_visible, gfx::GetAtom("_NET_WM_STATE_STICKY"), None);
int new_desktop = 0;
if (always_visible) {
@@ -874,7 +875,7 @@
memset (&xevent, 0, sizeof (xevent));
xevent.type = ClientMessage;
xevent.xclient.window = xwindow_;
- xevent.xclient.message_type = ui::GetAtom("_NET_WM_DESKTOP");
+ xevent.xclient.message_type = gfx::GetAtom("_NET_WM_DESKTOP");
xevent.xclient.format = 32;
xevent.xclient.data.l[0] = new_desktop;
xevent.xclient.data.l[1] = 0;
@@ -899,8 +900,8 @@
return false;
window_title_ = title;
std::string utf8str = base::UTF16ToUTF8(title);
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_NAME"),
- ui::GetAtom("UTF8_STRING"), 8, PropModeReplace,
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_NAME"),
+ gfx::GetAtom("UTF8_STRING"), 8, PropModeReplace,
reinterpret_cast<const unsigned char*>(utf8str.c_str()),
utf8str.size());
XTextProperty xtp;
@@ -997,7 +998,7 @@
if (unmaximize_and_remaximize)
Restore();
- SetWMSpecState(fullscreen, ui::GetAtom("_NET_WM_STATE_FULLSCREEN"), None);
+ SetWMSpecState(fullscreen, gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"), None);
if (unmaximize_and_remaximize)
Maximize();
@@ -1042,9 +1043,10 @@
unsigned long cardinality = opacity_8bit * channel_multiplier;
if (cardinality == 0xffffffff) {
- XDeleteProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_OPACITY"));
+ XDeleteProperty(xdisplay_, xwindow_,
+ gfx::GetAtom("_NET_WM_WINDOW_OPACITY"));
} else {
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_OPACITY"),
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_WINDOW_OPACITY"),
XA_CARDINAL, 32, PropModeReplace,
reinterpret_cast<unsigned char*>(&cardinality), 1);
}
@@ -1302,22 +1304,22 @@
switch (params.type) {
case Widget::InitParams::TYPE_MENU:
swa.override_redirect = True;
- window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_MENU");
+ window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_MENU");
break;
case Widget::InitParams::TYPE_TOOLTIP:
swa.override_redirect = True;
- window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_TOOLTIP");
+ window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_TOOLTIP");
break;
case Widget::InitParams::TYPE_POPUP:
swa.override_redirect = True;
- window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_NOTIFICATION");
+ window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_NOTIFICATION");
break;
case Widget::InitParams::TYPE_DRAG:
swa.override_redirect = True;
- window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_DND");
+ window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_DND");
break;
default:
- window_type = ui::GetAtom("_NET_WM_WINDOW_TYPE_NORMAL");
+ window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_NORMAL");
break;
}
// An in-activatable window should not interact with the system wm.
@@ -1386,8 +1388,8 @@
// should listen for activation events and anything else that GTK+ listens
// for, and do something useful.
::Atom protocols[2];
- protocols[0] = ui::GetAtom("WM_DELETE_WINDOW");
- protocols[1] = ui::GetAtom("_NET_WM_PING");
+ protocols[0] = gfx::GetAtom("WM_DELETE_WINDOW");
+ protocols[1] = gfx::GetAtom("_NET_WM_PING");
XSetWMProtocols(xdisplay_, xwindow_, protocols, 2);
// We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with
@@ -1400,11 +1402,11 @@
static_assert(sizeof(long) >= sizeof(pid_t),
"pid_t should not be larger than long");
long pid = getpid();
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_PID"), XA_CARDINAL,
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_PID"), XA_CARDINAL,
32, PropModeReplace, reinterpret_cast<unsigned char*>(&pid),
1);
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_WINDOW_TYPE"),
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_WINDOW_TYPE"),
XA_ATOM, 32, PropModeReplace,
reinterpret_cast<unsigned char*>(&window_type), 1);
@@ -1415,18 +1417,18 @@
if ((params.type == Widget::InitParams::TYPE_POPUP ||
params.type == Widget::InitParams::TYPE_BUBBLE) &&
!params.force_show_in_taskbar) {
- state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
+ state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
}
// If the window should stay on top of other windows, add the
// _NET_WM_STATE_ABOVE property.
is_always_on_top_ = params.keep_on_top;
if (is_always_on_top_)
- state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_ABOVE"));
+ state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_ABOVE"));
workspace_.clear();
if (params.visible_on_all_workspaces) {
- state_atom_list.push_back(ui::GetAtom("_NET_WM_STATE_STICKY"));
+ state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_STICKY"));
ui::SetIntProperty(xwindow_, "_NET_WM_DESKTOP", "CARDINAL", kAllDesktops);
} else if (!params.workspace.empty()) {
int workspace;
@@ -1521,7 +1523,7 @@
void DesktopWindowTreeHostX11::OnWMStateUpdated() {
std::vector< ::Atom> atom_list;
- // Ignore the return value of ui::GetAtomArrayProperty(). Fluxbox removes the
+ // Ignore the return value of gfx::GetAtomArrayProperty(). Fluxbox removes the
// _NET_WM_STATE property when no _NET_WM_STATE atoms are set.
ui::GetAtomArrayProperty(xwindow_, "_NET_WM_STATE", &atom_list);
@@ -1643,7 +1645,7 @@
type == ui::ET_TOUCH_PRESSED) {
unsigned long wm_user_time_ms = static_cast<unsigned long>(
(ui::EventTimeFromNative(event) - base::TimeTicks()).InMilliseconds());
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_USER_TIME"),
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_USER_TIME"),
XA_CARDINAL, 32, PropModeReplace,
reinterpret_cast<const unsigned char*>(&wm_user_time_ms),
1);
@@ -1657,7 +1659,7 @@
memset(&xclient, 0, sizeof(xclient));
xclient.type = ClientMessage;
xclient.xclient.window = xwindow_;
- xclient.xclient.message_type = ui::GetAtom("_NET_WM_STATE");
+ xclient.xclient.message_type = gfx::GetAtom("_NET_WM_STATE");
xclient.xclient.format = 32;
xclient.xclient.data.l[0] =
enabled ? k_NET_WM_STATE_ADD : k_NET_WM_STATE_REMOVE;
@@ -1672,7 +1674,7 @@
}
bool DesktopWindowTreeHostX11::HasWMSpecProperty(const char* property) const {
- return window_properties_.find(ui::GetAtom(property)) !=
+ return window_properties_.find(gfx::GetAtom(property)) !=
window_properties_.end();
}
@@ -1853,7 +1855,7 @@
? 0
: ui::X11EventSource::GetInstance()->GetTimestamp();
if (show_state == ui::SHOW_STATE_INACTIVE || wm_user_time_ms != 0) {
- XChangeProperty(xdisplay_, xwindow_, ui::GetAtom("_NET_WM_USER_TIME"),
+ XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom("_NET_WM_USER_TIME"),
XA_CARDINAL, 32, PropModeReplace,
reinterpret_cast<const unsigned char*>(&wm_user_time_ms),
1);
@@ -2114,12 +2116,12 @@
}
case ClientMessage: {
Atom message_type = xev->xclient.message_type;
- if (message_type == ui::GetAtom("WM_PROTOCOLS")) {
+ if (message_type == gfx::GetAtom("WM_PROTOCOLS")) {
Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]);
- if (protocol == ui::GetAtom("WM_DELETE_WINDOW")) {
+ if (protocol == gfx::GetAtom("WM_DELETE_WINDOW")) {
// We have received a close message from the window manager.
OnHostCloseRequested();
- } else if (protocol == ui::GetAtom("_NET_WM_PING")) {
+ } else if (protocol == gfx::GetAtom("_NET_WM_PING")) {
XEvent reply_event = *xev;
reply_event.xclient.window = x_root_window_;
@@ -2129,17 +2131,17 @@
SubstructureRedirectMask | SubstructureNotifyMask,
&reply_event);
}
- } else if (message_type == ui::GetAtom("XdndEnter")) {
+ } else if (message_type == gfx::GetAtom("XdndEnter")) {
drag_drop_client_->OnXdndEnter(xev->xclient);
- } else if (message_type == ui::GetAtom("XdndLeave")) {
+ } else if (message_type == gfx::GetAtom("XdndLeave")) {
drag_drop_client_->OnXdndLeave(xev->xclient);
- } else if (message_type == ui::GetAtom("XdndPosition")) {
+ } else if (message_type == gfx::GetAtom("XdndPosition")) {
drag_drop_client_->OnXdndPosition(xev->xclient);
- } else if (message_type == ui::GetAtom("XdndStatus")) {
+ } else if (message_type == gfx::GetAtom("XdndStatus")) {
drag_drop_client_->OnXdndStatus(xev->xclient);
- } else if (message_type == ui::GetAtom("XdndFinished")) {
+ } else if (message_type == gfx::GetAtom("XdndFinished")) {
drag_drop_client_->OnXdndFinished(xev->xclient);
- } else if (message_type == ui::GetAtom("XdndDrop")) {
+ } else if (message_type == gfx::GetAtom("XdndDrop")) {
drag_drop_client_->OnXdndDrop(xev->xclient);
}
break;
@@ -2183,11 +2185,11 @@
}
case PropertyNotify: {
::Atom changed_atom = xev->xproperty.atom;
- if (changed_atom == ui::GetAtom("_NET_WM_STATE")) {
+ if (changed_atom == gfx::GetAtom("_NET_WM_STATE")) {
OnWMStateUpdated();
- } else if (changed_atom == ui::GetAtom("_NET_FRAME_EXTENTS")) {
+ } else if (changed_atom == gfx::GetAtom("_NET_FRAME_EXTENTS")) {
OnFrameExtentsUpdated();
- } else if (changed_atom == ui::GetAtom("_NET_WM_DESKTOP")) {
+ } else if (changed_atom == gfx::GetAtom("_NET_WM_DESKTOP")) {
if (UpdateWorkspace())
OnHostWorkspaceChanged();
}
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc
index f071e756..612b41f5 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc
@@ -31,6 +31,7 @@
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/path.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/test/x11_property_change_waiter.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
@@ -59,7 +60,7 @@
bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override {
std::vector<Atom> hints;
if (ui::GetAtomArrayProperty(xwindow(), "_NET_WM_STATE", &hints)) {
- auto it = std::find(hints.cbegin(), hints.cend(), ui::GetAtom(hint_));
+ auto it = std::find(hints.cbegin(), hints.cend(), gfx::GetAtom(hint_));
bool hint_set = (it != hints.cend());
return hint_set != wait_till_set_;
}
@@ -238,7 +239,7 @@
EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 205, 15));
}
- if (ui::WmSupportsHint(ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"))) {
+ if (ui::WmSupportsHint(gfx::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"))) {
// The shape should be changed to a rectangle which fills the entire screen
// when |widget1| is maximized.
{
@@ -315,7 +316,7 @@
// Test that the widget ignores changes in fullscreen state initiated by the
// window manager (e.g. via a window manager accelerator key).
TEST_F(DesktopWindowTreeHostX11Test, WindowManagerTogglesFullscreen) {
- if (!ui::WmSupportsHint(ui::GetAtom("_NET_WM_STATE_FULLSCREEN")))
+ if (!ui::WmSupportsHint(gfx::GetAtom("_NET_WM_STATE_FULLSCREEN")))
return;
std::unique_ptr<Widget> widget = CreateWidget(new ShapedWidgetDelegate());
@@ -340,10 +341,10 @@
memset(&xclient, 0, sizeof(xclient));
xclient.type = ClientMessage;
xclient.xclient.window = xid;
- xclient.xclient.message_type = ui::GetAtom("_NET_WM_STATE");
+ xclient.xclient.message_type = gfx::GetAtom("_NET_WM_STATE");
xclient.xclient.format = 32;
xclient.xclient.data.l[0] = 0;
- xclient.xclient.data.l[1] = ui::GetAtom("_NET_WM_STATE_FULLSCREEN");
+ xclient.xclient.data.l[1] = gfx::GetAtom("_NET_WM_STATE_FULLSCREEN");
xclient.xclient.data.l[2] = 0;
xclient.xclient.data.l[3] = 1;
xclient.xclient.data.l[4] = 0;
@@ -380,7 +381,7 @@
// Minimize by sending _NET_WM_STATE_HIDDEN
{
std::vector< ::Atom> atom_list;
- atom_list.push_back(ui::GetAtom("_NET_WM_STATE_HIDDEN"));
+ atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_HIDDEN"));
ui::SetAtomArrayProperty(xid, "_NET_WM_STATE", "ATOM", atom_list);
XEvent xevent;
@@ -390,7 +391,7 @@
xevent.xproperty.send_event = 1;
xevent.xproperty.display = display;
xevent.xproperty.window = xid;
- xevent.xproperty.atom = ui::GetAtom("_NET_WM_STATE");
+ xevent.xproperty.atom = gfx::GetAtom("_NET_WM_STATE");
xevent.xproperty.state = 0;
XSendEvent(display, DefaultRootWindow(display), False,
SubstructureRedirectMask | SubstructureNotifyMask,
@@ -404,7 +405,7 @@
// Show from minimized by sending _NET_WM_STATE_FOCUSED
{
std::vector< ::Atom> atom_list;
- atom_list.push_back(ui::GetAtom("_NET_WM_STATE_FOCUSED"));
+ atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_FOCUSED"));
ui::SetAtomArrayProperty(xid, "_NET_WM_STATE", "ATOM", atom_list);
XEvent xevent;
@@ -414,7 +415,7 @@
xevent.xproperty.send_event = 1;
xevent.xproperty.display = display;
xevent.xproperty.window = xid;
- xevent.xproperty.atom = ui::GetAtom("_NET_WM_STATE");
+ xevent.xproperty.atom = gfx::GetAtom("_NET_WM_STATE");
xevent.xproperty.state = 0;
XSendEvent(display, DefaultRootWindow(display), False,
SubstructureRedirectMask | SubstructureNotifyMask,
diff --git a/ui/views/widget/desktop_aura/x11_desktop_handler.cc b/ui/views/widget/desktop_aura/x11_desktop_handler.cc
index 3ee269bb..f5e7f20 100644
--- a/ui/views/widget/desktop_aura/x11_desktop_handler.cc
+++ b/ui/views/widget/desktop_aura/x11_desktop_handler.cc
@@ -12,9 +12,9 @@
#include "ui/aura/env.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/x/x11_menu_list.h"
-#include "ui/base/x/x11_util.h"
#include "ui/base/x/x11_window_event_manager.h"
#include "ui/events/platform/platform_event_source.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/x11_error_tracker.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
@@ -90,7 +90,7 @@
uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) {
switch (event->type) {
case PropertyNotify: {
- if (event->xproperty.atom == ui::GetAtom("_NET_CURRENT_DESKTOP")) {
+ if (event->xproperty.atom == gfx::GetAtom("_NET_CURRENT_DESKTOP")) {
if (UpdateWorkspace()) {
for (views::X11DesktopHandlerObserver& observer : observers_)
observer.OnWorkspaceChanged(workspace_);
diff --git a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
index 35509301..d94a8789 100644
--- a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
+++ b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
@@ -26,6 +26,7 @@
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/path.h"
#include "ui/gfx/path_x11.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/views/test/views_interactive_ui_test_base.h"
#include "ui/views/test/x11_property_change_waiter.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
@@ -50,7 +51,7 @@
std::vector<Atom> wm_states;
if (ui::GetAtomArrayProperty(xwindow(), "_NET_WM_STATE", &wm_states)) {
auto it = std::find(wm_states.cbegin(), wm_states.cend(),
- ui::GetAtom("_NET_WM_STATE_HIDDEN"));
+ gfx::GetAtom("_NET_WM_STATE_HIDDEN"));
return it == wm_states.cend();
}
return true;
@@ -395,7 +396,7 @@
&swa);
{
ui::SetAtomProperty(menu_xid, "_NET_WM_WINDOW_TYPE", "ATOM",
- ui::GetAtom("_NET_WM_WINDOW_TYPE_MENU"));
+ gfx::GetAtom("_NET_WM_WINDOW_TYPE_MENU"));
}
ui::SetUseOSWindowFrame(menu_xid, false);
ShowAndSetXWindowBounds(menu_xid, gfx::Rect(140, 110, 100, 100));
diff --git a/ui/views/widget/desktop_aura/x11_window_event_filter.cc b/ui/views/widget/desktop_aura/x11_window_event_filter.cc
index b1bee28..5e01cd6 100644
--- a/ui/views/widget/desktop_aura/x11_window_event_filter.cc
+++ b/ui/views/widget/desktop_aura/x11_window_event_filter.cc
@@ -15,11 +15,11 @@
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/hit_test.h"
-#include "ui/base/x/x11_util.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
+#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/x11_types.h"
#include "ui/views/linux_ui/linux_ui.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host.h"
@@ -220,7 +220,7 @@
event.xclient.type = ClientMessage;
event.xclient.display = xdisplay_;
event.xclient.window = xwindow_;
- event.xclient.message_type = ui::GetAtom("_NET_WM_MOVERESIZE");
+ event.xclient.message_type = gfx::GetAtom("_NET_WM_MOVERESIZE");
event.xclient.format = 32;
event.xclient.data.l[0] = screen_location.x();
event.xclient.data.l[1] = screen_location.y();