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

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

Issue 2916823002: Move Mus into chrome's process when running with --mus.
Patch Set: Removing debug include. 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
« no previous file with comments | « services/ui/common/image_cursors_set.h ('k') | services/ui/display/screen_manager_forwarding.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « services/ui/common/image_cursors_set.h ('k') | services/ui/display/screen_manager_forwarding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698