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

Side by Side Diff: mojo/package_manager/content_handler_connection.h

Issue 1566253002: Move package_manager into mojo/shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 11 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
(Empty)
1 // Copyright 2015 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 MOJO_PACKAGE_MANAGER_CONTENT_HANDLER_CONNECTION_H_
6 #define MOJO_PACKAGE_MANAGER_CONTENT_HANDLER_CONNECTION_H_
7
8 #include <stdint.h>
9
10 #include <string>
11
12 #include "base/callback.h"
13 #include "base/macros.h"
14 #include "mojo/application/public/interfaces/content_handler.mojom.h"
15 #include "mojo/shell/identity.h"
16 #include "url/gurl.h"
17
18 namespace mojo {
19 namespace shell {
20 class ApplicationManager;
21 }
22 namespace package_manager {
23
24 // A ContentHandlerConnection is responsible for creating and maintaining a
25 // connection to an app which provides the ContentHandler service.
26 // A ContentHandlerConnection can only be destroyed via CloseConnection.
27 // A ContentHandlerConnection manages its own lifetime and cannot be used with
28 // a scoped_ptr to avoid reentrant calls into ApplicationManager late in
29 // destruction.
30 class ContentHandlerConnection {
31 public:
32 using ClosedCallback = base::Callback<void(ContentHandlerConnection*)>;
33 // |id| is a unique identifier for this content handler.
34 ContentHandlerConnection(shell::ApplicationManager* manager,
35 const shell::Identity& source,
36 const shell::Identity& content_handler,
37 uint32_t id,
38 const ClosedCallback& connection_closed_callback);
39
40 void StartApplication(InterfaceRequest<Application> request,
41 URLResponsePtr response);
42
43 // Closes the connection and destroys |this| object.
44 void CloseConnection();
45
46 const shell::Identity& identity() const { return identity_; }
47 uint32_t id() const { return id_; }
48
49 private:
50 ~ContentHandlerConnection();
51
52 void ApplicationDestructed();
53
54 ClosedCallback connection_closed_callback_;
55 shell::Identity identity_;
56
57 ContentHandlerPtr content_handler_;
58 bool connection_closed_;
59 // The id for this content handler.
60 const uint32_t id_;
61 int ref_count_;
62
63 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection);
64 };
65
66 } // namespace package_manager
67 } // namespace mojo
68
69 #endif // MOJO_PACKAGE_MANAGER_CONTENT_HANDLER_CONNECTION_H_
OLDNEW
« no previous file with comments | « mojo/package_manager/capability_filter_content_handler_unittest.cc ('k') | mojo/package_manager/content_handler_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698