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.
5 #ifndef MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_
6 #define MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_
10 #include "mojo/application/public/interfaces/content_handler.mojom.h"
16 class ApplicationManager
;
18 // A ContentHandlerConnection is responsible for creating and maintaining a
19 // connection to an app which provides the ContentHandler service.
20 // A ContentHandlerConnection can only be destroyed via CloseConnection.
21 // A ContentHandlerConnection manages its own lifetime and cannot be used with
22 // a scoped_ptr to avoid reentrant calls into ApplicationManager late in
24 class ContentHandlerConnection
{
26 ContentHandlerConnection(ApplicationManager
* manager
,
27 const GURL
& content_handler_url
,
28 const GURL
& requestor_url
,
29 const std::string
& qualifier
);
31 // Closes the connection and destorys |this| object.
32 void CloseConnection();
34 ContentHandler
* content_handler() { return content_handler_
.get(); }
35 const GURL
& content_handler_url() { return content_handler_url_
; }
36 const std::string
& content_handler_qualifier() {
37 return content_handler_qualifier_
;
41 ~ContentHandlerConnection();
43 ApplicationManager
* manager_
;
44 GURL content_handler_url_
;
45 std::string content_handler_qualifier_
;
46 ContentHandlerPtr content_handler_
;
47 bool connection_closed_
;
49 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection
);
55 #endif // MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_