OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_WEBRTC_INTERNALS_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ |
6 #define CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ | 6 #define CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
10 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
11 #include "base/process/process.h" | 12 #include "base/process/process.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
14 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
16 #include "ui/shell_dialogs/select_file_dialog.h" | 17 #include "ui/shell_dialogs/select_file_dialog.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
| 20 |
| 21 class PowerSaveBlocker; |
19 class WebContents; | 22 class WebContents; |
20 class WebRTCInternalsUIObserver; | 23 class WebRTCInternalsUIObserver; |
21 | 24 |
22 // This is a singleton class running in the browser UI thread. | 25 // This is a singleton class running in the browser UI thread. |
23 // It collects peer connection infomation from the renderers, | 26 // It collects peer connection infomation from the renderers, |
24 // forwards the data to WebRTCInternalsUIObserver and | 27 // forwards the data to WebRTCInternalsUIObserver and |
25 // sends data collecting commands to the renderers. | 28 // sends data collecting commands to the renderers. |
26 class CONTENT_EXPORT WebRTCInternals : public NotificationObserver, | 29 class CONTENT_EXPORT WebRTCInternals : public NotificationObserver, |
27 public ui::SelectFileDialog::Listener { | 30 public ui::SelectFileDialog::Listener { |
28 public: | 31 public: |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 virtual void FileSelectionCanceled(void* params) OVERRIDE; | 127 virtual void FileSelectionCanceled(void* params) OVERRIDE; |
125 | 128 |
126 // Called when a renderer exits (including crashes). | 129 // Called when a renderer exits (including crashes). |
127 void OnRendererExit(int render_process_id); | 130 void OnRendererExit(int render_process_id); |
128 | 131 |
129 #if defined(ENABLE_WEBRTC) | 132 #if defined(ENABLE_WEBRTC) |
130 // Enables AEC dump on all render process hosts using |aec_dump_file_path_|. | 133 // Enables AEC dump on all render process hosts using |aec_dump_file_path_|. |
131 void EnableAecDumpOnAllRenderProcessHosts(); | 134 void EnableAecDumpOnAllRenderProcessHosts(); |
132 #endif | 135 #endif |
133 | 136 |
| 137 // Called whenever an element is added to or removed from |
| 138 // |peer_connection_data_| to impose/release a block on suspending the current |
| 139 // application for power-saving. |
| 140 void CreateOrReleasePowerSaveBlocker(); |
| 141 |
134 ObserverList<WebRTCInternalsUIObserver> observers_; | 142 ObserverList<WebRTCInternalsUIObserver> observers_; |
135 | 143 |
136 // |peer_connection_data_| is a list containing all the PeerConnection | 144 // |peer_connection_data_| is a list containing all the PeerConnection |
137 // updates. | 145 // updates. |
138 // Each item of the list represents the data for one PeerConnection, which | 146 // Each item of the list represents the data for one PeerConnection, which |
139 // contains these fields: | 147 // contains these fields: |
140 // "rid" -- the renderer id. | 148 // "rid" -- the renderer id. |
141 // "pid" -- OS process id of the renderer that creates the PeerConnection. | 149 // "pid" -- OS process id of the renderer that creates the PeerConnection. |
142 // "lid" -- local Id assigned to the PeerConnection. | 150 // "lid" -- local Id assigned to the PeerConnection. |
143 // "url" -- url of the web page that created the PeerConnection. | 151 // "url" -- url of the web page that created the PeerConnection. |
(...skipping 15 matching lines...) Expand all Loading... |
159 base::ListValue get_user_media_requests_; | 167 base::ListValue get_user_media_requests_; |
160 | 168 |
161 NotificationRegistrar registrar_; | 169 NotificationRegistrar registrar_; |
162 | 170 |
163 // For managing select file dialog. | 171 // For managing select file dialog. |
164 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 172 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
165 | 173 |
166 // AEC dump (diagnostic echo canceller recording) state. | 174 // AEC dump (diagnostic echo canceller recording) state. |
167 bool aec_dump_enabled_; | 175 bool aec_dump_enabled_; |
168 base::FilePath aec_dump_file_path_; | 176 base::FilePath aec_dump_file_path_; |
| 177 |
| 178 // While |peer_connection_data_| is non-empty, hold an instance of |
| 179 // PowerSaveBlocker. This prevents the application from being suspended while |
| 180 // remoting. |
| 181 scoped_ptr<PowerSaveBlocker> power_save_blocker_; |
169 }; | 182 }; |
170 | 183 |
171 } // namespace content | 184 } // namespace content |
172 | 185 |
173 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ | 186 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ |
OLD | NEW |