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

Side by Side Diff: components/mus/public/cpp/scoped_window_ptr.h

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_SCOPED_WINDOW_PTR_H_
6 #define COMPONENTS_MUS_PUBLIC_CPP_SCOPED_WINDOW_PTR_H_
7
8 #include "base/macros.h"
9 #include "components/mus/public/cpp/window_observer.h"
10
11 namespace mus {
12
13 // Wraps a Window, taking overship of the Window. Also deals with Window being
14 // destroyed while ScopedWindowPtr still exists.
15 class ScopedWindowPtr : public WindowObserver {
16 public:
17 explicit ScopedWindowPtr(Window* window);
18 ~ScopedWindowPtr() override;
19
20 // Destroys |window|. If |window| is a root of the WindowManager than the
21 // WindowManager is destroyed (which in turn destroys |window|).
22 //
23 // NOTE: this function (and class) are only useful for clients that only
24 // ever have a single root.
25 static void DeleteWindowOrWindowManager(Window* window);
26
27 Window* window() { return window_; }
28 const Window* window() const { return window_; }
29
30 private:
31 void DetachFromWindow();
32
33 void OnWindowDestroying(Window* window) override;
34
35 Window* window_;
36
37 DISALLOW_COPY_AND_ASSIGN(ScopedWindowPtr);
38 };
39
40 } // namespace mus
41
42 #endif // COMPONENTS_MUS_PUBLIC_CPP_SCOPED_WINDOW_PTR_H_
OLDNEW
« no previous file with comments | « components/mus/public/cpp/property_type_converters.h ('k') | components/mus/public/cpp/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698