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

Side by Side Diff: mojo/shell/public/cpp/shell.h

Issue 1675083002: Rename ApplicationDelegate to ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
Patch Set: . Created 4 years, 10 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
« no previous file with comments | « mojo/shell/public/cpp/service_connector.h ('k') | mojo/shell/public/cpp/shell_client.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_SHELL_PUBLIC_CPP_SHELL_H_ 5 #ifndef MOJO_SHELL_PUBLIC_CPP_SHELL_H_
6 #define MOJO_SHELL_PUBLIC_CPP_SHELL_H_ 6 #define MOJO_SHELL_PUBLIC_CPP_SHELL_H_
7 7
8 #include "mojo/shell/public/cpp/app_lifetime_helper.h" 8 #include "mojo/shell/public/cpp/app_lifetime_helper.h"
9 #include "mojo/shell/public/cpp/application_connection.h" 9 #include "mojo/shell/public/cpp/connection.h"
10 #include "mojo/shell/public/interfaces/application.mojom.h" 10 #include "mojo/shell/public/interfaces/application.mojom.h"
11 #include "mojo/shell/public/interfaces/shell.mojom.h" 11 #include "mojo/shell/public/interfaces/shell.mojom.h"
12 12
13 namespace mojo { 13 namespace mojo {
14 14
15 shell::mojom::CapabilityFilterPtr CreatePermissiveCapabilityFilter(); 15 shell::mojom::CapabilityFilterPtr CreatePermissiveCapabilityFilter();
16 16
17 using ApplicationRequest = InterfaceRequest<shell::mojom::Application>; 17 using ApplicationRequest = InterfaceRequest<shell::mojom::Application>;
18 18
19 class Shell { 19 class Shell {
(...skipping 15 matching lines...) Expand all
35 private: 35 private:
36 URLRequestPtr request_; 36 URLRequestPtr request_;
37 shell::mojom::CapabilityFilterPtr filter_; 37 shell::mojom::CapabilityFilterPtr filter_;
38 38
39 DISALLOW_COPY_AND_ASSIGN(ConnectParams); 39 DISALLOW_COPY_AND_ASSIGN(ConnectParams);
40 }; 40 };
41 41
42 // Requests a new connection to an application. Returns a pointer to the 42 // Requests a new connection to an application. Returns a pointer to the
43 // connection if the connection is permitted by this application's delegate, 43 // connection if the connection is permitted by this application's delegate,
44 // or nullptr otherwise. Caller takes ownership. 44 // or nullptr otherwise. Caller takes ownership.
45 virtual scoped_ptr<ApplicationConnection> ConnectToApplication( 45 virtual scoped_ptr<Connection> ConnectToApplication(
46 const std::string& url) = 0; 46 const std::string& url) = 0;
47 virtual scoped_ptr<ApplicationConnection> ConnectToApplication( 47 virtual scoped_ptr<Connection> ConnectToApplication(
48 ConnectParams* params) = 0; 48 ConnectParams* params) = 0;
49 49
50 // Connect to application identified by |request->url| and connect to the 50 // Connect to application identified by |request->url| and connect to the
51 // service implementation of the interface identified by |Interface|. 51 // service implementation of the interface identified by |Interface|.
52 template <typename Interface> 52 template <typename Interface>
53 void ConnectToService(ConnectParams* params, InterfacePtr<Interface>* ptr) { 53 void ConnectToService(ConnectParams* params, InterfacePtr<Interface>* ptr) {
54 scoped_ptr<ApplicationConnection> connection = ConnectToApplication(params); 54 scoped_ptr<Connection> connection = ConnectToApplication(params);
55 if (!connection.get()) 55 if (!connection.get())
56 return; 56 return;
57 connection->ConnectToService(ptr); 57 connection->ConnectToService(ptr);
58 } 58 }
59 template <typename Interface> 59 template <typename Interface>
60 void ConnectToService(const std::string& url, InterfacePtr<Interface>* ptr) { 60 void ConnectToService(const std::string& url, InterfacePtr<Interface>* ptr) {
61 ConnectParams params(url); 61 ConnectParams params(url);
62 params.set_filter(CreatePermissiveCapabilityFilter()); 62 params.set_filter(CreatePermissiveCapabilityFilter());
63 return ConnectToService(&params, ptr); 63 return ConnectToService(&params, ptr);
64 } 64 }
65 65
66 // Initiate shutdown of this application. This may involve a round trip to the 66 // Initiate shutdown of this application. This may involve a round trip to the
67 // Shell to ensure there are no inbound service requests. 67 // Shell to ensure there are no inbound service requests.
68 virtual void Quit() = 0; 68 virtual void Quit() = 0;
69 69
70 // Create an object that can be used to refcount the lifetime of the 70 // Create an object that can be used to refcount the lifetime of the
71 // application. The returned object may be cloned, and when the refcount falls 71 // application. The returned object may be cloned, and when the refcount falls
72 // to zero Quit() is called. 72 // to zero Quit() is called.
73 virtual scoped_ptr<AppRefCount> CreateAppRefCount() = 0; 73 virtual scoped_ptr<AppRefCount> CreateAppRefCount() = 0;
74 }; 74 };
75 75
76 } // namespace mojo 76 } // namespace mojo
77 77
78 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_H_ 78 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_H_
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/service_connector.h ('k') | mojo/shell/public/cpp/shell_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698