OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ |
6 #define MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "media/mojo/interfaces/service_factory.mojom.h" | 15 #include "media/mojo/interfaces/service_factory.mojom.h" |
16 #include "media/mojo/services/media_mojo_export.h" | 16 #include "media/mojo/services/media_mojo_export.h" |
17 #include "services/shell/public/cpp/interface_factory.h" | 17 #include "services/shell/public/cpp/interface_factory.h" |
18 #include "services/shell/public/cpp/shell_client.h" | 18 #include "services/shell/public/cpp/service.h" |
19 #include "services/shell/public/cpp/shell_connection_ref.h" | 19 #include "services/shell/public/cpp/shell_connection_ref.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 namespace media { | 22 namespace media { |
23 | 23 |
24 class MediaLog; | 24 class MediaLog; |
25 class MojoMediaClient; | 25 class MojoMediaClient; |
26 | 26 |
27 class MEDIA_MOJO_EXPORT MojoMediaApplication | 27 class MEDIA_MOJO_EXPORT MojoMediaApplication |
28 : public NON_EXPORTED_BASE(shell::ShellClient), | 28 : public NON_EXPORTED_BASE(shell::Service), |
29 public NON_EXPORTED_BASE(shell::InterfaceFactory<mojom::ServiceFactory>) { | 29 public NON_EXPORTED_BASE(shell::InterfaceFactory<mojom::ServiceFactory>) { |
30 public: | 30 public: |
31 MojoMediaApplication(std::unique_ptr<MojoMediaClient> mojo_media_client, | 31 MojoMediaApplication(std::unique_ptr<MojoMediaClient> mojo_media_client, |
32 const base::Closure& quit_closure); | 32 const base::Closure& quit_closure); |
33 ~MojoMediaApplication() final; | 33 ~MojoMediaApplication() final; |
34 | 34 |
35 private: | 35 private: |
36 // shell::ShellClient implementation. | 36 // shell::Service implementation. |
37 void Initialize(shell::Connector* connector, | 37 void OnStart(shell::Connector* connector, |
38 const shell::Identity& identity, | 38 const shell::Identity& identity, |
39 uint32_t id) final; | 39 uint32_t id) final; |
40 bool AcceptConnection(shell::Connection* connection) final; | 40 bool OnConnect(shell::Connection* connection) final; |
41 bool ShellConnectionLost() final; | 41 bool OnStop() final; |
42 | 42 |
43 // shell::InterfaceFactory<mojom::ServiceFactory> implementation. | 43 // shell::InterfaceFactory<mojom::ServiceFactory> implementation. |
44 void Create(shell::Connection* connection, | 44 void Create(shell::Connection* connection, |
45 mojo::InterfaceRequest<mojom::ServiceFactory> request) final; | 45 mojo::InterfaceRequest<mojom::ServiceFactory> request) final; |
46 | 46 |
47 // Note: Since each instance runs on a different thread, do not share a common | 47 // Note: Since each instance runs on a different thread, do not share a common |
48 // MojoMediaClient with other instances to avoid threading issues. Hence using | 48 // MojoMediaClient with other instances to avoid threading issues. Hence using |
49 // a unique_ptr here. | 49 // a unique_ptr here. |
50 std::unique_ptr<MojoMediaClient> mojo_media_client_; | 50 std::unique_ptr<MojoMediaClient> mojo_media_client_; |
51 | 51 |
52 shell::Connector* connector_; | 52 shell::Connector* connector_; |
53 scoped_refptr<MediaLog> media_log_; | 53 scoped_refptr<MediaLog> media_log_; |
54 shell::ShellConnectionRefFactory ref_factory_; | 54 shell::ShellConnectionRefFactory ref_factory_; |
55 }; | 55 }; |
56 | 56 |
57 } // namespace media | 57 } // namespace media |
58 | 58 |
59 #endif // MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ | 59 #endif // MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ |
OLD | NEW |