Update V8 to version 4.6.54.
[chromium-blink-merge.git] / mojo / shell / content_handler_connection.h
blob19952652af5fafcf225447c79b1b325e52b2db1d
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_
8 #include <string>
10 #include "mojo/application/public/interfaces/content_handler.mojom.h"
11 #include "mojo/shell/capability_filter.h"
12 #include "url/gurl.h"
14 namespace mojo {
15 namespace shell {
17 class ApplicationInstance;
18 class ApplicationManager;
20 // A ContentHandlerConnection is responsible for creating and maintaining a
21 // connection to an app which provides the ContentHandler service.
22 // A ContentHandlerConnection can only be destroyed via CloseConnection.
23 // A ContentHandlerConnection manages its own lifetime and cannot be used with
24 // a scoped_ptr to avoid reentrant calls into ApplicationManager late in
25 // destruction.
26 class ContentHandlerConnection {
27 public:
28 ContentHandlerConnection(ApplicationInstance* originator,
29 ApplicationManager* manager,
30 const GURL& content_handler_url,
31 const GURL& requestor_url,
32 const std::string& qualifier,
33 const CapabilityFilter& filter);
35 // Closes the connection and destroys |this| object.
36 void CloseConnection();
38 ContentHandler* content_handler() { return content_handler_.get(); }
39 const GURL& content_handler_url() { return content_handler_url_; }
40 const std::string& content_handler_qualifier() {
41 return content_handler_qualifier_;
44 private:
45 ~ContentHandlerConnection();
47 ApplicationManager* manager_;
48 GURL content_handler_url_;
49 std::string content_handler_qualifier_;
50 ContentHandlerPtr content_handler_;
51 bool connection_closed_;
53 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection);
56 } // namespace shell
57 } // namespace mojo
59 #endif // MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_