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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "mojo/examples/window_manager/window_manager.mojom.h" | 8 #include "mojo/examples/window_manager/window_manager.mojom.h" |
9 #include "mojo/public/cpp/application/application_connection.h" | 9 #include "mojo/public/cpp/application/application_connection.h" |
10 #include "mojo/public/cpp/application/application_delegate.h" | 10 #include "mojo/public/cpp/application/application_delegate.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 NavigateChild(); | 95 NavigateChild(); |
96 } | 96 } |
97 | 97 |
98 // Overridden from ViewObserver: | 98 // Overridden from ViewObserver: |
99 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE { | 99 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE { |
100 if (event->action == ui::ET_MOUSE_RELEASED) | 100 if (event->action == ui::ET_MOUSE_RELEASED) |
101 window_manager_->CloseWindow(view->node()->id()); | 101 window_manager_->CloseWindow(view->node()->id()); |
102 } | 102 } |
103 | 103 |
104 // Overridden from NodeObserver: | 104 // Overridden from NodeObserver: |
105 virtual void OnNodeDestroy( | 105 virtual void OnNodeDestroyed(Node* node) OVERRIDE { |
106 Node* node, | |
107 NodeObserver::DispositionChangePhase phase) OVERRIDE { | |
108 if (phase != NodeObserver::DISPOSITION_CHANGED) | |
109 return; | |
110 // TODO(beng): reap views & child nodes. | 106 // TODO(beng): reap views & child nodes. |
111 nested_ = NULL; | 107 nested_ = NULL; |
112 } | 108 } |
113 | 109 |
114 void NavigateChild() { | 110 void NavigateChild() { |
115 if (!color_.empty() && nested_) { | 111 if (!color_.empty() && nested_) { |
116 navigation::NavigationDetailsPtr details( | 112 navigation::NavigationDetailsPtr details( |
117 navigation::NavigationDetails::New()); | 113 navigation::NavigationDetails::New()); |
118 details->url = | 114 details->url = |
119 base::StringPrintf("%s/%s", kEmbeddedAppURL, color_.c_str()); | 115 base::StringPrintf("%s/%s", kEmbeddedAppURL, color_.c_str()); |
(...skipping 14 matching lines...) Expand all Loading... |
134 }; | 130 }; |
135 | 131 |
136 } // namespace examples | 132 } // namespace examples |
137 | 133 |
138 // static | 134 // static |
139 ApplicationDelegate* ApplicationDelegate::Create() { | 135 ApplicationDelegate* ApplicationDelegate::Create() { |
140 return new examples::NestingApp; | 136 return new examples::NestingApp; |
141 } | 137 } |
142 | 138 |
143 } // namespace mojo | 139 } // namespace mojo |
OLD | NEW |