Add CefPrintHandler::OnPrintStart callback (issue #1736)

This commit is contained in:
Marshall Greenblatt
2015-10-12 16:45:14 -04:00
parent f7d9457c20
commit 1f21fe5412
13 changed files with 143 additions and 9 deletions

View File

@ -4,6 +4,8 @@
#include "libcef/browser/extensions/browser_extensions_util.h"
#include "libcef/common/extensions/extensions_util.h"
#include "content/browser/browser_plugin/browser_plugin_embedder.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/web_contents/web_contents_impl.h"
@ -55,4 +57,27 @@ content::WebContents* GetOwnerForGuestContents(content::WebContents* guest) {
return NULL;
}
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForView(int render_process_id,
int render_routing_id) {
content::RenderViewHost* host =
content::RenderViewHost::FromID(render_process_id, render_routing_id);
if (host)
return GetOwnerBrowserForHost(host);
return NULL;
}
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForHost(
content::RenderViewHost* host) {
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForHost(host);
if (!browser.get() && ExtensionsEnabled()) {
// Retrieve the owner browser, if any.
content::WebContents* owner = GetOwnerForGuestContents(
content::WebContents::FromRenderViewHost(host));
if (owner)
browser = CefBrowserHostImpl::GetBrowserForContents(owner);
}
return browser;
}
} // namespace extensions