OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/services/public/cpp/view_manager/view.h" | 5 #include "mojo/services/public/cpp/view_manager/view.h" |
6 | 6 |
7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" | 7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" |
8 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" | 8 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" |
9 #include "mojo/services/public/cpp/view_manager/node.h" | 9 #include "mojo/services/public/cpp/view_manager/node.h" |
10 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 10 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
11 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
12 | 12 |
13 namespace mojo { | 13 namespace mojo { |
14 namespace view_manager { | 14 namespace view_manager { |
15 | 15 |
16 namespace { | 16 namespace { |
17 class ScopedDestructionNotifier { | 17 class ScopedDestructionNotifier { |
18 public: | 18 public: |
19 explicit ScopedDestructionNotifier(View* view) | 19 explicit ScopedDestructionNotifier(View* view) |
20 : view_(view) { | 20 : view_(view) { |
21 FOR_EACH_OBSERVER( | 21 FOR_EACH_OBSERVER(ViewObserver, |
22 ViewObserver, | 22 *ViewPrivate(view_).observers(), |
23 *ViewPrivate(view_).observers(), | 23 OnViewDestroying(view_)); |
24 OnViewDestroy(view_, ViewObserver::DISPOSITION_CHANGING)); | |
25 } | 24 } |
26 ~ScopedDestructionNotifier() { | 25 ~ScopedDestructionNotifier() { |
27 FOR_EACH_OBSERVER( | 26 FOR_EACH_OBSERVER(ViewObserver, |
28 ViewObserver, | 27 *ViewPrivate(view_).observers(), |
29 *ViewPrivate(view_).observers(), | 28 OnViewDestroyed(view_)); |
30 OnViewDestroy(view_, ViewObserver::DISPOSITION_CHANGED)); | |
31 } | 29 } |
32 | 30 |
33 private: | 31 private: |
34 View* view_; | 32 View* view_; |
35 | 33 |
36 DISALLOW_COPY_AND_ASSIGN(ScopedDestructionNotifier); | 34 DISALLOW_COPY_AND_ASSIGN(ScopedDestructionNotifier); |
37 }; | 35 }; |
38 } // namespace | 36 } // namespace |
39 | 37 |
40 // static | 38 // static |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 if (manager_) | 86 if (manager_) |
89 static_cast<ViewManagerClientImpl*>(manager_)->RemoveView(id_); | 87 static_cast<ViewManagerClientImpl*>(manager_)->RemoveView(id_); |
90 } | 88 } |
91 | 89 |
92 void View::LocalDestroy() { | 90 void View::LocalDestroy() { |
93 delete this; | 91 delete this; |
94 } | 92 } |
95 | 93 |
96 } // namespace view_manager | 94 } // namespace view_manager |
97 } // namespace mojo | 95 } // namespace mojo |
OLD | NEW |