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/lib/view_manager_client_impl.h" | 5 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 last_view = view; | 65 last_view = view; |
66 } | 66 } |
67 return root; | 67 return root; |
68 } | 68 } |
69 | 69 |
70 // Responsible for removing a root from the ViewManager when that view is | 70 // Responsible for removing a root from the ViewManager when that view is |
71 // destroyed. | 71 // destroyed. |
72 class RootObserver : public ViewObserver { | 72 class RootObserver : public ViewObserver { |
73 public: | 73 public: |
74 explicit RootObserver(View* root) : root_(root) {} | 74 explicit RootObserver(View* root) : root_(root) {} |
75 virtual ~RootObserver() {} | 75 ~RootObserver() override {} |
76 | 76 |
77 private: | 77 private: |
78 // Overridden from ViewObserver: | 78 // Overridden from ViewObserver: |
79 virtual void OnViewDestroyed(View* view) override { | 79 void OnViewDestroyed(View* view) override { |
80 DCHECK_EQ(view, root_); | 80 DCHECK_EQ(view, root_); |
81 static_cast<ViewManagerClientImpl*>( | 81 static_cast<ViewManagerClientImpl*>( |
82 ViewPrivate(root_).view_manager())->RemoveRoot(root_); | 82 ViewPrivate(root_).view_manager())->RemoveRoot(root_); |
83 view->RemoveObserver(this); | 83 view->RemoveObserver(this); |
84 delete this; | 84 delete this; |
85 } | 85 } |
86 | 86 |
87 View* root_; | 87 View* root_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(RootObserver); | 89 DISALLOW_COPY_AND_ASSIGN(RootObserver); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 base::Unretained(this)); | 378 base::Unretained(this)); |
379 } | 379 } |
380 | 380 |
381 base::Callback<void(ErrorCode)> | 381 base::Callback<void(ErrorCode)> |
382 ViewManagerClientImpl::ActionCompletedCallbackWithErrorCode() { | 382 ViewManagerClientImpl::ActionCompletedCallbackWithErrorCode() { |
383 return base::Bind(&ViewManagerClientImpl::OnActionCompletedWithErrorCode, | 383 return base::Bind(&ViewManagerClientImpl::OnActionCompletedWithErrorCode, |
384 base::Unretained(this)); | 384 base::Unretained(this)); |
385 } | 385 } |
386 | 386 |
387 } // namespace mojo | 387 } // namespace mojo |
OLD | NEW |