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 using media::ChromeWebRTCInternals; | |
15 | |
16 WebRTCInternalsMessageHandler::WebRTCInternalsMessageHandler() { | |
17 ChromeWebRTCInternals::GetInstance()->AddObserver(this); | |
18 } | |
19 | |
20 WebRTCInternalsMessageHandler::~WebRTCInternalsMessageHandler() { | |
21 ChromeWebRTCInternals::GetInstance()->RemoveObserver(this); | |
22 } | |
23 | |
24 void WebRTCInternalsMessageHandler::RegisterMessages() { | |
25 } | |
26 | |
27 void WebRTCInternalsMessageHandler::OnUpdate(const std::string& command, | |
28 const base::Value* args) { | |
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
30 std::vector<const Value*> args_vector; | |
31 args_vector.push_back(args); | |
32 string16 update = content::WebUI::GetJavascriptCall(command, args_vector); | |
33 | |
34 // Don't try to execute JavaScript in a RenderView that no longer exists. | |
jam
2013/01/18 18:27:33
nit: this comment is just explainging what the cod
jiayl
2013/01/18 19:20:00
Done.
| |
35 content::RenderViewHost* host = | |
36 web_ui()->GetWebContents()->GetRenderViewHost(); | |
37 if (host) | |
38 host->ExecuteJavascriptInWebFrame(string16(), update); | |
39 } | |
OLD | NEW |