| 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 CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ | 6 #define CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 static BrowserCdmManager* FromProcess(int render_process_id); | 37 static BrowserCdmManager* FromProcess(int render_process_id); |
| 38 | 38 |
| 39 // Constructs the BrowserCdmManager for |render_process_id| which runs on | 39 // Constructs the BrowserCdmManager for |render_process_id| which runs on |
| 40 // |task_runner|. | 40 // |task_runner|. |
| 41 // If |task_runner| is not NULL, all CDM messages are posted to it. Otherwise, | 41 // If |task_runner| is not NULL, all CDM messages are posted to it. Otherwise, |
| 42 // all messages are posted to the browser UI thread. | 42 // all messages are posted to the browser UI thread. |
| 43 BrowserCdmManager(int render_process_id, | 43 BrowserCdmManager(int render_process_id, |
| 44 const scoped_refptr<base::TaskRunner>& task_runner); | 44 const scoped_refptr<base::TaskRunner>& task_runner); |
| 45 | 45 |
| 46 // BrowserMessageFilter implementations. | 46 // BrowserMessageFilter implementations. |
| 47 virtual void OnDestruct() const override; | 47 void OnDestruct() const override; |
| 48 virtual base::TaskRunner* OverrideTaskRunnerForMessage( | 48 base::TaskRunner* OverrideTaskRunnerForMessage( |
| 49 const IPC::Message& message) override; | 49 const IPC::Message& message) override; |
| 50 virtual bool OnMessageReceived(const IPC::Message& message) override; | 50 bool OnMessageReceived(const IPC::Message& message) override; |
| 51 | 51 |
| 52 media::BrowserCdm* GetCdm(int render_frame_id, int cdm_id); | 52 media::BrowserCdm* GetCdm(int render_frame_id, int cdm_id); |
| 53 | 53 |
| 54 // Notifies that the render frame has been deleted so that all CDMs belongs | 54 // Notifies that the render frame has been deleted so that all CDMs belongs |
| 55 // to this render frame needs to be destroyed as well. This is needed because | 55 // to this render frame needs to be destroyed as well. This is needed because |
| 56 // in some cases (e.g. fast termination of the renderer), the message to | 56 // in some cases (e.g. fast termination of the renderer), the message to |
| 57 // destroy the CDM will not be received. | 57 // destroy the CDM will not be received. |
| 58 void RenderFrameDeleted(int render_frame_id); | 58 void RenderFrameDeleted(int render_frame_id); |
| 59 | 59 |
| 60 protected: | 60 protected: |
| 61 friend class base::RefCountedThreadSafe<BrowserCdmManager>; | 61 friend class base::RefCountedThreadSafe<BrowserCdmManager>; |
| 62 friend class base::DeleteHelper<BrowserCdmManager>; | 62 friend class base::DeleteHelper<BrowserCdmManager>; |
| 63 virtual ~BrowserCdmManager(); | 63 ~BrowserCdmManager() override; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 // CDM callbacks. | 66 // CDM callbacks. |
| 67 void OnSessionCreated(int render_frame_id, | 67 void OnSessionCreated(int render_frame_id, |
| 68 int cdm_id, | 68 int cdm_id, |
| 69 uint32 session_id, | 69 uint32 session_id, |
| 70 const std::string& web_session_id); | 70 const std::string& web_session_id); |
| 71 void OnSessionMessage(int render_frame_id, | 71 void OnSessionMessage(int render_frame_id, |
| 72 int cdm_id, | 72 int cdm_id, |
| 73 uint32 session_id, | 73 uint32 session_id, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 // Map of callbacks to cancel the permission request. | 153 // Map of callbacks to cancel the permission request. |
| 154 std::map<uint64, base::Closure> cdm_cancel_permission_map_; | 154 std::map<uint64, base::Closure> cdm_cancel_permission_map_; |
| 155 | 155 |
| 156 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager); | 156 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager); |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 } // namespace content | 159 } // namespace content |
| 160 | 160 |
| 161 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ | 161 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ |
| OLD | NEW |