Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_SHELL_CONTENT_HANDLER_CONNECTION_H_ | |
| 6 #define MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "mojo/application/public/interfaces/content_handler.mojom.h" | |
| 11 #include "mojo/public/cpp/bindings/error_handler.h" | |
| 12 #include "url/gurl.h" | |
| 13 | |
| 14 namespace mojo { | |
| 15 namespace shell { | |
| 16 | |
| 17 class ApplicationManager; | |
| 18 | |
| 19 // A ContentHandlerConnection is responsible for creating and maintaining a | |
| 20 // connection to an app which provides the ContentHandler service. | |
| 21 // A ContentHandlerConnection can only be destroyed via CloseConnection. | |
| 22 // A ContentHandlerConnection manages its own lifetime and cannot be used with | |
| 23 // a scoped_ptr to avoid reentrant calls into ApplicationManager late in | |
| 24 // destruction. | |
| 25 class ContentHandlerConnection : public ErrorHandler { | |
| 26 public: | |
| 27 ContentHandlerConnection(ApplicationManager* manager, | |
| 28 const GURL& content_handler_url, | |
| 29 const GURL& requestor_url, | |
| 30 const std::string& qualifier); | |
| 31 | |
| 32 void CloseConnection(); | |
| 33 | |
| 34 ContentHandler* content_handler() { return content_handler_.get(); } | |
| 35 | |
|
jam
2015/07/09 17:27:23
nit: no blank line?
Fady Samuel
2015/07/09 17:49:22
Done.
| |
| 36 const GURL& content_handler_url() { return content_handler_url_; } | |
| 37 const std::string& content_handler_qualifier() { | |
| 38 return content_handler_qualifier_; | |
| 39 } | |
| 40 | |
| 41 private: | |
| 42 ~ContentHandlerConnection() override; | |
| 43 | |
| 44 // ErrorHandler implementation: | |
| 45 void OnConnectionError() override; | |
| 46 | |
| 47 ApplicationManager* manager_; | |
| 48 GURL content_handler_url_; | |
| 49 std::string content_handler_qualifier_; | |
| 50 ContentHandlerPtr content_handler_; | |
| 51 bool connection_closed_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection); | |
| 54 }; | |
| 55 | |
| 56 } // namespace shell | |
| 57 } // namespace mojo | |
| 58 | |
| 59 #endif // MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_ | |
| OLD | NEW |