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

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

Issue 1287043004: Use CapabilityFilter to restrict what HTMLViewers can connect to. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 4 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/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // the ApplicationImpl is destroyed. 73 // the ApplicationImpl is destroyed.
74 Shell* shell() const { return shell_.get(); } 74 Shell* shell() const { return shell_.get(); }
75 75
76 const std::string& url() const { return url_; } 76 const std::string& url() const { return url_; }
77 77
78 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; } 78 AppLifetimeHelper* app_lifetime_helper() { return &app_lifetime_helper_; }
79 79
80 // Requests a new connection to an application. Returns a pointer to the 80 // Requests a new connection to an application. Returns a pointer to the
81 // connection if the connection is permitted by this application's delegate, 81 // connection if the connection is permitted by this application's delegate,
82 // or nullptr otherwise. Caller takes ownership. 82 // or nullptr otherwise. Caller takes ownership.
83 // TODO(beng): consider replacing default value in a separate CL per style 83 scoped_ptr<ApplicationConnection> ConnectToApplication(URLRequestPtr request);
84 // guide. 84 scoped_ptr<ApplicationConnection> ConnectToApplicationWithCapabilityFilter(
85 scoped_ptr<ApplicationConnection> ConnectToApplication(
86 URLRequestPtr request, 85 URLRequestPtr request,
87 CapabilityFilterPtr filter = nullptr); 86 CapabilityFilterPtr filter);
88 87
89 // Connect to application identified by |request->url| and connect to the 88 // Connect to application identified by |request->url| and connect to the
90 // service implementation of the interface identified by |Interface|. 89 // service implementation of the interface identified by |Interface|.
91 template <typename Interface> 90 template <typename Interface>
92 void ConnectToService(mojo::URLRequestPtr request, 91 void ConnectToService(mojo::URLRequestPtr request,
93 InterfacePtr<Interface>* ptr) { 92 InterfacePtr<Interface>* ptr) {
94 scoped_ptr<ApplicationConnection> connection = 93 scoped_ptr<ApplicationConnection> connection =
95 ConnectToApplication(request.Pass()); 94 ConnectToApplication(request.Pass());
96 if (!connection.get()) 95 if (!connection.get())
97 return; 96 return;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 AppLifetimeHelper app_lifetime_helper_; 139 AppLifetimeHelper app_lifetime_helper_;
141 bool quit_requested_; 140 bool quit_requested_;
142 base::WeakPtrFactory<ApplicationImpl> weak_factory_; 141 base::WeakPtrFactory<ApplicationImpl> weak_factory_;
143 142
144 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); 143 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
145 }; 144 };
146 145
147 } // namespace mojo 146 } // namespace mojo
148 147
149 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ 148 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698