Chromium Code Reviews| Index: chrome/browser/chrome_content_browser_client.cc | 
| diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc | 
| index 46e0df995800347283bff89e3fb9f0b3c3aa3ac9..480b80d6ac012556c9858abdc0e31c5608e9ecf4 100644 | 
| --- a/chrome/browser/chrome_content_browser_client.cc | 
| +++ b/chrome/browser/chrome_content_browser_client.cc | 
| @@ -100,6 +100,7 @@ | 
| #include "chrome/browser/webshare/share_service_impl.h" | 
| #include "chrome/common/channel_info.h" | 
| #include "chrome/common/chrome_constants.h" | 
| +#include "chrome/common/chrome_features.h" | 
| #include "chrome/common/chrome_paths.h" | 
| #include "chrome/common/chrome_switches.h" | 
| #include "chrome/common/env_vars.h" | 
| @@ -209,6 +210,8 @@ | 
| #if defined(OS_WIN) | 
| #include "base/strings/string_tokenizer.h" | 
| #include "chrome/browser/chrome_browser_main_win.h" | 
| +#include "chrome/browser/conflicts/module_database_win.h" | 
| +#include "chrome/browser/conflicts/module_event_sink_impl_win.h" | 
| #include "sandbox/win/src/sandbox_policy.h" | 
| #elif defined(OS_MACOSX) | 
| #include "chrome/browser/chrome_browser_main_mac.h" | 
| @@ -2945,6 +2948,16 @@ bool ChromeContentBrowserClient::PreSpawnRenderer( | 
| } | 
| #endif // defined(OS_WIN) | 
| +namespace { | 
| + | 
| +// Utility function for use with ExposeInterfacesToRenderer. | 
| +base::ProcessHandle GetProcessHandleFromRenderer( | 
| + content::RenderProcessHost* render_process_host) { | 
| + return render_process_host->GetHandle(); | 
| +} | 
| + | 
| +} // namespace | 
| + | 
| void ChromeContentBrowserClient::ExposeInterfacesToRenderer( | 
| service_manager::InterfaceRegistry* registry, | 
| content::RenderProcessHost* render_process_host) { | 
| @@ -2965,6 +2978,23 @@ void ChromeContentBrowserClient::ExposeInterfacesToRenderer( | 
| g_browser_process->rappor_service()), | 
| ui_task_runner); | 
| +#if defined(OS_WIN) | 
| + if (base::FeatureList::IsEnabled(features::kModuleDatabase)) { | 
| + // Add the ModuleDatabase interface. This is the interface used by renderer | 
| + // processes to notify the browser of modules in their address space. It | 
| + // ultimately drives the chrome://conflicts UI. The process handle is not | 
| + // yet available at this point so pass in a callback to allow it to be | 
| + // retrieved at the time the interface is actually created. | 
| + auto get_process = base::Bind(&GetProcessHandleFromRenderer, | 
| 
 
grt (UTC plus 2)
2017/01/06 09:44:58
can you cut out the middle-man with:
  base::Bind(
 
chrisha
2017/01/10 21:01:46
Indeed. /facepalm
 
 | 
| + base::Unretained(render_process_host)); | 
| + registry->AddInterface( | 
| + base::Bind(&ModuleEventSinkImpl::Create, get_process, | 
| 
 
grt (UTC plus 2)
2017/01/06 09:44:58
nit: pass ownership of get_process to the bound ca
 
chrisha
2017/01/10 21:01:46
Done.
 
 | 
| + content::PROCESS_TYPE_RENDERER, | 
| + base::Unretained(ModuleDatabase::GetInstance())), | 
| + ui_task_runner); | 
| + } | 
| +#endif | 
| + | 
| #if defined(OS_CHROMEOS) | 
| registry->AddInterface<metrics::mojom::LeakDetector>( | 
| base::Bind(&metrics::LeakDetectorRemoteController::Create), |