Make castv2 performance test work.
[chromium-blink-merge.git] / ui / views / widget / desktop_aura / desktop_cursor_loader_updater_auralinux.cc
blobfc16eaaf80ca9d22927b60daa5ab344416a8b3e1
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater_auralinux.h"
7 #include "ui/aura/window_event_dispatcher.h"
8 #include "ui/base/cursor/cursor_loader.h"
9 #include "ui/base/cursor/cursors_aura.h"
10 #include "ui/gfx/display.h"
12 namespace views {
13 namespace {
15 // Cursors that we need to supply our own image resources for. This was
16 // generated from webcursor_gtk.cc; any cursor that either was NOTIMPLEMENTED()
17 // or already was implemented with a pixmap is on this list.
18 const int kImageCursorIds[] = {
19 ui::kCursorNorthEastSouthWestResize,
20 ui::kCursorNorthWestSouthEastResize,
21 ui::kCursorVerticalText,
22 ui::kCursorCell,
23 ui::kCursorContextMenu,
24 ui::kCursorAlias,
25 ui::kCursorNoDrop,
26 ui::kCursorCopy,
27 ui::kCursorNotAllowed,
28 ui::kCursorZoomIn,
29 ui::kCursorZoomOut,
30 ui::kCursorGrab,
31 ui::kCursorGrabbing,
34 void LoadImageCursors(float device_scale_factor, ui::CursorLoader* loader) {
35 int resource_id;
36 gfx::Point point;
37 for (size_t i = 0; i < arraysize(kImageCursorIds); ++i) {
38 bool success = ui::GetCursorDataFor(
39 ui::CURSOR_SET_NORMAL, // Not support custom cursor set.
40 kImageCursorIds[i],
41 device_scale_factor,
42 &resource_id,
43 &point);
44 DCHECK(success);
45 loader->LoadImageCursor(kImageCursorIds[i], resource_id, point);
49 } // namespace
51 DesktopCursorLoaderUpdaterAuraLinux::DesktopCursorLoaderUpdaterAuraLinux() {}
53 DesktopCursorLoaderUpdaterAuraLinux::~DesktopCursorLoaderUpdaterAuraLinux() {}
55 void DesktopCursorLoaderUpdaterAuraLinux::OnCreate(
56 float device_scale_factor,
57 ui::CursorLoader* loader) {
58 LoadImageCursors(device_scale_factor, loader);
61 void DesktopCursorLoaderUpdaterAuraLinux::OnDisplayUpdated(
62 const gfx::Display& display,
63 ui::CursorLoader* loader) {
64 LoadImageCursors(display.device_scale_factor(), loader);
67 // static
68 scoped_ptr<DesktopCursorLoaderUpdater> DesktopCursorLoaderUpdater::Create() {
69 return make_scoped_ptr(new DesktopCursorLoaderUpdaterAuraLinux);
72 } // namespace views