OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/shared_memory.h" | |
10 #include "content/public/browser/browser_message_filter.h" | 9 #include "content/public/browser/browser_message_filter.h" |
11 | 10 |
| 11 namespace base { |
| 12 class SharedMemory; |
| 13 } // namespace base |
| 14 |
| 15 namespace net { |
| 16 class URLRequestContextGetter; |
| 17 } // namespace net |
| 18 |
| 19 class RenderProcessHost; |
| 20 |
12 // WebRtcLoggingHandlerHost handles operations regarding the WebRTC logging: | 21 // WebRtcLoggingHandlerHost handles operations regarding the WebRTC logging: |
13 // opening and closing shared memory buffer that the handler in the renderer | 22 // - Opens a shared memory buffer that the handler in the render process |
14 // process writes to. | 23 // writes to. |
| 24 // - Detects when channel, i.e. renderer, is going away and triggers uploading |
| 25 // the log. |
15 class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter { | 26 class WebRtcLoggingHandlerHost : public content::BrowserMessageFilter { |
16 public: | 27 public: |
17 WebRtcLoggingHandlerHost(); | 28 WebRtcLoggingHandlerHost(); |
18 | 29 |
19 private: | 30 private: |
| 31 friend class content::BrowserThread; |
| 32 friend class base::DeleteHelper<WebRtcLoggingHandlerHost>; |
| 33 |
| 34 virtual ~WebRtcLoggingHandlerHost(); |
| 35 |
20 // BrowserMessageFilter implementation. | 36 // BrowserMessageFilter implementation. |
21 virtual void OnChannelClosing() OVERRIDE; | 37 virtual void OnChannelClosing() OVERRIDE; |
22 virtual void OnDestruct() const OVERRIDE; | 38 virtual void OnDestruct() const OVERRIDE; |
23 virtual bool OnMessageReceived(const IPC::Message& message, | 39 virtual bool OnMessageReceived(const IPC::Message& message, |
24 bool* message_was_ok) OVERRIDE; | 40 bool* message_was_ok) OVERRIDE; |
25 | 41 |
26 friend class content::BrowserThread; | |
27 friend class base::DeleteHelper<WebRtcLoggingHandlerHost>; | |
28 | |
29 virtual ~WebRtcLoggingHandlerHost(); | |
30 | |
31 void OnOpenLog(const std::string& app_session_id, const std::string& app_url); | 42 void OnOpenLog(const std::string& app_session_id, const std::string& app_url); |
32 | 43 |
33 base::SharedMemory shared_memory_; | 44 void OpenLogIfAllowed(); |
| 45 void DoOpenLog(); |
| 46 |
| 47 void UploadLog(); |
| 48 |
| 49 scoped_refptr<net::URLRequestContextGetter> system_request_context_; |
| 50 scoped_ptr<base::SharedMemory> shared_memory_; |
34 std::string app_session_id_; | 51 std::string app_session_id_; |
35 std::string app_url_; | 52 std::string app_url_; |
36 | 53 |
37 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); | 54 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); |
38 }; | 55 }; |
39 | 56 |
40 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 57 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
OLD | NEW |