Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc

Issue 2924343002: Move ui::GetAtom to gfx::GetAtom (Closed)
Patch Set: fix CrOs build Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
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 175ae236bad7fd206573cd06e286cf1c5910afb7..d53d9c72cc6bb3d3a1df672b1d856c7ee5b11cdd 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 @@ DesktopDragDropClientAuraX11::X11DragContext::X11DragContext(
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 @@ void DesktopDragDropClientAuraX11::X11DragContext::RequestNextTarget() {
::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 @@ void DesktopDragDropClientAuraX11::X11DragContext::OnSelectionNotify(
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::OnSelectionNotify(
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 @@ int DesktopDragDropClientAuraX11::X11DragContext::GetDragOperation() const {
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 @@ bool DesktopDragDropClientAuraX11::X11DragContext::CanDispatchEvent(
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 @@ DesktopDragDropClientAuraX11::DesktopDragDropClientAuraX11(
// 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 @@ void DesktopDragDropClientAuraX11::OnXdndDrop(
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 @@ int DesktopDragDropClientAuraX11::StartDragAndDrop(
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 @@ int DesktopDragDropClientAuraX11::StartDragAndDrop(
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 @@ void DesktopDragDropClientAuraX11::SendXClientEvent(::Window xid,
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 @@ void DesktopDragDropClientAuraX11::NotifyDragLeave() {
::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 @@ DesktopDragDropClientAuraX11::AtomToDragOperation(::Atom atom) {
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 @@ void DesktopDragDropClientAuraX11::CompleteXdndPosition(
// 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::CompleteXdndPosition(
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::SendXdndEnter(::Window dest_window) {
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 @@ void DesktopDragDropClientAuraX11::SendXdndPosition(
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::SendXdndPosition(
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_;
« no previous file with comments | « ui/views/test/x11_property_change_waiter.cc ('k') | ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698