Fix the last lint warnings in chrome/
[chromium-blink-merge.git] / media / blink / webencryptedmediaclient_impl.h
blobd5319527070b710e0f51a11478f6016d57a5568f
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_
6 #define MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_
8 #include <string>
10 #include "base/containers/scoped_ptr_hash_map.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "media/base/cdm_factory.h"
14 #include "media/base/media_export.h"
15 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
16 #include "third_party/WebKit/public/platform/WebEncryptedMediaClient.h"
17 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
19 namespace media {
21 class MediaPermission;
23 class MEDIA_EXPORT WebEncryptedMediaClientImpl
24 : public blink::WebEncryptedMediaClient {
25 public:
26 WebEncryptedMediaClientImpl(scoped_ptr<CdmFactory> cdm_factory,
27 MediaPermission* media_permission);
28 virtual ~WebEncryptedMediaClientImpl();
30 // WebEncryptedMediaClient implementation.
31 virtual void requestMediaKeySystemAccess(
32 blink::WebEncryptedMediaRequest request);
34 // Create the CDM for |key_system| and |security_origin|. The caller owns
35 // the created cdm (passed back using |result|).
36 void CreateCdm(const blink::WebString& key_system,
37 const blink::WebSecurityOrigin& security_origin,
38 blink::WebContentDecryptionModuleResult result);
40 private:
41 // Pick a supported configuration if possible, and complete the request. This
42 // method may asynchronously invoke itself after prompting for permissions.
43 void SelectSupportedConfiguration(blink::WebEncryptedMediaRequest request,
44 bool was_permission_requested,
45 bool is_permission_granted);
47 // Report usage of key system to UMA. There are 2 different counts logged:
48 // 1. The key system is requested.
49 // 2. The requested key system and options are supported.
50 // Each stat is only reported once per renderer frame per key system.
51 class Reporter;
53 // Gets the Reporter for |key_system|. If it doesn't already exist,
54 // create one.
55 Reporter* GetReporter(const std::string& key_system);
57 // Key system <-> Reporter map.
58 typedef base::ScopedPtrHashMap<std::string, Reporter> Reporters;
59 Reporters reporters_;
61 scoped_ptr<CdmFactory> cdm_factory_;
62 MediaPermission* media_permission_;
64 base::WeakPtrFactory<WebEncryptedMediaClientImpl> weak_factory_;
67 } // namespace media
69 #endif // MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_