From: Cheng Zhao Date: Thu, 5 Feb 2015 08:17:45 +0000 (-0800) Subject: A little clean up X-Git-Tag: v0.21.2~2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=071a55974a2e761e4fe0afdd3631d880c91e3a6c;p=electron.git A little clean up --- diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 637f2aae..d3c453ff 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -39,13 +39,13 @@ v8::Persistent template_; // Get the window that has the |guest| embedded. NativeWindow* GetWindowFromGuest(const content::WebContents* guest) { - auto process = guest->GetRenderProcessHost(); WebViewManager::WebViewInfo info; - if (WebViewManager::GetInfoForProcess(process, &info)) + if (WebViewManager::GetInfoForProcess(guest->GetRenderProcessHost(), &info)) + return NativeWindow::FromRenderView( + info.embedder->GetRenderProcessHost()->GetID(), + info.embedder->GetRoutingID()); + else return nullptr; - return NativeWindow::FromRenderView( - info.embedder->GetRenderProcessHost()->GetID(), - info.embedder->GetRoutingID()); } } // namespace diff --git a/atom/browser/api/atom_api_web_view_manager.cc b/atom/browser/api/atom_api_web_view_manager.cc index fa235293..ed796be8 100644 --- a/atom/browser/api/atom_api_web_view_manager.cc +++ b/atom/browser/api/atom_api_web_view_manager.cc @@ -3,9 +3,9 @@ // found in the LICENSE file. #include "atom/browser/api/atom_api_web_contents.h" -#include "atom/browser/atom_browser_context.h" #include "atom/browser/web_view_manager.h" #include "atom/common/native_mate_converters/gurl_converter.h" +#include "content/public/browser/browser_context.h" #include "native_mate/dictionary.h" #include "net/base/filename_util.h" @@ -56,8 +56,9 @@ atom::WebViewManager* GetWebViewManager(content::WebContents* web_contents) { if (context) { auto manager = context->GetGuestManager(); return static_cast(manager); + } else { + return nullptr; } - return nullptr; } void AddGuest(int guest_instance_id,