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

Side by Side Diff: mojo/application/public/cpp/application_impl.h

Issue 1229553002: Mandoline: ConnectToApplication and ConnectToService should fail gracefully (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
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 #ifndef MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 5 #ifndef MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 ApplicationConnection* ConnectToApplication(mojo::URLRequestPtr request); 85 ApplicationConnection* ConnectToApplication(mojo::URLRequestPtr request);
86 86
87 // Closes the |connection|. 87 // Closes the |connection|.
88 void CloseConnection(ApplicationConnection* connection); 88 void CloseConnection(ApplicationConnection* connection);
89 89
90 // Connect to application identified by |request->url| and connect to the 90 // Connect to application identified by |request->url| and connect to the
91 // service implementation of the interface identified by |Interface|. 91 // service implementation of the interface identified by |Interface|.
92 template <typename Interface> 92 template <typename Interface>
93 void ConnectToService(mojo::URLRequestPtr request, 93 void ConnectToService(mojo::URLRequestPtr request,
94 InterfacePtr<Interface>* ptr) { 94 InterfacePtr<Interface>* ptr) {
95 ConnectToApplication(request.Pass())->ConnectToService(ptr); 95 ApplicationConnection* connection = ConnectToApplication(request.Pass());
96 if (!connection)
97 return;
98 connection->ConnectToService(ptr);
96 } 99 }
97 100
98 // Application implementation. 101 // Application implementation.
99 void Initialize(ShellPtr shell, const mojo::String& url) override; 102 void Initialize(ShellPtr shell, const mojo::String& url) override;
100 103
101 // Block until the Application is initialized, if it is not already. 104 // Block until the Application is initialized, if it is not already.
102 void WaitForInitialize(); 105 void WaitForInitialize();
103 106
104 // Unbinds the Shell and Application connections. Can be used to re-bind the 107 // Unbinds the Shell and Application connections. Can be used to re-bind the
105 // handles to another implementation of ApplicationImpl, for instance when 108 // handles to another implementation of ApplicationImpl, for instance when
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 bool quit_requested_; 143 bool quit_requested_;
141 bool in_destructor_; 144 bool in_destructor_;
142 base::WeakPtrFactory<ApplicationImpl> weak_factory_; 145 base::WeakPtrFactory<ApplicationImpl> weak_factory_;
143 146
144 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); 147 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
145 }; 148 };
146 149
147 } // namespace mojo 150 } // namespace mojo
148 151
149 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 152 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
OLDNEW
« no previous file with comments | « components/view_manager/display_manager.cc ('k') | mojo/application/public/cpp/lib/application_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698