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 "mojo/public/cpp/application/application.h" | 6 #include "mojo/public/cpp/application/application.h" |
| 7 #include "mojo/services/navigation/navigation.mojom.h" |
7 #include "mojo/services/public/cpp/view_manager/view.h" | 8 #include "mojo/services/public/cpp/view_manager/view.h" |
8 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 9 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
9 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 10 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
10 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 11 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
11 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" | 12 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" |
12 #include "mojo/services/public/interfaces/launcher/launcher.mojom.h" | 13 #include "mojo/services/public/interfaces/launcher/launcher.mojom.h" |
13 #include "mojo/views/native_widget_view_manager.h" | 14 #include "mojo/views/native_widget_view_manager.h" |
14 #include "mojo/views/views_init.h" | 15 #include "mojo/views/views_init.h" |
15 #include "ui/views/controls/textfield/textfield.h" | 16 #include "ui/views/controls/textfield/textfield.h" |
16 #include "ui/views/controls/textfield/textfield_controller.h" | 17 #include "ui/views/controls/textfield/textfield_controller.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 return false; | 143 return false; |
143 } | 144 } |
144 | 145 |
145 // launcher::LauncherClient: | 146 // launcher::LauncherClient: |
146 virtual void OnLaunch( | 147 virtual void OnLaunch( |
147 const String& handler_url, | 148 const String& handler_url, |
148 URLResponsePtr response, | 149 URLResponsePtr response, |
149 ScopedDataPipeConsumerHandle response_body_stream) OVERRIDE { | 150 ScopedDataPipeConsumerHandle response_body_stream) OVERRIDE { |
150 content_node_->Embed(handler_url); | 151 content_node_->Embed(handler_url); |
151 | 152 |
152 launcher::LaunchablePtr launchable; | 153 navigation::NavigationDetailsPtr details( |
153 ConnectTo(handler_url, &launchable); | 154 navigation::NavigationDetails::New()); |
154 launchable->OnLaunch(response.Pass(), | 155 details->url = response->url; |
155 response_body_stream.Pass(), | 156 details->response = response.Pass(); |
156 content_node_->id()); | 157 details->response_body_stream = response_body_stream.Pass(); |
| 158 |
| 159 navigation::NavigatorPtr navigator; |
| 160 ConnectTo(handler_url, &navigator); |
| 161 navigator->Navigate(content_node_->id(), details.Pass()); |
157 } | 162 } |
158 | 163 |
159 scoped_ptr<ViewsInit> views_init_; | 164 scoped_ptr<ViewsInit> views_init_; |
160 | 165 |
161 view_manager::ViewManager* view_manager_; | 166 view_manager::ViewManager* view_manager_; |
162 view_manager::View* view_; | 167 view_manager::View* view_; |
163 view_manager::ViewTreeNode* content_node_; | 168 view_manager::ViewTreeNode* content_node_; |
164 launcher::LauncherPtr launcher_; | 169 launcher::LauncherPtr launcher_; |
165 | 170 |
166 DISALLOW_COPY_AND_ASSIGN(Browser); | 171 DISALLOW_COPY_AND_ASSIGN(Browser); |
167 }; | 172 }; |
168 | 173 |
169 } // namespace examples | 174 } // namespace examples |
170 | 175 |
171 // static | 176 // static |
172 Application* Application::Create() { | 177 Application* Application::Create() { |
173 return new examples::Browser; | 178 return new examples::Browser; |
174 } | 179 } |
175 | 180 |
176 } // namespace mojo | 181 } // namespace mojo |
OLD | NEW |