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

Side by Side Diff: ui/base/cursor/cursor.cc

Issue 10919135: Move ash specific cursor code to CursorManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests and rebase Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
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/base/cursor/cursor.h" 5 #include "ui/base/cursor/cursor.h"
6 6
7 namespace ui { 7 namespace ui {
8 8
9 Cursor::Cursor() 9 Cursor::Cursor()
10 : native_type_(0), 10 : native_type_(0),
11 platform_cursor_(0) { 11 platform_cursor_(0),
12 device_scale_factor_(0.0f) {
12 } 13 }
13 14
14 Cursor::Cursor(int type) 15 Cursor::Cursor(int type)
15 : native_type_(type), 16 : native_type_(type),
16 platform_cursor_(0) { 17 platform_cursor_(0),
18 device_scale_factor_(0.0f) {
17 } 19 }
18 20
19 Cursor::Cursor(const Cursor& cursor) 21 Cursor::Cursor(const Cursor& cursor)
20 : native_type_(cursor.native_type_), 22 : native_type_(cursor.native_type_),
21 platform_cursor_(cursor.platform_cursor_) { 23 platform_cursor_(cursor.platform_cursor_),
24 device_scale_factor_(cursor.device_scale_factor_) {
22 if (native_type_ == kCursorCustom) 25 if (native_type_ == kCursorCustom)
23 RefCustomCursor(); 26 RefCustomCursor();
24 } 27 }
25 28
26 Cursor::~Cursor() { 29 Cursor::~Cursor() {
27 if (native_type_ == kCursorCustom) 30 if (native_type_ == kCursorCustom)
28 UnrefCustomCursor(); 31 UnrefCustomCursor();
29 } 32 }
30 33
31 void Cursor::SetPlatformCursor(const PlatformCursor& platform) { 34 void Cursor::SetPlatformCursor(const PlatformCursor& platform) {
32 if (platform_cursor_) 35 if (native_type_ == kCursorCustom)
33 UnrefCustomCursor(); 36 UnrefCustomCursor();
34 native_type_ = kCursorCustom;
sky 2012/09/10 22:49:06 How come you're removing this?
mazda 2012/09/11 00:45:09 Originally the cursor that had non-zero platform_c
35 platform_cursor_ = platform; 37 platform_cursor_ = platform;
36 RefCustomCursor(); 38 if (native_type_ == kCursorCustom)
39 RefCustomCursor();
37 } 40 }
38 41
39 void Cursor::Assign(const Cursor& cursor) { 42 void Cursor::Assign(const Cursor& cursor) {
40 if (*this == cursor) 43 if (*this == cursor)
41 return; 44 return;
42 native_type_ = cursor.native_type_; 45 native_type_ = cursor.native_type_;
43 if (platform_cursor_) 46 if (native_type_ == kCursorCustom)
44 UnrefCustomCursor(); 47 UnrefCustomCursor();
45 platform_cursor_ = cursor.platform_cursor_; 48 platform_cursor_ = cursor.platform_cursor_;
46 if (platform_cursor_) 49 if (native_type_ == kCursorCustom)
47 RefCustomCursor(); 50 RefCustomCursor();
51 device_scale_factor_ = cursor.device_scale_factor_;
48 } 52 }
49 53
50 } // namespace ui 54 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698