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

Side by Side Diff: mojo/application_manager/application_manager.cc

Issue 735863002: Emit an error log line when attempting to connect to an app at an invalid URL. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | mojo/shell/desktop/mojo_main.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 "mojo/application_manager/application_manager.h" 5 #include "mojo/application_manager/application_manager.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 binding_(this) { 139 binding_(this) {
140 binding_.set_error_handler(this); 140 binding_.set_error_handler(this);
141 } 141 }
142 142
143 // Shell implementation: 143 // Shell implementation:
144 void ConnectToApplication( 144 void ConnectToApplication(
145 const String& app_url, 145 const String& app_url,
146 InterfaceRequest<ServiceProvider> in_service_provider) override { 146 InterfaceRequest<ServiceProvider> in_service_provider) override {
147 ServiceProviderPtr out_service_provider; 147 ServiceProviderPtr out_service_provider;
148 out_service_provider.Bind(in_service_provider.PassMessagePipe()); 148 out_service_provider.Bind(in_service_provider.PassMessagePipe());
149 manager_->ConnectToApplication( 149 GURL app_gurl(app_url);
150 app_url.To<GURL>(), url_, out_service_provider.Pass()); 150 if (!app_gurl.is_valid()) {
151 LOG(ERROR) << "Error: invalid URL: " << app_url;
152 return;
153 }
154 manager_->ConnectToApplication(app_gurl, url_, out_service_provider.Pass());
151 } 155 }
152 156
153 // ErrorHandler implementation: 157 // ErrorHandler implementation:
154 void OnConnectionError() override { manager_->OnShellImplError(this); } 158 void OnConnectionError() override { manager_->OnShellImplError(this); }
155 159
156 ApplicationManager* const manager_; 160 ApplicationManager* const manager_;
157 const GURL requested_url_; 161 const GURL requested_url_;
158 const GURL url_; 162 const GURL url_;
159 Binding<Shell> binding_; 163 Binding<Shell> binding_;
160 164
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 226
223 void ApplicationManager::TerminateShellConnections() { 227 void ApplicationManager::TerminateShellConnections() {
224 STLDeleteValues(&url_to_shell_impl_); 228 STLDeleteValues(&url_to_shell_impl_);
225 STLDeleteElements(&content_shell_impls_); 229 STLDeleteElements(&content_shell_impls_);
226 } 230 }
227 231
228 void ApplicationManager::ConnectToApplication( 232 void ApplicationManager::ConnectToApplication(
229 const GURL& requested_url, 233 const GURL& requested_url,
230 const GURL& requestor_url, 234 const GURL& requestor_url,
231 ServiceProviderPtr service_provider) { 235 ServiceProviderPtr service_provider) {
236 DCHECK(requested_url.is_valid());
232 ApplicationLoader* loader = GetLoaderForURL(requested_url, 237 ApplicationLoader* loader = GetLoaderForURL(requested_url,
233 DONT_INCLUDE_DEFAULT_LOADER); 238 DONT_INCLUDE_DEFAULT_LOADER);
234 if (loader) { 239 if (loader) {
235 ConnectToApplicationImpl(requested_url, requested_url, requestor_url, 240 ConnectToApplicationImpl(requested_url, requested_url, requestor_url,
236 service_provider.Pass(), loader); 241 service_provider.Pass(), loader);
237 return; 242 return;
238 } 243 }
239 244
240 GURL resolved_url = delegate_->ResolveURL(requested_url); 245 GURL resolved_url = delegate_->ResolveURL(requested_url);
241 loader = GetLoaderForURL(resolved_url, INCLUDE_DEFAULT_LOADER); 246 loader = GetLoaderForURL(resolved_url, INCLUDE_DEFAULT_LOADER);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 return pipe.handle0.Pass(); 440 return pipe.handle0.Pass();
436 } 441 }
437 442
438 Array<String> ApplicationManager::GetArgsForURL(const GURL& url) { 443 Array<String> ApplicationManager::GetArgsForURL(const GURL& url) {
439 URLToArgsMap::const_iterator args_it = url_to_args_.find(url); 444 URLToArgsMap::const_iterator args_it = url_to_args_.find(url);
440 if (args_it != url_to_args_.end()) 445 if (args_it != url_to_args_.end())
441 return Array<String>::From(args_it->second); 446 return Array<String>::From(args_it->second);
442 return Array<String>(); 447 return Array<String>();
443 } 448 }
444 } // namespace mojo 449 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/shell/desktop/mojo_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698