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

Unified Diff: ui/base/cursor/cursor_data.cc

Issue 2786983003: [aura-mus] Add ui::CursorData, with mojo serialization. (Closed)
Patch Set: Enhance the test and comment mojom. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« ui/base/cursor/cursor_data.h ('K') | « ui/base/cursor/cursor_data.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cursor/cursor_data.cc
diff --git a/ui/base/cursor/cursor_data.cc b/ui/base/cursor/cursor_data.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0b791107f4f716ee3d6873f5a21d53ea6f75171b
--- /dev/null
+++ b/ui/base/cursor/cursor_data.cc
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/base/cursor/cursor_data.h"
+
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/cursor/cursor.h"
+
+namespace ui {
+
+CursorData::CursorData() : native_type_(0), frame_delay_ms_(0) {}
+
+CursorData::CursorData(int type) : native_type_(type), frame_delay_ms_(0) {}
+
+CursorData::CursorData(const gfx::Point& hotspot_point,
+ const std::vector<SkBitmap>& cursor_frames,
+ int frame_delay_ms)
+ : native_type_(kCursorCustom),
+ frame_delay_ms_(frame_delay_ms),
+ hotspot_(hotspot_point),
+ cursor_frames_(cursor_frames) {
+ for (SkBitmap& bitmap : cursor_frames_)
+ generator_ids_.push_back(bitmap.getGenerationID());
+}
+
+CursorData::CursorData(const CursorData& cursor) = default;
+
+CursorData::~CursorData() {}
+
+CursorData& CursorData::operator=(const CursorData& cursor) = default;
+
+bool CursorData::IsType(int native_type) const {
+ return native_type_ == native_type;
+}
+
+bool CursorData::IsSameAs(const CursorData& rhs) const {
+ return native_type_ == rhs.native_type_ &&
+ frame_delay_ms_ == rhs.frame_delay_ms_ && hotspot_ == rhs.hotspot_ &&
+ generator_ids_ == rhs.generator_ids_;
+}
+
+} // namespace ui
« ui/base/cursor/cursor_data.h ('K') | « ui/base/cursor/cursor_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698