[Media,Android] Moved OnSuspend and OnResume out of #if defined(VIDEO_HOLE)
[chromium-blink-merge.git] / mojo / shell / content_handler_connection.h
blob749e6b4b81eca35c0708b8a47f50f0430d2fc1e2
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 "url/gurl.h"
13 namespace mojo {
14 namespace shell {
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
23 // destruction.
24 class ContentHandlerConnection {
25 public:
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_;
40 private:
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);
52 } // namespace shell
53 } // namespace mojo
55 #endif // MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_