| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/media/media_internals_handler.h" | 5 #include "content/browser/media/media_internals_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/browser//media/media_internals_proxy.h" | 10 #include "content/browser//media/media_internals_proxy.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 void MediaInternalsMessageHandler::RegisterMessages() { | 25 void MediaInternalsMessageHandler::RegisterMessages() { |
| 26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 26 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 27 proxy_->Attach(this); | 27 proxy_->Attach(this); |
| 28 | 28 |
| 29 web_ui()->RegisterMessageCallback("getEverything", | 29 web_ui()->RegisterMessageCallback("getEverything", |
| 30 base::Bind(&MediaInternalsMessageHandler::OnGetEverything, | 30 base::Bind(&MediaInternalsMessageHandler::OnGetEverything, |
| 31 base::Unretained(this))); | 31 base::Unretained(this))); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void MediaInternalsMessageHandler::OnGetEverything(const ListValue* list) { | 34 void MediaInternalsMessageHandler::OnGetEverything( |
| 35 const base::ListValue* list) { |
| 35 proxy_->GetEverything(); | 36 proxy_->GetEverything(); |
| 36 } | 37 } |
| 37 | 38 |
| 38 void MediaInternalsMessageHandler::OnUpdate(const string16& update) { | 39 void MediaInternalsMessageHandler::OnUpdate(const string16& update) { |
| 39 // Don't try to execute JavaScript in a RenderView that no longer exists. | 40 // Don't try to execute JavaScript in a RenderView that no longer exists. |
| 40 RenderViewHost* host = web_ui()->GetWebContents()->GetRenderViewHost(); | 41 RenderViewHost* host = web_ui()->GetWebContents()->GetRenderViewHost(); |
| 41 if (host) | 42 if (host) |
| 42 host->ExecuteJavascriptInWebFrame(string16(), update); | 43 host->ExecuteJavascriptInWebFrame(string16(), update); |
| 43 } | 44 } |
| 44 | 45 |
| 45 } // namespace content | 46 } // namespace content |
| OLD | NEW |