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 "content/common/cursors/webcursor.h" | 5 #include "content/common/cursors/webcursor.h" |
6 | 6 |
7 #include "third_party/WebKit/public/platform/WebCursorInfo.h" | 7 #include "third_party/WebKit/public/platform/WebCursorInfo.h" |
8 #include "ui/base/cursor/cursor.h" | 8 #include "ui/base/cursor/cursor.h" |
9 #include "ui/base/cursor/cursor_util.h" | 9 #include "ui/base/cursor/cursor_util.h" |
10 #include "ui/ozone/public/cursor_factory_ozone.h" | 10 #include "ui/ozone/public/cursor_factory_ozone.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 void WebCursor::SetDisplayInfo(const gfx::Display& display) { | 28 void WebCursor::SetDisplayInfo(const gfx::Display& display) { |
29 if (rotation_ == display.rotation() && | 29 if (rotation_ == display.rotation() && |
30 device_scale_factor_ == display.device_scale_factor()) | 30 device_scale_factor_ == display.device_scale_factor()) |
31 return; | 31 return; |
32 | 32 |
33 device_scale_factor_ = display.device_scale_factor(); | 33 device_scale_factor_ = display.device_scale_factor(); |
34 rotation_ = display.rotation(); | 34 rotation_ = display.rotation(); |
35 if (platform_cursor_) | 35 if (platform_cursor_) |
36 ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor_); | 36 ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor_); |
37 platform_cursor_ = NULL; | 37 platform_cursor_ = nullptr; |
38 // It is not necessary to recreate platform_cursor_ yet, since it will be | 38 // It is not necessary to recreate platform_cursor_ yet, since it will be |
39 // recreated on demand when GetPlatformCursor is called. | 39 // recreated on demand when GetPlatformCursor is called. |
40 } | 40 } |
41 | 41 |
42 void WebCursor::InitPlatformData() { | 42 void WebCursor::InitPlatformData() { |
43 platform_cursor_ = NULL; | 43 platform_cursor_ = nullptr; |
44 device_scale_factor_ = 1.f; | 44 device_scale_factor_ = 1.f; |
45 rotation_ = gfx::Display::ROTATE_0; | 45 rotation_ = gfx::Display::ROTATE_0; |
46 } | 46 } |
47 | 47 |
48 bool WebCursor::SerializePlatformData(Pickle* pickle) const { | 48 bool WebCursor::SerializePlatformData(Pickle* pickle) const { |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 bool WebCursor::DeserializePlatformData(PickleIterator* iter) { | 52 bool WebCursor::DeserializePlatformData(PickleIterator* iter) { |
53 return true; | 53 return true; |
54 } | 54 } |
55 | 55 |
56 bool WebCursor::IsPlatformDataEqual(const WebCursor& other) const { | 56 bool WebCursor::IsPlatformDataEqual(const WebCursor& other) const { |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 void WebCursor::CleanupPlatformData() { | 60 void WebCursor::CleanupPlatformData() { |
61 if (platform_cursor_) { | 61 if (platform_cursor_) { |
62 ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor_); | 62 ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor_); |
63 platform_cursor_ = NULL; | 63 platform_cursor_ = nullptr; |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 void WebCursor::CopyPlatformData(const WebCursor& other) { | 67 void WebCursor::CopyPlatformData(const WebCursor& other) { |
68 if (platform_cursor_) | 68 if (platform_cursor_) |
69 ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor_); | 69 ui::CursorFactoryOzone::GetInstance()->UnrefImageCursor(platform_cursor_); |
70 platform_cursor_ = other.platform_cursor_; | 70 platform_cursor_ = other.platform_cursor_; |
71 if (platform_cursor_) | 71 if (platform_cursor_) |
72 ui::CursorFactoryOzone::GetInstance()->RefImageCursor(platform_cursor_); | 72 ui::CursorFactoryOzone::GetInstance()->RefImageCursor(platform_cursor_); |
73 | 73 |
74 device_scale_factor_ = other.device_scale_factor_; | 74 device_scale_factor_ = other.device_scale_factor_; |
75 } | 75 } |
76 | 76 |
77 } // namespace content | 77 } // namespace content |
OLD | NEW |