OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_CONTENT_HANDLER_CONNECTION_H_ | 5 #ifndef MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_ |
6 #define MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_ | 6 #define MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "mojo/application/public/interfaces/content_handler.mojom.h" | 10 #include "mojo/application/public/interfaces/content_handler.mojom.h" |
11 #include "mojo/shell/capability_filter.h" | 11 #include "mojo/shell/capability_filter.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 namespace shell { | 15 namespace shell { |
16 | 16 |
17 class ApplicationInstance; | |
18 class ApplicationManager; | 17 class ApplicationManager; |
| 18 struct Identity; |
19 | 19 |
20 // A ContentHandlerConnection is responsible for creating and maintaining a | 20 // A ContentHandlerConnection is responsible for creating and maintaining a |
21 // connection to an app which provides the ContentHandler service. | 21 // connection to an app which provides the ContentHandler service. |
22 // A ContentHandlerConnection can only be destroyed via CloseConnection. | 22 // A ContentHandlerConnection can only be destroyed via CloseConnection. |
23 // A ContentHandlerConnection manages its own lifetime and cannot be used with | 23 // A ContentHandlerConnection manages its own lifetime and cannot be used with |
24 // a scoped_ptr to avoid reentrant calls into ApplicationManager late in | 24 // a scoped_ptr to avoid reentrant calls into ApplicationManager late in |
25 // destruction. | 25 // destruction. |
26 class ContentHandlerConnection { | 26 class ContentHandlerConnection { |
27 public: | 27 public: |
28 // |id| is a unique identifier for this content handler. | 28 // |id| is a unique identifier for this content handler. |
29 ContentHandlerConnection(ApplicationInstance* originator, | 29 ContentHandlerConnection(ApplicationManager* manager, |
30 ApplicationManager* manager, | 30 const Identity& originator_identity, |
| 31 const CapabilityFilter& originator_filter, |
31 const GURL& content_handler_url, | 32 const GURL& content_handler_url, |
32 const GURL& requestor_url, | |
33 const std::string& qualifier, | 33 const std::string& qualifier, |
34 const CapabilityFilter& filter, | 34 const CapabilityFilter& filter, |
35 uint32_t id); | 35 uint32_t id); |
36 | 36 |
37 // Closes the connection and destroys |this| object. | 37 // Closes the connection and destroys |this| object. |
38 void CloseConnection(); | 38 void CloseConnection(); |
39 | 39 |
40 ContentHandler* content_handler() { return content_handler_.get(); } | 40 ContentHandler* content_handler() { return content_handler_.get(); } |
41 const GURL& content_handler_url() { return content_handler_url_; } | 41 const GURL& content_handler_url() { return content_handler_url_; } |
42 const std::string& content_handler_qualifier() { | 42 const std::string& content_handler_qualifier() { |
(...skipping 12 matching lines...) Expand all Loading... |
55 // The id for this content handler. | 55 // The id for this content handler. |
56 const uint32_t id_; | 56 const uint32_t id_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection); | 58 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace shell | 61 } // namespace shell |
62 } // namespace mojo | 62 } // namespace mojo |
63 | 63 |
64 #endif // MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_ | 64 #endif // MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_ |
OLD | NEW |