| 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_WEBRTC_INTERNALS_MESSAGE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_INTERNALS_MESSAGE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_INTERNALS_MESSAGE_HANDLER_H_ | 6 #define CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_INTERNALS_MESSAGE_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/browser/media/webrtc/webrtc_internals_ui_observer.h" | 10 #include "content/browser/media/webrtc/webrtc_internals_ui_observer.h" |
| 11 #include "content/public/browser/web_ui_message_handler.h" | 11 #include "content/public/browser/web_ui_message_handler.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class ListValue; | 14 class ListValue; |
| 15 } // namespace base | 15 } // namespace base |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class RenderFrameHost; | 19 class RenderFrameHost; |
| 20 class WebRTCInternals; |
| 20 | 21 |
| 21 // This class handles messages to and from WebRTCInternalsUI. | 22 // This class handles messages to and from WebRTCInternalsUI. |
| 22 // It delegates all its work to WebRTCInternalsProxy on the IO thread. | 23 // It delegates all its work to WebRTCInternalsProxy on the IO thread. |
| 23 class WebRTCInternalsMessageHandler : public WebUIMessageHandler, | 24 class CONTENT_EXPORT WebRTCInternalsMessageHandler |
| 24 public WebRTCInternalsUIObserver{ | 25 : public WebUIMessageHandler, |
| 26 public NON_EXPORTED_BASE(WebRTCInternalsUIObserver) { |
| 25 public: | 27 public: |
| 26 WebRTCInternalsMessageHandler(); | 28 WebRTCInternalsMessageHandler(); |
| 27 ~WebRTCInternalsMessageHandler() override; | 29 ~WebRTCInternalsMessageHandler() override; |
| 28 | 30 |
| 29 // WebUIMessageHandler implementation. | 31 // WebUIMessageHandler implementation. |
| 30 void RegisterMessages() override; | 32 void RegisterMessages() override; |
| 31 | 33 |
| 32 // WebRTCInternalsUIObserver override. | 34 // WebRTCInternalsUIObserver override. |
| 33 void OnUpdate(const std::string& command, const base::Value* args) override; | 35 void OnUpdate(const std::string& command, const base::Value* args) override; |
| 34 | 36 |
| 37 protected: |
| 38 // The WebRTCInternals to use. Always WebRTCInternals::GetInstance() |
| 39 // except for testing. |
| 40 explicit WebRTCInternalsMessageHandler(WebRTCInternals* webrtc_internals); |
| 41 WebRTCInternals* const webrtc_internals_; |
| 42 |
| 35 private: | 43 private: |
| 36 // Returns a pointer to the RFH iff it is currently hosting the | 44 // Returns a pointer to the RFH iff it is currently hosting the |
| 37 // webrtc-internals page. | 45 // webrtc-internals page. |
| 38 RenderFrameHost* GetWebRTCInternalsHost() const; | 46 RenderFrameHost* GetWebRTCInternalsHost() const; |
| 39 | 47 |
| 40 // Javascript message handler. | 48 // Javascript message handler. |
| 41 void OnGetAllStats(const base::ListValue* list); | 49 void OnGetAllStats(const base::ListValue* list); |
| 42 void OnSetAudioDebugRecordingsEnabled(bool enable, | 50 void OnSetAudioDebugRecordingsEnabled(bool enable, |
| 43 const base::ListValue* list); | 51 const base::ListValue* list); |
| 44 void OnSetEventLogRecordingsEnabled(bool enable, const base::ListValue* list); | 52 void OnSetEventLogRecordingsEnabled(bool enable, const base::ListValue* list); |
| 45 void OnDOMLoadDone(const base::ListValue* list); | 53 void OnDOMLoadDone(const base::ListValue* list); |
| 46 | 54 |
| 47 DISALLOW_COPY_AND_ASSIGN(WebRTCInternalsMessageHandler); | 55 DISALLOW_COPY_AND_ASSIGN(WebRTCInternalsMessageHandler); |
| 48 }; | 56 }; |
| 49 | 57 |
| 50 } // namespace content | 58 } // namespace content |
| 51 | 59 |
| 52 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_INTERNALS_MESSAGE_HANDLER_H_ | 60 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_INTERNALS_MESSAGE_HANDLER_H_ |
| OLD | NEW |