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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc

Issue 1543173002: Switch to standard integer types in ui/views/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" 5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
7 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
8 10
9 #include "base/event_types.h" 11 #include "base/event_types.h"
10 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
12 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "ui/aura/client/capture_client.h" 17 #include "ui/aura/client/capture_client.h"
15 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
16 #include "ui/aura/window_tree_host.h" 19 #include "ui/aura/window_tree_host.h"
17 #include "ui/base/clipboard/clipboard.h" 20 #include "ui/base/clipboard/clipboard.h"
18 #include "ui/base/dragdrop/drop_target_event.h" 21 #include "ui/base/dragdrop/drop_target_event.h"
19 #include "ui/base/dragdrop/os_exchange_data.h" 22 #include "ui/base/dragdrop/os_exchange_data.h"
20 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" 23 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // mouse button before ending the move loop. 117 // mouse button before ending the move loop.
115 const int kEndMoveLoopTimeoutMs = 1000; 118 const int kEndMoveLoopTimeoutMs = 1000;
116 119
117 // The time to wait since sending the last XdndPosition message before 120 // The time to wait since sending the last XdndPosition message before
118 // reprocessing the most recent mouse move event in case that the window 121 // reprocessing the most recent mouse move event in case that the window
119 // stacking order has changed and |source_current_window_| needs to be updated. 122 // stacking order has changed and |source_current_window_| needs to be updated.
120 const int kRepeatMouseMoveTimeoutMs = 350; 123 const int kRepeatMouseMoveTimeoutMs = 350;
121 124
122 // The minimum alpha before we declare a pixel transparent when searching in 125 // The minimum alpha before we declare a pixel transparent when searching in
123 // our source image. 126 // our source image.
124 const uint32 kMinAlpha = 32; 127 const uint32_t kMinAlpha = 32;
125 128
126 // |drag_widget_|'s opacity. 129 // |drag_widget_|'s opacity.
127 const unsigned char kDragWidgetOpacity = 0xc0; 130 const unsigned char kDragWidgetOpacity = 0xc0;
128 131
129 static base::LazyInstance< 132 static base::LazyInstance<
130 std::map< ::Window, views::DesktopDragDropClientAuraX11*> >::Leaky 133 std::map< ::Window, views::DesktopDragDropClientAuraX11*> >::Leaky
131 g_live_client_map = LAZY_INSTANCE_INITIALIZER; 134 g_live_client_map = LAZY_INSTANCE_INITIALIZER;
132 135
133 } // namespace 136 } // namespace
134 137
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 const gfx::ImageSkia& image) { 1209 const gfx::ImageSkia& image) {
1207 if (image.isNull()) 1210 if (image.isNull())
1208 return false; 1211 return false;
1209 1212
1210 // Because we need a GL context per window, we do a quick check so that we 1213 // Because we need a GL context per window, we do a quick check so that we
1211 // don't make another context if the window would just be displaying a mostly 1214 // don't make another context if the window would just be displaying a mostly
1212 // transparent image. 1215 // transparent image.
1213 const SkBitmap* in_bitmap = image.bitmap(); 1216 const SkBitmap* in_bitmap = image.bitmap();
1214 SkAutoLockPixels in_lock(*in_bitmap); 1217 SkAutoLockPixels in_lock(*in_bitmap);
1215 for (int y = 0; y < in_bitmap->height(); ++y) { 1218 for (int y = 0; y < in_bitmap->height(); ++y) {
1216 uint32* in_row = in_bitmap->getAddr32(0, y); 1219 uint32_t* in_row = in_bitmap->getAddr32(0, y);
1217 1220
1218 for (int x = 0; x < in_bitmap->width(); ++x) { 1221 for (int x = 0; x < in_bitmap->width(); ++x) {
1219 if (SkColorGetA(in_row[x]) > kMinAlpha) 1222 if (SkColorGetA(in_row[x]) > kMinAlpha)
1220 return true; 1223 return true;
1221 } 1224 }
1222 } 1225 }
1223 1226
1224 return false; 1227 return false;
1225 } 1228 }
1226 1229
1227 } // namespace views 1230 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698