Home | History | Annotate | Download | only in media
      1 // Copyright 2013 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 CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
      6 #define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
      7 
      8 #include <string>
      9 
     10 #include "base/memory/scoped_ptr.h"
     11 #include "base/strings/string16.h"
     12 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h"
     13 
     14 namespace media {
     15 class MediaKeys;
     16 }
     17 
     18 namespace content {
     19 
     20 class WebContentDecryptionModuleSessionImpl;
     21 class SessionIdAdapter;
     22 
     23 class WebContentDecryptionModuleImpl
     24     : public WebKit::WebContentDecryptionModule {
     25  public:
     26   static WebContentDecryptionModuleImpl* Create(const string16& key_system);
     27 
     28   virtual ~WebContentDecryptionModuleImpl();
     29 
     30   // WebKit::WebContentDecryptionModule implementation.
     31   virtual WebKit::WebContentDecryptionModuleSession* createSession(
     32       WebKit::WebContentDecryptionModuleSession::Client* client);
     33 
     34  private:
     35   // Takes ownership of |media_keys| and |adapter|.
     36   WebContentDecryptionModuleImpl(scoped_ptr<media::MediaKeys> media_keys,
     37                                  scoped_ptr<SessionIdAdapter> adapter);
     38 
     39   // Called when a WebContentDecryptionModuleSessionImpl is closed.
     40   void OnSessionClosed(const std::string& session_id);
     41 
     42   scoped_ptr<media::MediaKeys> media_keys_;
     43   scoped_ptr<SessionIdAdapter> adapter_;
     44 
     45   DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl);
     46 };
     47 
     48 }  // namespace content
     49 
     50 #endif  // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
     51