Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: chrome/browser/ui/webui/media/media_internals_proxy.cc

Issue 8515027: Define the public version of the browser side RenderProcessHost interface. This interface is not ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/ui/webui/media/media_internals_proxy.h" 5 #include "chrome/browser/ui/webui/media/media_internals_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/io_thread.h" 9 #include "chrome/browser/io_thread.h"
10 #include "chrome/browser/media/media_internals.h" 10 #include "chrome/browser/media/media_internals.h"
11 #include "chrome/browser/ui/webui/media/media_internals_handler.h" 11 #include "chrome/browser/ui/webui/media/media_internals_handler.h"
12 #include "content/public/browser/notification_service.h" 12 #include "content/public/browser/notification_service.h"
13 #include "content/browser/renderer_host/render_process_host.h"
14 #include "content/public/browser/notification_types.h" 13 #include "content/public/browser/notification_types.h"
14 #include "content/public/browser/render_process_host.h"
15 15
16 using content::BrowserThread; 16 using content::BrowserThread;
17 17
18 static const int kMediaInternalsProxyEventDelayMilliseconds = 100; 18 static const int kMediaInternalsProxyEventDelayMilliseconds = 100;
19 19
20 static const net::NetLog::EventType kNetEventTypeFilter[] = { 20 static const net::NetLog::EventType kNetEventTypeFilter[] = {
21 net::NetLog::TYPE_DISK_CACHE_ENTRY_IMPL, 21 net::NetLog::TYPE_DISK_CACHE_ENTRY_IMPL,
22 net::NetLog::TYPE_SPARSE_READ, 22 net::NetLog::TYPE_SPARSE_READ,
23 net::NetLog::TYPE_SPARSE_WRITE, 23 net::NetLog::TYPE_SPARSE_WRITE,
24 net::NetLog::TYPE_URL_REQUEST_START_JOB, 24 net::NetLog::TYPE_URL_REQUEST_START_JOB,
25 net::NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS, 25 net::NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS,
26 }; 26 };
27 27
28 MediaInternalsProxy::MediaInternalsProxy() 28 MediaInternalsProxy::MediaInternalsProxy()
29 : ThreadSafeObserverImpl(net::NetLog::LOG_ALL_BUT_BYTES) { 29 : ThreadSafeObserverImpl(net::NetLog::LOG_ALL_BUT_BYTES) {
30 io_thread_ = g_browser_process->io_thread(); 30 io_thread_ = g_browser_process->io_thread();
31 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 31 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
32 content::NotificationService::AllBrowserContextsAndSources()); 32 content::NotificationService::AllBrowserContextsAndSources());
33 } 33 }
34 34
35 void MediaInternalsProxy::Observe(int type, 35 void MediaInternalsProxy::Observe(int type,
36 const content::NotificationSource& source, 36 const content::NotificationSource& source,
37 const content::NotificationDetails& details) { 37 const content::NotificationDetails& details) {
38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
39 DCHECK_EQ(type, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); 39 DCHECK_EQ(type, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED);
40 RenderProcessHost* process = content::Source<RenderProcessHost>(source).ptr(); 40 RenderProcessHost* process = content::Source<RenderProcessHost>(source).ptr();
41 CallJavaScriptFunctionOnUIThread("media.onRendererTerminated", 41 CallJavaScriptFunctionOnUIThread("media.onRendererTerminated",
42 base::Value::CreateIntegerValue(process->id())); 42 base::Value::CreateIntegerValue(process->GetID()));
43 } 43 }
44 44
45 void MediaInternalsProxy::Attach(MediaInternalsMessageHandler* handler) { 45 void MediaInternalsProxy::Attach(MediaInternalsMessageHandler* handler) {
46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
47 handler_ = handler; 47 handler_ = handler;
48 BrowserThread::PostTask( 48 BrowserThread::PostTask(
49 BrowserThread::IO, FROM_HERE, 49 BrowserThread::IO, FROM_HERE,
50 base::Bind(&MediaInternalsProxy::ObserveMediaInternalsOnIOThread, this)); 50 base::Bind(&MediaInternalsProxy::ObserveMediaInternalsOnIOThread, this));
51 } 51 }
52 52
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 void MediaInternalsProxy::CallJavaScriptFunctionOnUIThread( 181 void MediaInternalsProxy::CallJavaScriptFunctionOnUIThread(
182 const std::string& function, Value* args) { 182 const std::string& function, Value* args) {
183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
184 scoped_ptr<Value> args_value(args); 184 scoped_ptr<Value> args_value(args);
185 std::vector<const Value*> args_vector; 185 std::vector<const Value*> args_vector;
186 args_vector.push_back(args_value.get()); 186 args_vector.push_back(args_value.get());
187 string16 update = WebUI::GetJavascriptCall(function, args_vector); 187 string16 update = WebUI::GetJavascriptCall(function, args_vector);
188 UpdateUIOnUIThread(update); 188 UpdateUIOnUIThread(update);
189 } 189 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698