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

Unified Diff: services/ui/common/image_cursors_set.cc

Issue 2979933002: Add support to the UI Service to run it inside the browser's process. (Closed)
Patch Set: Rebase Created 3 years, 5 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
Index: services/ui/common/image_cursors_set.cc
diff --git a/services/ui/common/image_cursors_set.cc b/services/ui/common/image_cursors_set.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4e0a92ad9800470c6f2c6ac9d83f2eb34fccfb6a
--- /dev/null
+++ b/services/ui/common/image_cursors_set.cc
@@ -0,0 +1,37 @@
+// 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 "services/ui/common/image_cursors_set.h"
+
+#include <algorithm>
+
+#include "ui/base/cursor/image_cursors.h"
+
+namespace ui {
+
+ImageCursorsSet::ImageCursorsSet() : weak_ptr_factory_(this) {}
+
+ImageCursorsSet::~ImageCursorsSet() {}
+
+void ImageCursorsSet::AddImageCursors(
+ std::unique_ptr<ImageCursors> image_cursors) {
+ auto result = image_cursors_set_.insert(std::move(image_cursors));
+ DCHECK(result.second);
+}
+
+void ImageCursorsSet::RemoveImageCursors(ImageCursors* image_cursors) {
+ auto it =
+ std::find_if(image_cursors_set_.begin(), image_cursors_set_.end(),
+ [image_cursors](const std::unique_ptr<ImageCursors>& elmt) {
+ return elmt.get() == image_cursors;
+ });
+ DCHECK(it != image_cursors_set_.end());
+ image_cursors_set_.erase(it);
+}
+
+base::WeakPtr<ImageCursorsSet> ImageCursorsSet::GetWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698