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.h" | 9 #include "mojo/public/cpp/application/application.h" |
10 #include "mojo/services/navigation/navigation.mojom.h" | 10 #include "mojo/services/navigation/navigation.mojom.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // TODO(aa): This means that there can only ever be one instance of every | 130 // TODO(aa): This means that there can only ever be one instance of every |
131 // app, which seems wrong. Instead, perhaps embedder should get back a | 131 // app, which seems wrong. Instead, perhaps embedder should get back a |
132 // service provider that allows it to talk to embeddee. | 132 // service provider that allows it to talk to embeddee. |
133 navigation::NavigatorPtr navigator; | 133 navigation::NavigatorPtr navigator; |
134 ConnectTo(url, &navigator); | 134 ConnectTo(url, &navigator); |
135 navigation::NavigationDetailsPtr details( | 135 navigation::NavigationDetailsPtr details( |
136 navigation::NavigationDetails::New()); | 136 navigation::NavigationDetails::New()); |
137 size_t index = node->children().size() - 1; | 137 size_t index = node->children().size() - 1; |
138 details->url = base::StringPrintf( | 138 details->url = base::StringPrintf( |
139 "%s/%x", kEmbeddedAppURL, kColors[index % arraysize(kColors)]); | 139 "%s/%x", kEmbeddedAppURL, kColors[index % arraysize(kColors)]); |
140 navigator->Navigate(embedded->id(), details.Pass()); | 140 |
| 141 // TODO(beng): remove once nullable parameters land. |
| 142 navigation::ResponseDetailsPtr response_details( |
| 143 navigation::ResponseDetails::New()); |
| 144 navigator->Navigate(embedded->id(), |
| 145 details.Pass(), |
| 146 response_details.Pass()); |
141 } | 147 } |
142 } | 148 } |
143 | 149 |
144 ViewManager* view_manager_; | 150 ViewManager* view_manager_; |
145 Id parent_node_id_; | 151 Id parent_node_id_; |
146 | 152 |
147 DISALLOW_COPY_AND_ASSIGN(WindowManager); | 153 DISALLOW_COPY_AND_ASSIGN(WindowManager); |
148 }; | 154 }; |
149 | 155 |
150 void WindowManagerConnection::CloseWindow(Id node_id) { | 156 void WindowManagerConnection::CloseWindow(Id node_id) { |
151 window_manager_->CloseWindow(node_id); | 157 window_manager_->CloseWindow(node_id); |
152 } | 158 } |
153 | 159 |
154 } // namespace examples | 160 } // namespace examples |
155 | 161 |
156 // static | 162 // static |
157 Application* Application::Create() { | 163 Application* Application::Create() { |
158 return new examples::WindowManager; | 164 return new examples::WindowManager; |
159 } | 165 } |
160 | 166 |
161 } // namespace mojo | 167 } // namespace mojo |
OLD | NEW |