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

Unified Diff: mojo/services/public/cpp/view_manager/view_tracker.h

Issue 728553002: Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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: mojo/services/public/cpp/view_manager/view_tracker.h
diff --git a/mojo/services/public/cpp/view_manager/view_tracker.h b/mojo/services/public/cpp/view_manager/view_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..71a218a94df6647507f120aa4ae9b4532462b840
--- /dev/null
+++ b/mojo/services/public/cpp/view_manager/view_tracker.h
@@ -0,0 +1,47 @@
+// Copyright 2014 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.
+
+#ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TRACKER_H_
+#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TRACKER_H_
+
+#include <set>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "mojo/services/public/cpp/view_manager/view_observer.h"
+
+namespace mojo {
+
+class ViewTracker : public ViewObserver {
+ public:
+ using Views = std::set<View*>;
+
+ ViewTracker();
+ ~ViewTracker() override;
+
+ // Returns the set of views being observed.
+ const std::set<View*>& views() const { return views_; }
+
+ // Adds |view| to the set of Views being tracked.
+ void Add(View* view);
+
+ // Removes |view| from the set of views being tracked.
+ void Remove(View* view);
+
+ // Returns true if |view| was previously added and has not been removed or
+ // deleted.
+ bool Contains(View* view);
+
+ // ViewObserver overrides:
+ virtual void OnViewDestroying(View* view) override;
+
+ private:
+ Views views_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewTracker);
+};
+
+} // namespace mojo
+
+#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TRACKER_H_

Powered by Google App Engine
This is Rietveld 408576698