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

Side by Side Diff: components/view_manager/public/cpp/scoped_view_ptr.h

Issue 1344573002: Mandoline: Rename components/view_manager to components/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 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_VIEW_MANAGER_PUBLIC_CPP_SCOPED_VIEW_PTR_H_
6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_SCOPED_VIEW_PTR_H_
7
8 #include "components/view_manager/public/cpp/view_observer.h"
9
10 namespace mojo {
11
12 // Wraps a View, taking overship of the View. Also deals with View being
13 // destroyed while ScopedViewPtr still exists.
14 class ScopedViewPtr : public ViewObserver {
15 public:
16 explicit ScopedViewPtr(View* view);
17 ~ScopedViewPtr() override;
18
19 // Destroys |view|. If |view| is the root of the ViewManager than the
20 // ViewManager is destroyed (which in turn destroys |view|).
21 static void DeleteViewOrViewManager(View* view);
22
23 View* view() { return view_; }
24 const View* view() const { return view_; }
25
26 private:
27 void DetachFromView();
28
29 void OnViewDestroying(View* view) override;
30
31 View* view_;
32
33 DISALLOW_COPY_AND_ASSIGN(ScopedViewPtr);
34 };
35
36 } // namespace mojo
37
38 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_SCOPED_VIEW_PTR_H_
OLDNEW
« no previous file with comments | « components/view_manager/public/cpp/lib/view_tree_host_factory.cc ('k') | components/view_manager/public/cpp/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698