Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Side by Side Diff: content/renderer/media/media_interface_provider.cc

Issue 1977173002: Rename media::interfaces to media::mojom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android + chromeos files Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/media/media_interface_provider.h ('k') | media/base/audio_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "content/renderer/media/media_interface_provider.h" 5 #include "content/renderer/media/media_interface_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "media/mojo/interfaces/content_decryption_module.mojom.h" 8 #include "media/mojo/interfaces/content_decryption_module.mojom.h"
9 #include "media/mojo/interfaces/renderer.mojom.h" 9 #include "media/mojo/interfaces/renderer.mojom.h"
10 #include "mojo/public/cpp/bindings/interface_request.h" 10 #include "mojo/public/cpp/bindings/interface_request.h"
11 #include "services/shell/public/cpp/connect.h" 11 #include "services/shell/public/cpp/connect.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 MediaInterfaceProvider::MediaInterfaceProvider( 15 MediaInterfaceProvider::MediaInterfaceProvider(
16 const ConnectToApplicationCB& connect_to_app_cb) 16 const ConnectToApplicationCB& connect_to_app_cb)
17 : connect_to_app_cb_(connect_to_app_cb) { 17 : connect_to_app_cb_(connect_to_app_cb) {
18 DCHECK(!connect_to_app_cb_.is_null()); 18 DCHECK(!connect_to_app_cb_.is_null());
19 } 19 }
20 20
21 MediaInterfaceProvider::~MediaInterfaceProvider() { 21 MediaInterfaceProvider::~MediaInterfaceProvider() {
22 DCHECK(thread_checker_.CalledOnValidThread()); 22 DCHECK(thread_checker_.CalledOnValidThread());
23 } 23 }
24 24
25 void MediaInterfaceProvider::GetInterface(const mojo::String& interface_name, 25 void MediaInterfaceProvider::GetInterface(const mojo::String& interface_name,
26 mojo::ScopedMessagePipeHandle pipe) { 26 mojo::ScopedMessagePipeHandle pipe) {
27 DVLOG(1) << __FUNCTION__; 27 DVLOG(1) << __FUNCTION__;
28 DCHECK(thread_checker_.CalledOnValidThread()); 28 DCHECK(thread_checker_.CalledOnValidThread());
29 29
30 if (interface_name == media::interfaces::ContentDecryptionModule::Name_) { 30 if (interface_name == media::mojom::ContentDecryptionModule::Name_) {
31 GetMediaServiceFactory()->CreateCdm( 31 GetMediaServiceFactory()->CreateCdm(
32 mojo::MakeRequest<media::interfaces::ContentDecryptionModule>( 32 mojo::MakeRequest<media::mojom::ContentDecryptionModule>(
33 std::move(pipe))); 33 std::move(pipe)));
34 } else if (interface_name == media::interfaces::Renderer::Name_) { 34 } else if (interface_name == media::mojom::Renderer::Name_) {
35 GetMediaServiceFactory()->CreateRenderer( 35 GetMediaServiceFactory()->CreateRenderer(
36 mojo::MakeRequest<media::interfaces::Renderer>(std::move(pipe))); 36 mojo::MakeRequest<media::mojom::Renderer>(std::move(pipe)));
37 } else if (interface_name == media::interfaces::AudioDecoder::Name_) { 37 } else if (interface_name == media::mojom::AudioDecoder::Name_) {
38 GetMediaServiceFactory()->CreateAudioDecoder( 38 GetMediaServiceFactory()->CreateAudioDecoder(
39 mojo::MakeRequest<media::interfaces::AudioDecoder>(std::move(pipe))); 39 mojo::MakeRequest<media::mojom::AudioDecoder>(std::move(pipe)));
40 } else { 40 } else {
41 NOTREACHED(); 41 NOTREACHED();
42 } 42 }
43 } 43 }
44 44
45 media::interfaces::ServiceFactory* 45 media::mojom::ServiceFactory* MediaInterfaceProvider::GetMediaServiceFactory() {
46 MediaInterfaceProvider::GetMediaServiceFactory() {
47 DVLOG(1) << __FUNCTION__; 46 DVLOG(1) << __FUNCTION__;
48 DCHECK(thread_checker_.CalledOnValidThread()); 47 DCHECK(thread_checker_.CalledOnValidThread());
49 48
50 if (!media_service_factory_) { 49 if (!media_service_factory_) {
51 shell::mojom::InterfaceProviderPtr interface_provider = 50 shell::mojom::InterfaceProviderPtr interface_provider =
52 connect_to_app_cb_.Run(GURL("mojo:media")); 51 connect_to_app_cb_.Run(GURL("mojo:media"));
53 shell::GetInterface(interface_provider.get(), &media_service_factory_); 52 shell::GetInterface(interface_provider.get(), &media_service_factory_);
54 media_service_factory_.set_connection_error_handler(base::Bind( 53 media_service_factory_.set_connection_error_handler(base::Bind(
55 &MediaInterfaceProvider::OnConnectionError, base::Unretained(this))); 54 &MediaInterfaceProvider::OnConnectionError, base::Unretained(this)));
56 } 55 }
57 56
58 return media_service_factory_.get(); 57 return media_service_factory_.get();
59 } 58 }
60 59
61 void MediaInterfaceProvider::OnConnectionError() { 60 void MediaInterfaceProvider::OnConnectionError() {
62 DVLOG(1) << __FUNCTION__; 61 DVLOG(1) << __FUNCTION__;
63 DCHECK(thread_checker_.CalledOnValidThread()); 62 DCHECK(thread_checker_.CalledOnValidThread());
64 63
65 media_service_factory_.reset(); 64 media_service_factory_.reset();
66 } 65 }
67 66
68 } // namespace content 67 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_interface_provider.h ('k') | media/base/audio_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698