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

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: Check that specified URLs for applications are good. Created 6 years, 1 month 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') | mojo/shell/desktop/mojo_main.cc » ('J')
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 client()->AcceptConnection(String::From(requestor_url), 93 client()->AcceptConnection(String::From(requestor_url),
94 service_provider.Pass()); 94 service_provider.Pass());
95 } 95 }
96 96
97 // ServiceProvider implementation: 97 // ServiceProvider implementation:
98 void ConnectToApplication( 98 void ConnectToApplication(
99 const String& app_url, 99 const String& app_url,
100 InterfaceRequest<ServiceProvider> in_service_provider) override { 100 InterfaceRequest<ServiceProvider> in_service_provider) override {
101 ServiceProviderPtr out_service_provider; 101 ServiceProviderPtr out_service_provider;
102 out_service_provider.Bind(in_service_provider.PassMessagePipe()); 102 out_service_provider.Bind(in_service_provider.PassMessagePipe());
103 manager_->ConnectToApplication( 103 GURL app_gurl(app_url);
104 app_url.To<GURL>(), url_, out_service_provider.Pass()); 104 if (!app_gurl.is_valid() && app_gurl.possibly_invalid_spec().size() == 0) {
Aaron Boodman 2014/11/20 21:53:59 This is the first code that gets called when some
azani 2014/11/20 22:10:03 Done.
105 LOG(ERROR) << "Error: invalid URL: " << app_url;
Aaron Boodman 2014/11/20 21:53:59 return here. The InterfaceRequest will get destroy
azani 2014/11/20 22:10:03 Done.
106 }
107 DCHECK(app_gurl.possibly_invalid_spec().size() > 0);
Aaron Boodman 2014/11/20 21:53:59 This moves to ApplicationManager::ConnectToApplica
azani 2014/11/20 22:10:03 Done.
108 manager_->ConnectToApplication(app_gurl, url_, out_service_provider.Pass());
105 } 109 }
106 110
107 const GURL& url() const { return url_; } 111 const GURL& url() const { return url_; }
108 112
109 private: 113 private:
110 void OnConnectionError() override { manager_->OnShellImplError(this); } 114 void OnConnectionError() override { manager_->OnShellImplError(this); }
111 115
112 ApplicationManager* const manager_; 116 ApplicationManager* const manager_;
113 const GURL url_; 117 const GURL url_;
114 118
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 StubServiceProvider* stub_sp = new StubServiceProvider; 320 StubServiceProvider* stub_sp = new StubServiceProvider;
317 ServiceProviderPtr spp; 321 ServiceProviderPtr spp;
318 BindToProxy(stub_sp, &spp); 322 BindToProxy(stub_sp, &spp);
319 ConnectToApplication(application_url, GURL(), spp.Pass()); 323 ConnectToApplication(application_url, GURL(), spp.Pass());
320 MessagePipe pipe; 324 MessagePipe pipe;
321 stub_sp->GetRemoteServiceProvider()->ConnectToService(interface_name, 325 stub_sp->GetRemoteServiceProvider()->ConnectToService(interface_name,
322 pipe.handle1.Pass()); 326 pipe.handle1.Pass());
323 return pipe.handle0.Pass(); 327 return pipe.handle0.Pass();
324 } 328 }
325 } // namespace mojo 329 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/shell/desktop/mojo_main.cc » ('j') | mojo/shell/desktop/mojo_main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698