| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/base/cursor/image_cursors.h" | 5 #include "ui/base/cursor/image_cursors.h" |
| 6 | 6 |
| 7 #include <float.h> | 7 #include <float.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "ui/base/cursor/cursor.h" | 13 #include "ui/base/cursor/cursor.h" |
| 14 #include "ui/base/cursor/cursor_loader.h" | 14 #include "ui/base/cursor/cursor_loader.h" |
| 15 #include "ui/base/cursor/cursors_aura.h" | 15 #include "ui/base/cursor/cursors_aura.h" |
| 16 #include "ui/gfx/display.h" | 16 #include "ui/display/display.h" |
| 17 #include "ui/gfx/geometry/point.h" | 17 #include "ui/gfx/geometry/point.h" |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 const int kImageCursorIds[] = { | 23 const int kImageCursorIds[] = { |
| 24 kCursorNull, | 24 kCursorNull, |
| 25 kCursorPointer, | 25 kCursorPointer, |
| 26 kCursorNoDrop, | 26 kCursorNoDrop, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 float ImageCursors::GetScale() const { | 71 float ImageCursors::GetScale() const { |
| 72 if (!cursor_loader_) { | 72 if (!cursor_loader_) { |
| 73 NOTREACHED(); | 73 NOTREACHED(); |
| 74 // Returning default on release build as it's not serious enough to crash | 74 // Returning default on release build as it's not serious enough to crash |
| 75 // even if this ever happens. | 75 // even if this ever happens. |
| 76 return 1.0f; | 76 return 1.0f; |
| 77 } | 77 } |
| 78 return cursor_loader_->scale(); | 78 return cursor_loader_->scale(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 gfx::Display::Rotation ImageCursors::GetRotation() const { | 81 display::Display::Rotation ImageCursors::GetRotation() const { |
| 82 if (!cursor_loader_) { | 82 if (!cursor_loader_) { |
| 83 NOTREACHED(); | 83 NOTREACHED(); |
| 84 // Returning default on release build as it's not serious enough to crash | 84 // Returning default on release build as it's not serious enough to crash |
| 85 // even if this ever happens. | 85 // even if this ever happens. |
| 86 return gfx::Display::ROTATE_0; | 86 return display::Display::ROTATE_0; |
| 87 } | 87 } |
| 88 return cursor_loader_->rotation(); | 88 return cursor_loader_->rotation(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool ImageCursors::SetDisplay(const gfx::Display& display, | 91 bool ImageCursors::SetDisplay(const display::Display& display, |
| 92 float scale_factor) { | 92 float scale_factor) { |
| 93 if (!cursor_loader_) { | 93 if (!cursor_loader_) { |
| 94 cursor_loader_.reset(CursorLoader::Create()); | 94 cursor_loader_.reset(CursorLoader::Create()); |
| 95 } else if (cursor_loader_->rotation() == display.rotation() && | 95 } else if (cursor_loader_->rotation() == display.rotation() && |
| 96 cursor_loader_->scale() == scale_factor) { | 96 cursor_loader_->scale() == scale_factor) { |
| 97 return false; | 97 return false; |
| 98 } | 98 } |
| 99 | 99 |
| 100 cursor_loader_->set_rotation(display.rotation()); | 100 cursor_loader_->set_rotation(display.rotation()); |
| 101 cursor_loader_->set_scale(scale_factor); | 101 cursor_loader_->set_scale(scale_factor); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 if (cursor_loader_.get()) | 144 if (cursor_loader_.get()) |
| 145 ReloadCursors(); | 145 ReloadCursors(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void ImageCursors::SetPlatformCursor(gfx::NativeCursor* cursor) { | 148 void ImageCursors::SetPlatformCursor(gfx::NativeCursor* cursor) { |
| 149 cursor_loader_->SetPlatformCursor(cursor); | 149 cursor_loader_->SetPlatformCursor(cursor); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace ui | 152 } // namespace ui |
| OLD | NEW |