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" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 CursorType::kNorthWestSouthEastResize, | 53 CursorType::kNorthWestSouthEastResize, |
54 CursorType::kGrab, | 54 CursorType::kGrab, |
55 CursorType::kGrabbing, | 55 CursorType::kGrabbing, |
56 }; | 56 }; |
57 | 57 |
58 const CursorType kAnimatedCursorIds[] = {CursorType::kWait, | 58 const CursorType kAnimatedCursorIds[] = {CursorType::kWait, |
59 CursorType::kProgress}; | 59 CursorType::kProgress}; |
60 | 60 |
61 } // namespace | 61 } // namespace |
62 | 62 |
63 ImageCursors::ImageCursors() : cursor_set_(CURSOR_SET_NORMAL) { | 63 ImageCursors::ImageCursors() : cursor_set_(CursorSet::kNormal) {} |
64 } | |
65 | 64 |
66 ImageCursors::~ImageCursors() { | 65 ImageCursors::~ImageCursors() { |
67 } | 66 } |
68 | 67 |
69 float ImageCursors::GetScale() const { | 68 float ImageCursors::GetScale() const { |
70 if (!cursor_loader_) { | 69 if (!cursor_loader_) { |
71 NOTREACHED(); | 70 NOTREACHED(); |
72 // Returning default on release build as it's not serious enough to crash | 71 // Returning default on release build as it's not serious enough to crash |
73 // even if this ever happens. | 72 // even if this ever happens. |
74 return 1.0f; | 73 return 1.0f; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 &resource_id, | 125 &resource_id, |
127 &hot_point); | 126 &hot_point); |
128 DCHECK(success); | 127 DCHECK(success); |
129 cursor_loader_->LoadAnimatedCursor(kAnimatedCursorIds[i], | 128 cursor_loader_->LoadAnimatedCursor(kAnimatedCursorIds[i], |
130 resource_id, | 129 resource_id, |
131 hot_point, | 130 hot_point, |
132 kAnimatedCursorFrameDelayMs); | 131 kAnimatedCursorFrameDelayMs); |
133 } | 132 } |
134 } | 133 } |
135 | 134 |
136 void ImageCursors::SetCursorSet(CursorSetType cursor_set) { | 135 void ImageCursors::SetCursorSet(CursorSet cursor_set) { |
137 if (cursor_set_ == cursor_set) | 136 if (cursor_set_ == cursor_set) |
138 return; | 137 return; |
139 | 138 |
140 cursor_set_ = cursor_set; | 139 cursor_set_ = cursor_set; |
141 | 140 |
142 if (cursor_loader_.get()) | 141 if (cursor_loader_.get()) |
143 ReloadCursors(); | 142 ReloadCursors(); |
144 } | 143 } |
145 | 144 |
146 void ImageCursors::SetPlatformCursor(gfx::NativeCursor* cursor) { | 145 void ImageCursors::SetPlatformCursor(gfx::NativeCursor* cursor) { |
147 cursor_loader_->SetPlatformCursor(cursor); | 146 cursor_loader_->SetPlatformCursor(cursor); |
148 } | 147 } |
149 | 148 |
150 } // namespace ui | 149 } // namespace ui |
OLD | NEW |