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

Side by Side Diff: services/shell/public/cpp/service.h

Issue 2118083002: ShellClient -> Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus2
Patch Set: . Created 4 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
« no previous file with comments | « services/shell/public/cpp/names.h ('k') | services/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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_SHELL_PUBLIC_CPP_SERVICE_H_
6 #define SERVICES_SHELL_PUBLIC_CPP_SERVICE_H_
7
8 #include <stdint.h>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "services/shell/public/cpp/connection.h"
13 #include "services/shell/public/cpp/identity.h"
14
15 namespace shell {
16
17 class Connector;
18
19 // The primary contract between a Service and the Service Manager, receiving
20 // lifecycle notifications and connection requests.
21 class Service {
22 public:
23 Service();
24 virtual ~Service();
25
26 // Called once a bidirectional connection with the Service Manager has been
27 // established.
28 // |identity| is the identity of the service instance.
29 // |id| is a unique identifier the Service Manager uses to identify this
30 // specific instance of the service.
31 // Called exactly once before any other method.
32 virtual void OnStart(Connector* connector,
33 const Identity& identity,
34 uint32_t id);
35
36 // Called when a connection to this service is brokered by the Service
37 // Manager. Override to expose interfaces to the remote service. Return true
38 // if the connection should succeed. Return false if the connection should
39 // be rejected and the underlying pipe closed. The default implementation
40 // returns false.
41 virtual bool OnConnect(Connection* connection);
42
43 // Called when the Service Manager has stopped tracking this instance. The
44 // service should use this as a signal to exit, and in fact its process may
45 // be reaped shortly afterward.
46 // Return true from this method to tell the ShellConnection to run its
47 // connection lost closure if it has one, false to prevent it from being run.
48 // The default implementation returns true.
49 // When used in conjunction with ApplicationRunner, returning true here quits
50 // the message loop created by ApplicationRunner, which results in the service
51 // quitting.
52 virtual bool OnStop();
53
54 // TODO(rockot): remove
55 virtual InterfaceProvider* GetInterfaceProviderForConnection();
56 virtual InterfaceRegistry* GetInterfaceRegistryForConnection();
57
58 private:
59 DISALLOW_COPY_AND_ASSIGN(Service);
60 };
61
62 } // namespace shell
63
64 #endif // SERVICES_SHELL_PUBLIC_CPP_SERVICE_H_
OLDNEW
« no previous file with comments | « services/shell/public/cpp/names.h ('k') | services/shell/public/cpp/shell_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698