Avoid using global BrowserContext

This commit is contained in:
Cheng Zhao 2015-02-04 15:08:29 -08:00
parent 502c0f0df7
commit 2c61070b36
4 changed files with 34 additions and 25 deletions

View file

@ -39,10 +39,9 @@ v8::Persistent<v8::ObjectTemplate> template_;
// Get the window that has the |guest| embedded.
NativeWindow* GetWindowFromGuest(const content::WebContents* guest) {
auto manager = AtomBrowserContext::Get()->GetGuestManager();
int guest_process_id = guest->GetRenderProcessHost()->GetID();
auto process = guest->GetRenderProcessHost();
WebViewManager::WebViewInfo info;
if (!static_cast<WebViewManager*>(manager)->GetInfo(guest_process_id, &info))
if (WebViewManager::GetInfoForProcess(process, &info))
return nullptr;
return NativeWindow::FromRenderView(
info.embedder->GetRenderProcessHost()->GetID(),