OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/webui/media/webrtc_internals_message_handler.h" |
| 6 |
| 7 #include "chrome/browser/media/chrome_webrtc_internals.h" |
| 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/render_view_host.h" |
| 10 #include "content/public/browser/web_contents.h" |
| 11 #include "content/public/browser/web_ui.h" |
| 12 |
| 13 using content::BrowserThread; |
| 14 |
| 15 WebRTCInternalsMessageHandler::WebRTCInternalsMessageHandler() { |
| 16 ChromeWebRTCInternals::GetInstance()->AddObserver(this); |
| 17 } |
| 18 |
| 19 WebRTCInternalsMessageHandler::~WebRTCInternalsMessageHandler() { |
| 20 ChromeWebRTCInternals::GetInstance()->RemoveObserver(this); |
| 21 } |
| 22 |
| 23 void WebRTCInternalsMessageHandler::RegisterMessages() { |
| 24 } |
| 25 |
| 26 void WebRTCInternalsMessageHandler::OnUpdate(const std::string& command, |
| 27 const base::Value* args) { |
| 28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 29 std::vector<const Value*> args_vector; |
| 30 args_vector.push_back(args); |
| 31 string16 update = content::WebUI::GetJavascriptCall(command, args_vector); |
| 32 |
| 33 content::RenderViewHost* host = |
| 34 web_ui()->GetWebContents()->GetRenderViewHost(); |
| 35 if (host) |
| 36 host->ExecuteJavascriptInWebFrame(string16(), update); |
| 37 } |
OLD | NEW |