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