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

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 content::RenderProcessHost* process =
41 content::Source<content::RenderProcessHost>(source).ptr();
41 CallJavaScriptFunctionOnUIThread("media.onRendererTerminated", 42 CallJavaScriptFunctionOnUIThread("media.onRendererTerminated",
42 base::Value::CreateIntegerValue(process->id())); 43 base::Value::CreateIntegerValue(process->GetID()));
43 } 44 }
44 45
45 void MediaInternalsProxy::Attach(MediaInternalsMessageHandler* handler) { 46 void MediaInternalsProxy::Attach(MediaInternalsMessageHandler* handler) {
46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
47 handler_ = handler; 48 handler_ = handler;
48 BrowserThread::PostTask( 49 BrowserThread::PostTask(
49 BrowserThread::IO, FROM_HERE, 50 BrowserThread::IO, FROM_HERE,
50 base::Bind(&MediaInternalsProxy::ObserveMediaInternalsOnIOThread, this)); 51 base::Bind(&MediaInternalsProxy::ObserveMediaInternalsOnIOThread, this));
51 } 52 }
52 53
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 181
181 void MediaInternalsProxy::CallJavaScriptFunctionOnUIThread( 182 void MediaInternalsProxy::CallJavaScriptFunctionOnUIThread(
182 const std::string& function, Value* args) { 183 const std::string& function, Value* args) {
183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
184 scoped_ptr<Value> args_value(args); 185 scoped_ptr<Value> args_value(args);
185 std::vector<const Value*> args_vector; 186 std::vector<const Value*> args_vector;
186 args_vector.push_back(args_value.get()); 187 args_vector.push_back(args_value.get());
187 string16 update = WebUI::GetJavascriptCall(function, args_vector); 188 string16 update = WebUI::GetJavascriptCall(function, args_vector);
188 UpdateUIOnUIThread(update); 189 UpdateUIOnUIThread(update);
189 } 190 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc ('k') | chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698