Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: mojo/examples/browser/browser.cc

Issue 331323007: Eliminate Launchable. Use Navigator instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/examples/embedded_app/embedded_app.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 GURL url(sender->text()); 136 GURL url(sender->text());
136 printf("User entered this URL: %s\n", url.spec().c_str()); 137 printf("User entered this URL: %s\n", url.spec().c_str());
137 launcher_->Launch(url.spec()); 138 launcher_->Launch(url.spec());
138 } 139 }
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 navigation::ResponseDetailsPtr response_details) OVERRIDE {
146 ScopedDataPipeConsumerHandle response_body_stream) OVERRIDE {
147 content_node_->Embed(handler_url); 147 content_node_->Embed(handler_url);
148 148
149 launcher::LaunchablePtr launchable; 149 navigation::NavigationDetailsPtr navigation_details(
150 ConnectTo(handler_url, &launchable); 150 navigation::NavigationDetails::New());
151 launchable->OnLaunch(response.Pass(), 151 navigation_details->url = response_details->response->url;
152 response_body_stream.Pass(), 152
153 content_node_->id()); 153 navigation::NavigatorPtr navigator;
154 ConnectTo(handler_url, &navigator);
155 navigator->Navigate(content_node_->id(),
156 navigation_details.Pass(),
157 response_details.Pass());
154 } 158 }
155 159
156 scoped_ptr<ViewsInit> views_init_; 160 scoped_ptr<ViewsInit> views_init_;
157 161
158 view_manager::ViewManager* view_manager_; 162 view_manager::ViewManager* view_manager_;
159 view_manager::View* view_; 163 view_manager::View* view_;
160 view_manager::Node* content_node_; 164 view_manager::Node* content_node_;
161 launcher::LauncherPtr launcher_; 165 launcher::LauncherPtr launcher_;
162 166
163 DISALLOW_COPY_AND_ASSIGN(Browser); 167 DISALLOW_COPY_AND_ASSIGN(Browser);
164 }; 168 };
165 169
166 } // namespace examples 170 } // namespace examples
167 171
168 // static 172 // static
169 Application* Application::Create() { 173 Application* Application::Create() {
170 return new examples::Browser; 174 return new examples::Browser;
171 } 175 }
172 176
173 } // namespace mojo 177 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/examples/embedded_app/embedded_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698