| 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_PACKAGE_MANAGER_CONTENT_HANDLER_CONNECTION_H_ | 5 #ifndef MOJO_PACKAGE_MANAGER_CONTENT_HANDLER_CONNECTION_H_ |
| 6 #define MOJO_PACKAGE_MANAGER_CONTENT_HANDLER_CONNECTION_H_ | 6 #define MOJO_PACKAGE_MANAGER_CONTENT_HANDLER_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class ContentHandlerConnection { | 27 class ContentHandlerConnection { |
| 28 public: | 28 public: |
| 29 using ClosedCallback = base::Callback<void(ContentHandlerConnection*)>; | 29 using ClosedCallback = base::Callback<void(ContentHandlerConnection*)>; |
| 30 // |id| is a unique identifier for this content handler. | 30 // |id| is a unique identifier for this content handler. |
| 31 ContentHandlerConnection(shell::ApplicationManager* manager, | 31 ContentHandlerConnection(shell::ApplicationManager* manager, |
| 32 const shell::Identity& source, | 32 const shell::Identity& source, |
| 33 const shell::Identity& content_handler, | 33 const shell::Identity& content_handler, |
| 34 uint32_t id, | 34 uint32_t id, |
| 35 const ClosedCallback& connection_closed_callback); | 35 const ClosedCallback& connection_closed_callback); |
| 36 | 36 |
| 37 void StartApplication(InterfaceRequest<Application> request, |
| 38 URLResponsePtr response); |
| 39 |
| 37 // Closes the connection and destroys |this| object. | 40 // Closes the connection and destroys |this| object. |
| 38 void CloseConnection(); | 41 void CloseConnection(); |
| 39 | 42 |
| 40 ContentHandler* content_handler() { return content_handler_.get(); } | |
| 41 const shell::Identity& identity() const { return identity_; } | 43 const shell::Identity& identity() const { return identity_; } |
| 42 uint32_t id() const { return id_; } | 44 uint32_t id() const { return id_; } |
| 43 | 45 |
| 44 private: | 46 private: |
| 45 ~ContentHandlerConnection(); | 47 ~ContentHandlerConnection(); |
| 46 | 48 |
| 49 void ApplicationDestructed(); |
| 50 |
| 47 ClosedCallback connection_closed_callback_; | 51 ClosedCallback connection_closed_callback_; |
| 48 shell::Identity identity_; | 52 shell::Identity identity_; |
| 49 | 53 |
| 50 ContentHandlerPtr content_handler_; | 54 ContentHandlerPtr content_handler_; |
| 51 bool connection_closed_; | 55 bool connection_closed_; |
| 52 // The id for this content handler. | 56 // The id for this content handler. |
| 53 const uint32_t id_; | 57 const uint32_t id_; |
| 58 int ref_count_; |
| 54 | 59 |
| 55 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection); | 60 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection); |
| 56 }; | 61 }; |
| 57 | 62 |
| 58 } // namespace package_manager | 63 } // namespace package_manager |
| 59 } // namespace mojo | 64 } // namespace mojo |
| 60 | 65 |
| 61 #endif // MOJO_PACKAGE_MANAGER_CONTENT_HANDLER_CONNECTION_H_ | 66 #endif // MOJO_PACKAGE_MANAGER_CONTENT_HANDLER_CONNECTION_H_ |
| OLD | NEW |