mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision ad468e8b (#292352).
- Building Chromium using SVN is no longer supported. - Remove CefDOMEvent and CefDOMEventListener (issue #933). - Remove CefRenderHandler::OnScrollOffsetChanged (http://crbug.com/404656). - Remove UR_FLAG_REPORT_LOAD_TIMING (https://codereview.chromium.org/451623002/). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1816 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -123,7 +123,8 @@ content::BrowserPluginGuestManager* CefBrowserContextImpl::GetGuestManager() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
quota::SpecialStoragePolicy* CefBrowserContextImpl::GetSpecialStoragePolicy() {
|
||||
storage::SpecialStoragePolicy*
|
||||
CefBrowserContextImpl::GetSpecialStoragePolicy() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -132,6 +133,11 @@ content::PushMessagingService*
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content::SSLHostStateDelegate*
|
||||
CefBrowserContextImpl::GetSSLHostStateDelegate() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) {
|
||||
|
@@ -41,8 +41,9 @@ class CefBrowserContextImpl : public CefBrowserContext {
|
||||
bool in_memory) OVERRIDE;
|
||||
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
|
||||
virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
|
||||
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
|
||||
virtual storage::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
|
||||
virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
|
||||
virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() OVERRIDE;
|
||||
|
||||
// CefBrowserContext methods.
|
||||
virtual net::URLRequestContextGetter* CreateRequestContext(
|
||||
|
@@ -120,7 +120,7 @@ content::BrowserPluginGuestManager* CefBrowserContextProxy::GetGuestManager() {
|
||||
return parent_->GetGuestManager();
|
||||
}
|
||||
|
||||
quota::SpecialStoragePolicy*
|
||||
storage::SpecialStoragePolicy*
|
||||
CefBrowserContextProxy::GetSpecialStoragePolicy() {
|
||||
return parent_->GetSpecialStoragePolicy();
|
||||
}
|
||||
@@ -130,6 +130,11 @@ content::PushMessagingService*
|
||||
return parent_->GetPushMessagingService();
|
||||
}
|
||||
|
||||
content::SSLHostStateDelegate*
|
||||
CefBrowserContextProxy::GetSSLHostStateDelegate() {
|
||||
return parent_->GetSSLHostStateDelegate();
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter* CefBrowserContextProxy::CreateRequestContext(
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) {
|
||||
|
@@ -49,8 +49,9 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
||||
bool in_memory) OVERRIDE;
|
||||
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
|
||||
virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE;
|
||||
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
|
||||
virtual storage::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
|
||||
virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE;
|
||||
virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() OVERRIDE;
|
||||
|
||||
// CefBrowserContext methods.
|
||||
virtual net::URLRequestContextGetter* CreateRequestContext(
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include "base/bind_helpers.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "components/pdf/common/pdf_messages.h"
|
||||
#include "content/browser/gpu/compositor_util.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/common/view_messages.h"
|
||||
@@ -57,7 +58,7 @@
|
||||
#include "ui/shell_dialogs/selected_file_info.h"
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
#include "ui/gfx/font_render_params_linux.h"
|
||||
#include "ui/gfx/font_render_params.h"
|
||||
#endif
|
||||
|
||||
#if defined(USE_AURA)
|
||||
@@ -428,57 +429,14 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::CreateInternal(
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
content::RendererPreferences* prefs = web_contents->GetMutableRendererPrefs();
|
||||
const gfx::FontRenderParams& params = gfx::GetDefaultWebKitFontRenderParams();
|
||||
CR_DEFINE_STATIC_LOCAL(const gfx::FontRenderParams, params,
|
||||
(gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(true), NULL)));
|
||||
prefs->should_antialias_text = params.antialiasing;
|
||||
prefs->use_subpixel_positioning = params.subpixel_positioning;
|
||||
switch (params.hinting) {
|
||||
case gfx::FontRenderParams::HINTING_NONE:
|
||||
prefs->hinting = content::RENDERER_PREFERENCES_HINTING_NONE;
|
||||
break;
|
||||
case gfx::FontRenderParams::HINTING_SLIGHT:
|
||||
prefs->hinting = content::RENDERER_PREFERENCES_HINTING_SLIGHT;
|
||||
break;
|
||||
case gfx::FontRenderParams::HINTING_MEDIUM:
|
||||
prefs->hinting = content::RENDERER_PREFERENCES_HINTING_MEDIUM;
|
||||
break;
|
||||
case gfx::FontRenderParams::HINTING_FULL:
|
||||
prefs->hinting = content::RENDERER_PREFERENCES_HINTING_FULL;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED() << "Unhandled hinting style " << params.hinting;
|
||||
prefs->hinting = content::RENDERER_PREFERENCES_HINTING_SYSTEM_DEFAULT;
|
||||
break;
|
||||
}
|
||||
prefs->hinting = params.hinting;
|
||||
prefs->use_autohinter = params.autohinter;
|
||||
prefs->use_bitmaps = params.use_bitmaps;
|
||||
switch (params.subpixel_rendering) {
|
||||
case gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE:
|
||||
prefs->subpixel_rendering =
|
||||
content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE;
|
||||
break;
|
||||
case gfx::FontRenderParams::SUBPIXEL_RENDERING_RGB:
|
||||
prefs->subpixel_rendering =
|
||||
content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB;
|
||||
break;
|
||||
case gfx::FontRenderParams::SUBPIXEL_RENDERING_BGR:
|
||||
prefs->subpixel_rendering =
|
||||
content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR;
|
||||
break;
|
||||
case gfx::FontRenderParams::SUBPIXEL_RENDERING_VRGB:
|
||||
prefs->subpixel_rendering =
|
||||
content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB;
|
||||
break;
|
||||
case gfx::FontRenderParams::SUBPIXEL_RENDERING_VBGR:
|
||||
prefs->subpixel_rendering =
|
||||
content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED() << "Unhandled subpixel rendering style "
|
||||
<< params.subpixel_rendering;
|
||||
prefs->subpixel_rendering =
|
||||
content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT;
|
||||
break;
|
||||
}
|
||||
prefs->subpixel_rendering = params.subpixel_rendering;
|
||||
web_contents->GetRenderViewHost()->SyncRendererPrefs();
|
||||
#endif // defined(OS_LINUX) || defined(OS_ANDROID)
|
||||
|
||||
@@ -1552,8 +1510,8 @@ void CefBrowserHostImpl::LoadString(int64 frame_id, const std::string& string,
|
||||
params.request_id = -1;
|
||||
params.expect_response = false;
|
||||
|
||||
params.arguments.Append(base::Value::CreateStringValue(string));
|
||||
params.arguments.Append(base::Value::CreateStringValue(url));
|
||||
params.arguments.AppendString(string);
|
||||
params.arguments.AppendString(url);
|
||||
|
||||
Send(new CefMsg_Request(routing_id(), params));
|
||||
}
|
||||
@@ -1584,7 +1542,7 @@ void CefBrowserHostImpl::SendCommand(
|
||||
params.expect_response = false;
|
||||
}
|
||||
|
||||
params.arguments.Append(base::Value::CreateStringValue(command));
|
||||
params.arguments.AppendString(command);
|
||||
|
||||
Send(new CefMsg_Request(routing_id(), params));
|
||||
} else {
|
||||
@@ -1624,10 +1582,10 @@ void CefBrowserHostImpl::SendCode(
|
||||
params.expect_response = false;
|
||||
}
|
||||
|
||||
params.arguments.Append(base::Value::CreateBooleanValue(is_javascript));
|
||||
params.arguments.Append(base::Value::CreateStringValue(code));
|
||||
params.arguments.Append(base::Value::CreateStringValue(script_url));
|
||||
params.arguments.Append(base::Value::CreateIntegerValue(script_start_line));
|
||||
params.arguments.AppendBoolean(is_javascript);
|
||||
params.arguments.AppendString(code);
|
||||
params.arguments.AppendString(script_url);
|
||||
params.arguments.AppendInteger(script_start_line);
|
||||
|
||||
Send(new CefMsg_Request(routing_id(), params));
|
||||
} else {
|
||||
@@ -2359,9 +2317,9 @@ void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) {
|
||||
|
||||
void CefBrowserHostImpl::DidCommitProvisionalLoadForFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
bool is_main_frame,
|
||||
const GURL& url,
|
||||
content::PageTransition transition_type) {
|
||||
const bool is_main_frame = !render_frame_host->GetParent();
|
||||
CefRefPtr<CefFrame> frame = GetOrCreateFrame(
|
||||
render_frame_host->GetRoutingID(),
|
||||
CefFrameHostImpl::kUnspecifiedFrameId,
|
||||
@@ -2375,10 +2333,10 @@ void CefBrowserHostImpl::DidCommitProvisionalLoadForFrame(
|
||||
|
||||
void CefBrowserHostImpl::DidFailProvisionalLoad(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
bool is_main_frame,
|
||||
const GURL& validated_url,
|
||||
int error_code,
|
||||
const base::string16& error_description) {
|
||||
const bool is_main_frame = !render_frame_host->GetParent();
|
||||
CefRefPtr<CefFrame> frame = GetOrCreateFrame(
|
||||
render_frame_host->GetRoutingID(),
|
||||
CefFrameHostImpl::kUnspecifiedFrameId,
|
||||
@@ -2394,14 +2352,16 @@ void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidFailLoad(
|
||||
int64 frame_id,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
int error_code,
|
||||
const base::string16& error_description,
|
||||
content::RenderViewHost* render_view_host) {
|
||||
CefRefPtr<CefFrame> frame = GetOrCreateFrame(frame_id,
|
||||
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, base::string16(),
|
||||
const base::string16& error_description) {
|
||||
const bool is_main_frame = !render_frame_host->GetParent();
|
||||
CefRefPtr<CefFrame> frame = GetOrCreateFrame(
|
||||
render_frame_host->GetRoutingID(),
|
||||
CefFrameHostImpl::kUnspecifiedFrameId,
|
||||
is_main_frame,
|
||||
base::string16(),
|
||||
validated_url);
|
||||
OnLoadError(frame, validated_url, error_code, error_description);
|
||||
OnLoadEnd(frame, validated_url, error_code);
|
||||
@@ -2432,14 +2392,13 @@ bool CefBrowserHostImpl::OnMessageReceived(const IPC::Message& message) {
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_Request, OnRequest)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_Response, OnResponse)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_ResponseAck, OnResponseAck)
|
||||
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PDFHasUnsupportedFeature,
|
||||
IPC_MESSAGE_HANDLER(PDFHostMsg_PDFHasUnsupportedFeature,
|
||||
OnPDFHasUnsupportedFeature)
|
||||
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PDFSaveURLAs, OnPDFSaveURLAs)
|
||||
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PDFUpdateContentRestrictions,
|
||||
IPC_MESSAGE_HANDLER(PDFHostMsg_PDFSaveURLAs, OnPDFSaveURLAs)
|
||||
IPC_MESSAGE_HANDLER(PDFHostMsg_PDFUpdateContentRestrictions,
|
||||
OnPDFUpdateContentRestrictions)
|
||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(
|
||||
ChromeViewHostMsg_PDFModalPromptForPassword,
|
||||
OnPDFModalPromptForPassword)
|
||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(PDFHostMsg_PDFModalPromptForPassword,
|
||||
OnPDFModalPromptForPassword)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
return handled;
|
||||
@@ -2561,7 +2520,7 @@ void CefBrowserHostImpl::OnPDFModalPromptForPasswordClosed(
|
||||
IPC::Message* reply_message,
|
||||
bool success,
|
||||
const base::string16& actual_value) {
|
||||
ChromeViewHostMsg_PDFModalPromptForPassword::WriteReplyParams(
|
||||
PDFHostMsg_PDFModalPromptForPassword::WriteReplyParams(
|
||||
reply_message, base::UTF16ToUTF8(actual_value));
|
||||
Send(reply_message);
|
||||
}
|
||||
|
@@ -409,22 +409,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
|
||||
virtual void DidCommitProvisionalLoadForFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
bool is_main_frame,
|
||||
const GURL& url,
|
||||
content::PageTransition transition_type) OVERRIDE;
|
||||
virtual void DidFailProvisionalLoad(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
bool is_main_frame,
|
||||
const GURL& validated_url,
|
||||
int error_code,
|
||||
const base::string16& error_description) OVERRIDE;
|
||||
virtual void DocumentAvailableInMainFrame() OVERRIDE;
|
||||
virtual void DidFailLoad(int64 frame_id,
|
||||
virtual void DidFailLoad(content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url,
|
||||
bool is_main_frame,
|
||||
int error_code,
|
||||
const base::string16& error_description,
|
||||
content::RenderViewHost* render_view_host) OVERRIDE;
|
||||
const base::string16& error_description) OVERRIDE;
|
||||
virtual void PluginCrashed(const base::FilePath& plugin_path,
|
||||
base::ProcessId plugin_pid) OVERRIDE;
|
||||
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
||||
|
@@ -386,7 +386,7 @@ bool CefBrowserHostImpl::PlatformCreateWindow() {
|
||||
// Make the content view for the window have a layer. This will make all
|
||||
// sub-views have layers. This is necessary to ensure correct layer
|
||||
// ordering of all child views and their layers.
|
||||
[[[parentView window] contentView] cr_setWantsLayer:YES];
|
||||
[[[parentView window] contentView] setWantsLayer:YES];
|
||||
|
||||
// Add a reference that will be released in the dealloc handler.
|
||||
AddRef();
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#include "net/base/net_module.h"
|
||||
#include "net/proxy/proxy_resolver_v8.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#include "ui/aura/env.h"
|
||||
@@ -47,8 +46,7 @@
|
||||
|
||||
CefBrowserMainParts::CefBrowserMainParts(
|
||||
const content::MainFunctionParams& parameters)
|
||||
: BrowserMainParts(),
|
||||
proxy_v8_isolate_(NULL) {
|
||||
: BrowserMainParts() {
|
||||
}
|
||||
|
||||
CefBrowserMainParts::~CefBrowserMainParts() {
|
||||
@@ -114,12 +112,6 @@ int CefBrowserMainParts::PreCreateThreads() {
|
||||
pref_store_->SetInitializationCompleted();
|
||||
pref_service_ = pref_store_->CreateService().Pass();
|
||||
|
||||
// Create a v8::Isolate for the current thread if it doesn't already exist.
|
||||
if (!v8::Isolate::GetCurrent()) {
|
||||
proxy_v8_isolate_ = v8::Isolate::New();
|
||||
proxy_v8_isolate_->Enter();
|
||||
}
|
||||
|
||||
// Initialize the V8 proxy integration.
|
||||
net::ProxyResolverV8::EnsureIsolateCreated();
|
||||
|
||||
@@ -175,11 +167,6 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
|
||||
void CefBrowserMainParts::PostDestroyThreads() {
|
||||
pref_proxy_config_tracker_.reset(NULL);
|
||||
|
||||
if (proxy_v8_isolate_) {
|
||||
proxy_v8_isolate_->Exit();
|
||||
proxy_v8_isolate_->Dispose();
|
||||
}
|
||||
|
||||
#if defined(USE_AURA)
|
||||
aura::Env::DeleteInstance();
|
||||
delete views::ViewsDelegate::views_delegate;
|
||||
|
@@ -27,10 +27,6 @@ namespace content {
|
||||
struct MainFunctionParams;
|
||||
}
|
||||
|
||||
namespace v8 {
|
||||
class Isolate;
|
||||
}
|
||||
|
||||
class CefBrowserContext;
|
||||
class CefDevToolsDelegate;
|
||||
|
||||
@@ -78,7 +74,6 @@ class CefBrowserMainParts : public content::BrowserMainParts {
|
||||
scoped_ptr<net::ProxyConfigService> proxy_config_service_;
|
||||
scoped_refptr<CefBrowserPrefStore> pref_store_;
|
||||
scoped_ptr<PrefService> pref_service_;
|
||||
v8::Isolate* proxy_v8_isolate_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts);
|
||||
};
|
||||
|
@@ -3,21 +3,8 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/browser_main.h"
|
||||
#include "libcef/browser/context.h"
|
||||
|
||||
#include "content/browser/renderer_host/compositing_iosurface_shader_programs_mac.h"
|
||||
|
||||
void CefBrowserMainParts::PlatformInitialize() {
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
if (CefColorGetA(settings.background_color) > 0) {
|
||||
const float r =
|
||||
static_cast<float>(CefColorGetR(settings.background_color)) / 255.0f;
|
||||
const float g =
|
||||
static_cast<float>(CefColorGetG(settings.background_color)) / 255.0f;
|
||||
const float b =
|
||||
static_cast<float>(CefColorGetB(settings.background_color)) / 255.0f;
|
||||
content::CompositingIOSurfaceShaderPrograms::SetBackgroundColor(r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserMainParts::PlatformCleanup() {
|
||||
|
@@ -6,15 +6,15 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
#include "webkit/common/webpreferences.h"
|
||||
#include "content/public/common/web_preferences.h"
|
||||
|
||||
// Set default preferences based on CEF command-line flags. Chromium command-
|
||||
// line flags should not exist for these preferences.
|
||||
void SetDefaults(WebPreferences& web) {
|
||||
void SetDefaults(content::WebPreferences& web) {
|
||||
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
||||
|
||||
if (command_line.HasSwitch(switches::kDefaultEncoding)) {
|
||||
@@ -55,31 +55,32 @@ void SetDefaults(WebPreferences& web) {
|
||||
// Use the preferences from WebContentsImpl::GetWebkitPrefs and the
|
||||
// WebPreferences constructor by default. Only override features that are
|
||||
// explicitly enabled or disabled.
|
||||
void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web) {
|
||||
void BrowserToWebSettings(const CefBrowserSettings& cef,
|
||||
content::WebPreferences& web) {
|
||||
SetDefaults(web);
|
||||
|
||||
if (cef.standard_font_family.length > 0) {
|
||||
web.standard_font_family_map[webkit_glue::kCommonScript] =
|
||||
web.standard_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.standard_font_family);
|
||||
}
|
||||
if (cef.fixed_font_family.length > 0) {
|
||||
web.fixed_font_family_map[webkit_glue::kCommonScript] =
|
||||
web.fixed_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.fixed_font_family);
|
||||
}
|
||||
if (cef.serif_font_family.length > 0) {
|
||||
web.serif_font_family_map[webkit_glue::kCommonScript] =
|
||||
web.serif_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.serif_font_family);
|
||||
}
|
||||
if (cef.sans_serif_font_family.length > 0) {
|
||||
web.sans_serif_font_family_map[webkit_glue::kCommonScript] =
|
||||
web.sans_serif_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.sans_serif_font_family);
|
||||
}
|
||||
if (cef.cursive_font_family.length > 0) {
|
||||
web.cursive_font_family_map[webkit_glue::kCommonScript] =
|
||||
web.cursive_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.cursive_font_family);
|
||||
}
|
||||
if (cef.fantasy_font_family.length > 0) {
|
||||
web.fantasy_font_family_map[webkit_glue::kCommonScript] =
|
||||
web.fantasy_font_family_map[content::kCommonScript] =
|
||||
CefString(&cef.fantasy_font_family);
|
||||
}
|
||||
|
||||
|
@@ -8,8 +8,11 @@
|
||||
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
|
||||
namespace content {
|
||||
struct WebPreferences;
|
||||
}
|
||||
|
||||
void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web);
|
||||
void BrowserToWebSettings(const CefBrowserSettings& cef,
|
||||
content::WebPreferences& web);
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_SETTINGS_H_
|
||||
|
@@ -162,7 +162,7 @@ class CefBrowserURLRequest::Context
|
||||
return false;
|
||||
|
||||
std::string method = request_->GetMethod();
|
||||
StringToLowerASCII(&method);
|
||||
base::StringToLowerASCII(&method);
|
||||
net::URLFetcher::RequestType request_type = net::URLFetcher::GET;
|
||||
if (LowerCaseEqualsASCII(method, "get")) {
|
||||
} else if (LowerCaseEqualsASCII(method, "post")) {
|
||||
@@ -277,9 +277,6 @@ class CefBrowserURLRequest::Context
|
||||
upload_data_size_ = upload_data_size;
|
||||
}
|
||||
|
||||
if (cef_flags & UR_FLAG_REPORT_LOAD_TIMING)
|
||||
load_flags |= net::LOAD_ENABLE_LOAD_TIMING;
|
||||
|
||||
if (cef_flags & UR_FLAG_REPORT_RAW_HEADERS)
|
||||
load_flags |= net::LOAD_REPORT_RAW_HEADERS;
|
||||
|
||||
|
@@ -30,7 +30,7 @@ MetricsServicesManager* ChromeBrowserProcessStub::GetMetricsServicesManager() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MetricsService* ChromeBrowserProcessStub::metrics_service() {
|
||||
metrics::MetricsService* ChromeBrowserProcessStub::metrics_service() {
|
||||
NOTIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
||||
virtual void ResourceDispatcherHostCreated() OVERRIDE;
|
||||
virtual void EndSession() OVERRIDE;
|
||||
virtual MetricsServicesManager* GetMetricsServicesManager() OVERRIDE;
|
||||
virtual MetricsService* metrics_service() OVERRIDE;
|
||||
virtual metrics::MetricsService* metrics_service() OVERRIDE;
|
||||
virtual rappor::RapporService* rappor_service() OVERRIDE;
|
||||
virtual IOThread* io_thread() OVERRIDE;
|
||||
virtual WatchDogThread* watchdog_thread() OVERRIDE;
|
||||
|
@@ -41,15 +41,15 @@
|
||||
#include "content/public/browser/resource_dispatcher_host.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/storage_quota_params.h"
|
||||
#include "content/public/common/web_preferences.h"
|
||||
#include "third_party/WebKit/public/web/WebWindowFeatures.h"
|
||||
#include "ui/base/ui_base_switches.h"
|
||||
#include "url/gurl.h"
|
||||
#include "webkit/common/webpreferences.h"
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#include "base/debug/leak_annotations.h"
|
||||
#include "components/breakpad/app/breakpad_linux.h"
|
||||
#include "components/breakpad/browser/crash_handler_host_linux.h"
|
||||
#include "components/crash/app/breakpad_linux.h"
|
||||
#include "components/crash/browser/crash_handler_host_linux.h"
|
||||
#include "content/public/common/content_descriptors.h"
|
||||
#endif
|
||||
|
||||
@@ -236,7 +236,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||
const content::StorageQuotaParams& params,
|
||||
int render_process_id,
|
||||
const PermissionCallback& callback) OVERRIDE {
|
||||
if (params.storage_type != quota::kStorageTypePersistent) {
|
||||
if (params.storage_type != storage::kStorageTypePersistent) {
|
||||
// To match Chrome behavior we only support requesting quota with this
|
||||
// interface for Persistent storage type.
|
||||
callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
@@ -606,7 +606,7 @@ content::BrowserMainParts* CefContentBrowserClient::CreateBrowserMainParts(
|
||||
void CefContentBrowserClient::RenderProcessWillLaunch(
|
||||
content::RenderProcessHost* host) {
|
||||
host->GetChannel()->AddFilter(new CefBrowserMessageFilter(host));
|
||||
host->AddFilter(new PrintingMessageFilter(host->GetID()));
|
||||
host->AddFilter(new printing::PrintingMessageFilter(host->GetID()));
|
||||
|
||||
AddBrowserContextReference(
|
||||
static_cast<CefBrowserContext*>(host->GetBrowserContext()));
|
||||
@@ -643,7 +643,7 @@ bool CefContentBrowserClient::IsHandledURL(const GURL& url) {
|
||||
if (!url.is_valid())
|
||||
return false;
|
||||
const std::string& scheme = url.scheme();
|
||||
DCHECK_EQ(scheme, StringToLowerASCII(scheme));
|
||||
DCHECK_EQ(scheme, base::StringToLowerASCII(scheme));
|
||||
|
||||
if (scheme::IsInternalHandledScheme(scheme))
|
||||
return true;
|
||||
@@ -738,14 +738,15 @@ void CefContentBrowserClient::AllowCertificateError(
|
||||
int cert_error,
|
||||
const net::SSLInfo& ssl_info,
|
||||
const GURL& request_url,
|
||||
ResourceType::Type resource_type,
|
||||
content::ResourceType resource_type,
|
||||
bool overridable,
|
||||
bool strict_enforcement,
|
||||
bool expired_previous_decision,
|
||||
const base::Callback<void(bool)>& callback,
|
||||
content::CertificateRequestResultType* result) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (resource_type != ResourceType::MAIN_FRAME) {
|
||||
if (resource_type != content::ResourceType::RESOURCE_TYPE_MAIN_FRAME) {
|
||||
// A sub-resource has a certificate error. The user doesn't really
|
||||
// have a context for making the right decision, so block the request
|
||||
// hard.
|
||||
@@ -930,7 +931,7 @@ void CefContentBrowserClient::ResourceDispatcherHostCreated() {
|
||||
void CefContentBrowserClient::OverrideWebkitPrefs(
|
||||
content::RenderViewHost* rvh,
|
||||
const GURL& url,
|
||||
WebPreferences* prefs) {
|
||||
content::WebPreferences* prefs) {
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForHost(rvh);
|
||||
DCHECK(browser.get());
|
||||
|
@@ -109,9 +109,10 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
int cert_error,
|
||||
const net::SSLInfo& ssl_info,
|
||||
const GURL& request_url,
|
||||
ResourceType::Type resource_type,
|
||||
content::ResourceType resource_type,
|
||||
bool overridable,
|
||||
bool strict_enforcement,
|
||||
bool expired_previous_decision,
|
||||
const base::Callback<void(bool)>& callback,
|
||||
content::CertificateRequestResultType* result) OVERRIDE;
|
||||
virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
|
||||
@@ -139,7 +140,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
virtual void ResourceDispatcherHostCreated() OVERRIDE;
|
||||
virtual void OverrideWebkitPrefs(content::RenderViewHost* rvh,
|
||||
const GURL& url,
|
||||
WebPreferences* prefs) OVERRIDE;
|
||||
content::WebPreferences* prefs) OVERRIDE;
|
||||
virtual SkColor GetBaseBackgroundColor(content::RenderViewHost* rvh) OVERRIDE;
|
||||
virtual void BrowserURLHandlerCreated(
|
||||
content::BrowserURLHandler* handler) OVERRIDE;
|
||||
|
@@ -28,24 +28,61 @@
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "grit/cef_resources.h"
|
||||
#include "net/socket/tcp_listen_socket.h"
|
||||
#include "net/socket/tcp_server_socket.h"
|
||||
#include "ui/base/layout.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const char kTargetTypePage[] = "page";
|
||||
const char kTargetTypeServiceWorker[] = "service_worker";
|
||||
const char kTargetTypeOther[] = "other";
|
||||
|
||||
class TCPServerSocketFactory
|
||||
: public content::DevToolsHttpHandler::ServerSocketFactory {
|
||||
public:
|
||||
TCPServerSocketFactory(const std::string& address, int port, int backlog)
|
||||
: content::DevToolsHttpHandler::ServerSocketFactory(
|
||||
address, port, backlog) {}
|
||||
|
||||
private:
|
||||
// content::DevToolsHttpHandler::ServerSocketFactory.
|
||||
virtual scoped_ptr<net::ServerSocket> Create() const OVERRIDE {
|
||||
return scoped_ptr<net::ServerSocket>(
|
||||
new net::TCPServerSocket(NULL, net::NetLog::Source()));
|
||||
}
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory);
|
||||
};
|
||||
|
||||
scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>
|
||||
CreateSocketFactory(int port) {
|
||||
return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>(
|
||||
new TCPServerSocketFactory("127.0.0.1", port, 1));
|
||||
}
|
||||
|
||||
class Target : public content::DevToolsTarget {
|
||||
public:
|
||||
explicit Target(content::WebContents* web_contents);
|
||||
explicit Target(scoped_refptr<content::DevToolsAgentHost> agent_host);
|
||||
|
||||
virtual std::string GetId() const OVERRIDE { return id_; }
|
||||
virtual std::string GetId() const OVERRIDE { return agent_host_->GetId(); }
|
||||
virtual std::string GetParentId() const OVERRIDE { return std::string(); }
|
||||
virtual std::string GetType() const OVERRIDE { return kTargetTypePage; }
|
||||
virtual std::string GetTitle() const OVERRIDE { return title_; }
|
||||
virtual std::string GetType() const OVERRIDE {
|
||||
switch (agent_host_->GetType()) {
|
||||
case content::DevToolsAgentHost::TYPE_WEB_CONTENTS:
|
||||
return kTargetTypePage;
|
||||
case content::DevToolsAgentHost::TYPE_SERVICE_WORKER:
|
||||
return kTargetTypeServiceWorker;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return kTargetTypeOther;
|
||||
}
|
||||
virtual std::string GetTitle() const OVERRIDE {
|
||||
return agent_host_->GetTitle();
|
||||
}
|
||||
virtual std::string GetDescription() const OVERRIDE { return std::string(); }
|
||||
virtual GURL GetURL() const OVERRIDE { return url_; }
|
||||
virtual GURL GetURL() const OVERRIDE { return agent_host_->GetURL(); }
|
||||
virtual GURL GetFaviconURL() const OVERRIDE { return favicon_url_; }
|
||||
virtual base::TimeTicks GetLastActivityTime() const OVERRIDE {
|
||||
return last_activity_time_;
|
||||
@@ -62,45 +99,27 @@ class Target : public content::DevToolsTarget {
|
||||
|
||||
private:
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||
std::string id_;
|
||||
std::string title_;
|
||||
GURL url_;
|
||||
GURL favicon_url_;
|
||||
base::TimeTicks last_activity_time_;
|
||||
};
|
||||
|
||||
Target::Target(content::WebContents* web_contents) {
|
||||
agent_host_ =
|
||||
content::DevToolsAgentHost::GetOrCreateFor(
|
||||
web_contents->GetRenderViewHost());
|
||||
id_ = agent_host_->GetId();
|
||||
title_ = base::UTF16ToUTF8(web_contents->GetTitle());
|
||||
url_ = web_contents->GetURL();
|
||||
content::NavigationController& controller = web_contents->GetController();
|
||||
content::NavigationEntry* entry = controller.GetActiveEntry();
|
||||
if (entry != NULL && entry->GetURL().is_valid())
|
||||
favicon_url_ = entry->GetFavicon().url;
|
||||
last_activity_time_ = web_contents->GetLastActiveTime();
|
||||
Target::Target(scoped_refptr<content::DevToolsAgentHost> agent_host)
|
||||
: agent_host_(agent_host) {
|
||||
if (content::WebContents* web_contents = agent_host_->GetWebContents()) {
|
||||
content::NavigationController& controller = web_contents->GetController();
|
||||
content::NavigationEntry* entry = controller.GetActiveEntry();
|
||||
if (entry != NULL && entry->GetURL().is_valid())
|
||||
favicon_url_ = entry->GetFavicon().url;
|
||||
last_activity_time_ = web_contents->GetLastActiveTime();
|
||||
}
|
||||
}
|
||||
|
||||
bool Target::Activate() const {
|
||||
content::RenderViewHost* rvh = agent_host_->GetRenderViewHost();
|
||||
if (!rvh)
|
||||
return false;
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderViewHost(rvh);
|
||||
if (!web_contents)
|
||||
return false;
|
||||
web_contents->GetDelegate()->ActivateContents(web_contents);
|
||||
return true;
|
||||
return agent_host_->Activate();
|
||||
}
|
||||
|
||||
bool Target::Close() const {
|
||||
content::RenderViewHost* rvh = agent_host_->GetRenderViewHost();
|
||||
if (!rvh)
|
||||
return false;
|
||||
rvh->ClosePage();
|
||||
return true;
|
||||
return agent_host_->Close();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -109,8 +128,8 @@ bool Target::Close() const {
|
||||
|
||||
CefDevToolsDelegate::CefDevToolsDelegate(int port) {
|
||||
devtools_http_handler_ = content::DevToolsHttpHandler::Start(
|
||||
new net::TCPListenSocketFactory("127.0.0.1", port),
|
||||
"",
|
||||
CreateSocketFactory(port),
|
||||
std::string(),
|
||||
this,
|
||||
base::FilePath());
|
||||
}
|
||||
@@ -147,14 +166,11 @@ scoped_ptr<content::DevToolsTarget> CefDevToolsDelegate::CreateNewTarget(
|
||||
|
||||
void CefDevToolsDelegate::EnumerateTargets(TargetCallback callback) {
|
||||
TargetList targets;
|
||||
std::vector<content::RenderViewHost*> rvh_list =
|
||||
content::DevToolsAgentHost::GetValidRenderViewHosts();
|
||||
for (std::vector<content::RenderViewHost*>::iterator it = rvh_list.begin();
|
||||
it != rvh_list.end(); ++it) {
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderViewHost(*it);
|
||||
if (web_contents)
|
||||
targets.push_back(new Target(web_contents));
|
||||
content::DevToolsAgentHost::List agents =
|
||||
content::DevToolsAgentHost::GetOrCreateAll();
|
||||
for (content::DevToolsAgentHost::List::iterator it = agents.begin();
|
||||
it != agents.end(); ++it) {
|
||||
targets.push_back(new Target(*it));
|
||||
}
|
||||
callback.Run(targets);
|
||||
}
|
||||
|
@@ -9,10 +9,11 @@
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "content/public/browser/devtools_http_handler.h"
|
||||
#include "content/public/browser/devtools_manager.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
@@ -44,7 +45,7 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend(
|
||||
static_cast<CefBrowserHostImpl*>(frontend_browser.get()),
|
||||
content::DevToolsAgentHost::GetOrCreateFor(
|
||||
inspected_browser->GetWebContents()->GetRenderViewHost()).get());
|
||||
inspected_browser->GetWebContents()).get());
|
||||
|
||||
// Need to load the URL after creating the DevTools objects.
|
||||
CefDevToolsDelegate* delegate =
|
||||
@@ -75,9 +76,6 @@ CefDevToolsFrontend::CefDevToolsFrontend(
|
||||
: WebContentsObserver(frontend_browser->GetWebContents()),
|
||||
frontend_browser_(frontend_browser),
|
||||
agent_host_(agent_host) {
|
||||
frontend_host_.reset(
|
||||
content::DevToolsClientHost::CreateDevToolsFrontendHost(
|
||||
web_contents(), this));
|
||||
}
|
||||
|
||||
CefDevToolsFrontend::~CefDevToolsFrontend() {
|
||||
@@ -85,10 +83,11 @@ CefDevToolsFrontend::~CefDevToolsFrontend() {
|
||||
|
||||
void CefDevToolsFrontend::RenderViewCreated(
|
||||
content::RenderViewHost* render_view_host) {
|
||||
content::DevToolsClientHost::SetupDevToolsFrontendClient(
|
||||
web_contents()->GetRenderViewHost());
|
||||
content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor(
|
||||
agent_host_.get(), frontend_host_.get());
|
||||
if (!frontend_host_) {
|
||||
frontend_host_.reset(
|
||||
content::DevToolsFrontendHost::Create(render_view_host, this));
|
||||
agent_host_->AttachClient(this);
|
||||
}
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::DocumentOnLoadCompletedInMainFrame() {
|
||||
@@ -97,11 +96,58 @@ void CefDevToolsFrontend::DocumentOnLoadCompletedInMainFrame() {
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::WebContentsDestroyed() {
|
||||
content::DevToolsManager::GetInstance()->ClientHostClosing(
|
||||
frontend_host_.get());
|
||||
agent_host_->DetachClient();
|
||||
delete this;
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::InspectedContentsClosing() {
|
||||
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
const std::string& message) {
|
||||
std::string method;
|
||||
std::string browser_message;
|
||||
int id = 0;
|
||||
|
||||
base::ListValue* params = NULL;
|
||||
base::DictionaryValue* dict = NULL;
|
||||
scoped_ptr<base::Value> parsed_message(base::JSONReader::Read(message));
|
||||
if (!parsed_message ||
|
||||
!parsed_message->GetAsDictionary(&dict) ||
|
||||
!dict->GetString("method", &method) ||
|
||||
!dict->GetList("params", ¶ms)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (method != "sendMessageToBrowser" ||
|
||||
params->GetSize() != 1 ||
|
||||
!params->GetString(0, &browser_message)) {
|
||||
return;
|
||||
}
|
||||
dict->GetInteger("id", &id);
|
||||
|
||||
agent_host_->DispatchProtocolMessage(browser_message);
|
||||
|
||||
if (id) {
|
||||
std::string code = "InspectorFrontendAPI.embedderMessageAck(" +
|
||||
base::IntToString(id) + ",\"\");";
|
||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
|
||||
}
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend(
|
||||
const std::string& message) {
|
||||
agent_host_->DispatchProtocolMessage(message);
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
const std::string& message) {
|
||||
std::string code = "InspectorFrontendAPI.dispatchMessage(" + message + ");";
|
||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScript(javascript);
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::AgentHostClosed(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
bool replaced) {
|
||||
Close();
|
||||
}
|
||||
|
@@ -12,8 +12,7 @@
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "content/public/browser/devtools_agent_host.h"
|
||||
#include "content/public/browser/devtools_client_host.h"
|
||||
#include "content/public/browser/devtools_frontend_host_delegate.h"
|
||||
#include "content/public/browser/devtools_frontend_host.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
|
||||
namespace content {
|
||||
@@ -22,7 +21,8 @@ class WebContents;
|
||||
}
|
||||
|
||||
class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
public content::DevToolsFrontendHostDelegate {
|
||||
public content::DevToolsFrontendHost::Delegate,
|
||||
public content::DevToolsAgentHostClient {
|
||||
public:
|
||||
static CefDevToolsFrontend* Show(
|
||||
CefRefPtr<CefBrowserHostImpl> inspected_browser,
|
||||
@@ -43,20 +43,29 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
content::DevToolsAgentHost* agent_host);
|
||||
virtual ~CefDevToolsFrontend();
|
||||
|
||||
// WebContentsObserver overrides
|
||||
// WebContentsObserver overrides.
|
||||
virtual void RenderViewCreated(
|
||||
content::RenderViewHost* render_view_host) OVERRIDE;
|
||||
virtual void DocumentOnLoadCompletedInMainFrame() OVERRIDE;
|
||||
virtual void WebContentsDestroyed() OVERRIDE;
|
||||
|
||||
// DevToolsFrontendHostDelegate implementation
|
||||
virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE {}
|
||||
// content::DevToolsFrontendHost::Delegate implementation.
|
||||
virtual void HandleMessageFromDevToolsFrontend(
|
||||
const std::string& message) OVERRIDE;
|
||||
virtual void HandleMessageFromDevToolsFrontendToBackend(
|
||||
const std::string& message) OVERRIDE;
|
||||
|
||||
virtual void InspectedContentsClosing() OVERRIDE;
|
||||
// content::DevToolsAgentHostClient implementation.
|
||||
virtual void DispatchProtocolMessage(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
const std::string& message) OVERRIDE;
|
||||
virtual void AgentHostClosed(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
bool replaced) OVERRIDE;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> frontend_browser_;
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||
scoped_ptr<content::DevToolsClientHost> frontend_host_;
|
||||
scoped_ptr<content::DevToolsFrontendHost> frontend_host_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsFrontend);
|
||||
};
|
||||
|
@@ -103,10 +103,10 @@ void CefMediaCaptureDevicesDispatcher::OnVideoCaptureDevicesChanged() {
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnMediaRequestStateChanged(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int render_frame_id,
|
||||
int page_request_id,
|
||||
const GURL& security_origin,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaStreamType stream_type,
|
||||
content::MediaRequestState state) {
|
||||
}
|
||||
|
||||
|
@@ -46,10 +46,10 @@ class CefMediaCaptureDevicesDispatcher : public content::MediaObserver {
|
||||
virtual void OnVideoCaptureDevicesChanged() OVERRIDE;
|
||||
virtual void OnMediaRequestStateChanged(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int render_frame_id,
|
||||
int page_request_id,
|
||||
const GURL& security_origin,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaStreamType stream_type,
|
||||
content::MediaRequestState state) OVERRIDE;
|
||||
virtual void OnCreatingAudioStream(int render_process_id,
|
||||
int render_view_id) OVERRIDE;
|
||||
|
@@ -22,7 +22,8 @@ CefMenuCreatorRunnerLinux::~CefMenuCreatorRunnerLinux() {
|
||||
}
|
||||
|
||||
bool CefMenuCreatorRunnerLinux::RunContextMenu(CefMenuCreator* manager) {
|
||||
menu_.reset(new views::MenuRunner(manager->model()));
|
||||
menu_.reset(
|
||||
new views::MenuRunner(manager->model(), views::MenuRunner::CONTEXT_MENU));
|
||||
|
||||
gfx::Point screen_point;
|
||||
|
||||
@@ -57,8 +58,7 @@ bool CefMenuCreatorRunnerLinux::RunContextMenu(CefMenuCreator* manager) {
|
||||
menu_->RunMenuAt(manager->browser()->window_widget(),
|
||||
NULL, gfx::Rect(screen_point, gfx::Size()),
|
||||
views::MENU_ANCHOR_TOPRIGHT,
|
||||
ui::MENU_SOURCE_NONE,
|
||||
views::MenuRunner::CONTEXT_MENU);
|
||||
ui::MENU_SOURCE_NONE);
|
||||
UNUSED(result);
|
||||
|
||||
return true;
|
||||
@@ -74,4 +74,3 @@ bool CefMenuCreatorRunnerLinux::FormatLabel(base::string16& label) {
|
||||
const char16 replace[] = {L'&', 0};
|
||||
return base::ReplaceChars(label, replace, base::string16(), &label);
|
||||
}
|
||||
|
||||
|
@@ -18,13 +18,13 @@
|
||||
#include "chrome/browser/printing/printer_query.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "chrome/common/print_messages.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/notification_details.h"
|
||||
#include "content/public/browser/notification_service.h"
|
||||
#include "content/public/browser/notification_source.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "grit/generated_resources.h"
|
||||
#include "printing/metafile_impl.h"
|
||||
#include "printing/printed_document.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
@@ -57,7 +57,7 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
|
||||
inside_inner_message_loop_(false),
|
||||
cookie_(0),
|
||||
queue_(g_browser_process->print_job_manager()->queue()) {
|
||||
DCHECK(queue_);
|
||||
DCHECK(queue_.get());
|
||||
#if (defined(OS_POSIX) && !defined(OS_MACOSX)) || \
|
||||
defined(WIN_PDF_METAFILE_FOR_PRINTING)
|
||||
expecting_first_page_ = true;
|
||||
@@ -128,6 +128,9 @@ void PrintViewManagerBase::OnPdfToEmfConverted(
|
||||
const PrintHostMsg_DidPrintPage_Params& params,
|
||||
double scale_factor,
|
||||
const std::vector<base::FilePath>& emf_files) {
|
||||
if (!print_job_.get())
|
||||
return;
|
||||
|
||||
PrintedDocument* document = print_job_->document();
|
||||
if (!document)
|
||||
return;
|
||||
@@ -526,12 +529,12 @@ bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
||||
// The job was initiated by a script. Time to get the corresponding worker
|
||||
// thread.
|
||||
scoped_refptr<PrinterQuery> queued_query = queue_->PopPrinterQuery(cookie);
|
||||
if (!queued_query) {
|
||||
if (!queued_query.get()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CreateNewPrintJob(queued_query)) {
|
||||
if (!CreateNewPrintJob(queued_query.get())) {
|
||||
// Don't kill anything.
|
||||
return false;
|
||||
}
|
||||
@@ -568,7 +571,7 @@ void PrintViewManagerBase::ReleasePrinterQuery() {
|
||||
|
||||
scoped_refptr<printing::PrinterQuery> printer_query;
|
||||
printer_query = queue_->PopPrinterQuery(cookie);
|
||||
if (!printer_query)
|
||||
if (!printer_query.get())
|
||||
return;
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::IO, FROM_HERE,
|
||||
|
@@ -8,20 +8,20 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/printing/printer_query.h"
|
||||
#include "chrome/browser/printing/printing_ui_web_contents_observer.h"
|
||||
#include "chrome/browser/printing/print_job_manager.h"
|
||||
#include "chrome/browser/printing/printer_query.h"
|
||||
#include "chrome/common/print_messages.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/child_process_host.h"
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "chrome/browser/printing/print_dialog_cloud.h"
|
||||
#endif
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
namespace printing {
|
||||
|
||||
namespace {
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
@@ -49,7 +51,7 @@ static base::LazyInstance<PrintingSequencePathMap>
|
||||
g_printing_file_descriptor_map = LAZY_INSTANCE_INITIALIZER;
|
||||
#endif
|
||||
|
||||
void RenderParamsFromPrintSettings(const printing::PrintSettings& settings,
|
||||
void RenderParamsFromPrintSettings(const PrintSettings& settings,
|
||||
PrintMsg_Print_Params* params) {
|
||||
params->page_size = settings.page_setup_device_units().physical_size();
|
||||
params->content_size.SetSize(
|
||||
@@ -85,7 +87,7 @@ PrintingMessageFilter::PrintingMessageFilter(int render_process_id)
|
||||
: content::BrowserMessageFilter(PrintMsgStart),
|
||||
render_process_id_(render_process_id),
|
||||
queue_(g_browser_process->print_job_manager()->queue()) {
|
||||
DCHECK(queue_);
|
||||
DCHECK(queue_.get());
|
||||
}
|
||||
|
||||
PrintingMessageFilter::~PrintingMessageFilter() {
|
||||
@@ -174,8 +176,8 @@ void PrintingMessageFilter::OnAllocateTempFileForPrinting(
|
||||
content::WebContents* wc = GetWebContentsForRenderView(render_view_id);
|
||||
if (!wc)
|
||||
return;
|
||||
printing::PrintViewManagerBasic* print_view_manager =
|
||||
printing::PrintViewManagerBasic::FromWebContents(wc);
|
||||
PrintViewManagerBasic* print_view_manager =
|
||||
PrintViewManagerBasic::FromWebContents(wc);
|
||||
// The file descriptor is originally created in & passed from the Android
|
||||
// side, and it will handle the closing.
|
||||
const base::FileDescriptor& file_descriptor =
|
||||
@@ -208,11 +210,11 @@ void PrintingMessageFilter::OnTempFileForPrintingWritten(int render_view_id,
|
||||
content::WebContents* wc = GetWebContentsForRenderView(render_view_id);
|
||||
if (!wc)
|
||||
return;
|
||||
printing::PrintViewManagerBasic* print_view_manager =
|
||||
printing::PrintViewManagerBasic::FromWebContents(wc);
|
||||
PrintViewManagerBasic* print_view_manager =
|
||||
PrintViewManagerBasic::FromWebContents(wc);
|
||||
const base::FileDescriptor& file_descriptor =
|
||||
print_view_manager->file_descriptor();
|
||||
printing::PrintingContextAndroid::PdfWritingDone(file_descriptor.fd, true);
|
||||
PrintingContextAndroid::PdfWritingDone(file_descriptor.fd, true);
|
||||
// Invalidate the file descriptor so it doesn't accidentally get reused.
|
||||
print_view_manager->set_file_descriptor(base::FileDescriptor(-1, false));
|
||||
#endif
|
||||
@@ -244,46 +246,6 @@ content::WebContents* PrintingMessageFilter::GetWebContentsForRenderView(
|
||||
return view ? content::WebContents::FromRenderViewHost(view) : NULL;
|
||||
}
|
||||
|
||||
struct PrintingMessageFilter::GetPrintSettingsForRenderViewParams {
|
||||
printing::PrinterQuery::GetSettingsAskParam ask_user_for_settings;
|
||||
int expected_page_count;
|
||||
bool has_selection;
|
||||
printing::MarginType margin_type;
|
||||
};
|
||||
|
||||
void PrintingMessageFilter::GetPrintSettingsForRenderView(
|
||||
int render_view_id,
|
||||
GetPrintSettingsForRenderViewParams params,
|
||||
const base::Closure& callback,
|
||||
scoped_refptr<printing::PrinterQuery> printer_query) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
content::WebContents* wc = GetWebContentsForRenderView(render_view_id);
|
||||
if (wc) {
|
||||
scoped_ptr<PrintingUIWebContentsObserver> wc_observer(
|
||||
new PrintingUIWebContentsObserver(wc));
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::IO, FROM_HERE,
|
||||
base::Bind(&printing::PrinterQuery::GetSettings, printer_query,
|
||||
params.ask_user_for_settings, base::Passed(&wc_observer),
|
||||
params.expected_page_count, params.has_selection,
|
||||
params.margin_type, callback));
|
||||
} else {
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::IO, FROM_HERE,
|
||||
base::Bind(&PrintingMessageFilter::OnGetPrintSettingsFailed, this,
|
||||
callback, printer_query));
|
||||
}
|
||||
}
|
||||
|
||||
void PrintingMessageFilter::OnGetPrintSettingsFailed(
|
||||
const base::Closure& callback,
|
||||
scoped_refptr<printing::PrinterQuery> printer_query) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
printer_query->GetSettingsDone(printing::PrintSettings(),
|
||||
printing::PrintingContext::FAILED);
|
||||
callback.Run();
|
||||
}
|
||||
|
||||
void PrintingMessageFilter::OnIsPrintingEnabled(bool* is_enabled) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
*is_enabled = true;
|
||||
@@ -291,33 +253,32 @@ void PrintingMessageFilter::OnIsPrintingEnabled(bool* is_enabled) {
|
||||
|
||||
void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
scoped_refptr<printing::PrinterQuery> printer_query;
|
||||
scoped_refptr<PrinterQuery> printer_query;
|
||||
printer_query = queue_->PopPrinterQuery(0);
|
||||
if (!printer_query)
|
||||
printer_query = queue_->CreatePrinterQuery();
|
||||
if (!printer_query.get()) {
|
||||
printer_query =
|
||||
queue_->CreatePrinterQuery(render_process_id_, reply_msg->routing_id());
|
||||
}
|
||||
|
||||
// Loads default settings. This is asynchronous, only the IPC message sender
|
||||
// will hang until the settings are retrieved.
|
||||
GetPrintSettingsForRenderViewParams params;
|
||||
params.ask_user_for_settings = printing::PrinterQuery::DEFAULTS;
|
||||
params.expected_page_count = 0;
|
||||
params.has_selection = false;
|
||||
params.margin_type = printing::DEFAULT_MARGINS;
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(&PrintingMessageFilter::GetPrintSettingsForRenderView, this,
|
||||
reply_msg->routing_id(), params,
|
||||
base::Bind(&PrintingMessageFilter::OnGetDefaultPrintSettingsReply,
|
||||
this, printer_query, reply_msg),
|
||||
printer_query));
|
||||
printer_query->GetSettings(
|
||||
PrinterQuery::DEFAULTS,
|
||||
0,
|
||||
false,
|
||||
DEFAULT_MARGINS,
|
||||
base::Bind(&PrintingMessageFilter::OnGetDefaultPrintSettingsReply,
|
||||
this,
|
||||
printer_query,
|
||||
reply_msg));
|
||||
}
|
||||
|
||||
void PrintingMessageFilter::OnGetDefaultPrintSettingsReply(
|
||||
scoped_refptr<printing::PrinterQuery> printer_query,
|
||||
scoped_refptr<PrinterQuery> printer_query,
|
||||
IPC::Message* reply_msg) {
|
||||
PrintMsg_Print_Params params;
|
||||
if (!printer_query.get() ||
|
||||
printer_query->last_status() != printing::PrintingContext::OK) {
|
||||
printer_query->last_status() != PrintingContext::OK) {
|
||||
params.Reset();
|
||||
} else {
|
||||
RenderParamsFromPrintSettings(printer_query->settings(), ¶ms);
|
||||
@@ -339,27 +300,25 @@ void PrintingMessageFilter::OnGetDefaultPrintSettingsReply(
|
||||
void PrintingMessageFilter::OnScriptedPrint(
|
||||
const PrintHostMsg_ScriptedPrint_Params& params,
|
||||
IPC::Message* reply_msg) {
|
||||
scoped_refptr<printing::PrinterQuery> printer_query =
|
||||
scoped_refptr<PrinterQuery> printer_query =
|
||||
queue_->PopPrinterQuery(params.cookie);
|
||||
if (!printer_query)
|
||||
printer_query = queue_->CreatePrinterQuery();
|
||||
GetPrintSettingsForRenderViewParams settings_params;
|
||||
settings_params.ask_user_for_settings = printing::PrinterQuery::ASK_USER;
|
||||
settings_params.expected_page_count = params.expected_pages_count;
|
||||
settings_params.has_selection = params.has_selection;
|
||||
settings_params.margin_type = params.margin_type;
|
||||
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(&PrintingMessageFilter::GetPrintSettingsForRenderView, this,
|
||||
reply_msg->routing_id(), settings_params,
|
||||
base::Bind(&PrintingMessageFilter::OnScriptedPrintReply, this,
|
||||
printer_query, reply_msg),
|
||||
printer_query));
|
||||
if (!printer_query.get()) {
|
||||
printer_query =
|
||||
queue_->CreatePrinterQuery(render_process_id_, reply_msg->routing_id());
|
||||
}
|
||||
printer_query->GetSettings(
|
||||
PrinterQuery::ASK_USER,
|
||||
params.expected_pages_count,
|
||||
params.has_selection,
|
||||
params.margin_type,
|
||||
base::Bind(&PrintingMessageFilter::OnScriptedPrintReply,
|
||||
this,
|
||||
printer_query,
|
||||
reply_msg));
|
||||
}
|
||||
|
||||
void PrintingMessageFilter::OnScriptedPrintReply(
|
||||
scoped_refptr<printing::PrinterQuery> printer_query,
|
||||
scoped_refptr<PrinterQuery> printer_query,
|
||||
IPC::Message* reply_msg) {
|
||||
PrintMsg_PrintPages_Params params;
|
||||
#if defined(OS_ANDROID)
|
||||
@@ -367,14 +326,13 @@ void PrintingMessageFilter::OnScriptedPrintReply(
|
||||
// |reply_msg| before we can get the routing ID for the Android code.
|
||||
int routing_id = reply_msg->routing_id();
|
||||
#endif
|
||||
if (printer_query->last_status() != printing::PrintingContext::OK ||
|
||||
if (printer_query->last_status() != PrintingContext::OK ||
|
||||
!printer_query->settings().dpi()) {
|
||||
params.Reset();
|
||||
} else {
|
||||
RenderParamsFromPrintSettings(printer_query->settings(), ¶ms.params);
|
||||
params.params.document_cookie = printer_query->cookie();
|
||||
params.pages =
|
||||
printing::PageRange::GetPages(printer_query->settings().ranges());
|
||||
params.pages = PageRange::GetPages(printer_query->settings().ranges());
|
||||
}
|
||||
PrintHostMsg_ScriptedPrint::WriteReplyParams(reply_msg, params);
|
||||
Send(reply_msg);
|
||||
@@ -401,8 +359,8 @@ void PrintingMessageFilter::UpdateFileDescriptor(int render_view_id, int fd) {
|
||||
content::WebContents* wc = GetWebContentsForRenderView(render_view_id);
|
||||
if (!wc)
|
||||
return;
|
||||
printing::PrintViewManagerBasic* print_view_manager =
|
||||
printing::PrintViewManagerBasic::FromWebContents(wc);
|
||||
PrintViewManagerBasic* print_view_manager =
|
||||
PrintViewManagerBasic::FromWebContents(wc);
|
||||
print_view_manager->set_file_descriptor(base::FileDescriptor(fd, false));
|
||||
}
|
||||
#endif
|
||||
@@ -410,30 +368,45 @@ void PrintingMessageFilter::UpdateFileDescriptor(int render_view_id, int fd) {
|
||||
void PrintingMessageFilter::OnUpdatePrintSettings(
|
||||
int document_cookie, const base::DictionaryValue& job_settings,
|
||||
IPC::Message* reply_msg) {
|
||||
scoped_refptr<printing::PrinterQuery> printer_query;
|
||||
scoped_ptr<base::DictionaryValue> new_settings(job_settings.DeepCopy());
|
||||
|
||||
scoped_refptr<PrinterQuery> printer_query;
|
||||
printer_query = queue_->PopPrinterQuery(document_cookie);
|
||||
if (!printer_query)
|
||||
printer_query = queue_->CreatePrinterQuery();
|
||||
if (!printer_query.get()) {
|
||||
int host_id = render_process_id_;
|
||||
int routing_id = reply_msg->routing_id();
|
||||
if (!new_settings->GetInteger(printing::kPreviewInitiatorHostId,
|
||||
&host_id) ||
|
||||
!new_settings->GetInteger(printing::kPreviewInitiatorRoutingId,
|
||||
&routing_id)) {
|
||||
host_id = content::ChildProcessHost::kInvalidUniqueID;
|
||||
routing_id = content::ChildProcessHost::kInvalidUniqueID;
|
||||
}
|
||||
printer_query = queue_->CreatePrinterQuery(host_id, routing_id);
|
||||
}
|
||||
printer_query->SetSettings(
|
||||
job_settings,
|
||||
new_settings.Pass(),
|
||||
base::Bind(&PrintingMessageFilter::OnUpdatePrintSettingsReply, this,
|
||||
printer_query, reply_msg));
|
||||
}
|
||||
|
||||
void PrintingMessageFilter::OnUpdatePrintSettingsReply(
|
||||
scoped_refptr<printing::PrinterQuery> printer_query,
|
||||
scoped_refptr<PrinterQuery> printer_query,
|
||||
IPC::Message* reply_msg) {
|
||||
PrintMsg_PrintPages_Params params;
|
||||
if (!printer_query.get() ||
|
||||
printer_query->last_status() != printing::PrintingContext::OK) {
|
||||
printer_query->last_status() != PrintingContext::OK) {
|
||||
params.Reset();
|
||||
} else {
|
||||
RenderParamsFromPrintSettings(printer_query->settings(), ¶ms.params);
|
||||
params.params.document_cookie = printer_query->cookie();
|
||||
params.pages =
|
||||
printing::PageRange::GetPages(printer_query->settings().ranges());
|
||||
params.pages = PageRange::GetPages(printer_query->settings().ranges());
|
||||
}
|
||||
PrintHostMsg_UpdatePrintSettings::WriteReplyParams(reply_msg, params);
|
||||
PrintHostMsg_UpdatePrintSettings::WriteReplyParams(
|
||||
reply_msg,
|
||||
params,
|
||||
printer_query &&
|
||||
(printer_query->last_status() == printing::PrintingContext::CANCEL));
|
||||
Send(reply_msg);
|
||||
// If user hasn't cancelled.
|
||||
if (printer_query.get()) {
|
||||
@@ -444,3 +417,5 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace printing
|
||||
|
@@ -26,10 +26,10 @@ class WebContents;
|
||||
}
|
||||
|
||||
namespace printing {
|
||||
class PrinterQuery;
|
||||
|
||||
class PrintJobManager;
|
||||
class PrintQueriesQueue;
|
||||
}
|
||||
class PrinterQuery;
|
||||
|
||||
// This class filters out incoming printing related IPC messages for the
|
||||
// renderer process on the IPC thread.
|
||||
@@ -81,35 +81,21 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
|
||||
// to base::Bind.
|
||||
struct GetPrintSettingsForRenderViewParams;
|
||||
|
||||
// Retrieve print settings. Uses |render_view_id| to get a parent
|
||||
// for any UI created if needed.
|
||||
void GetPrintSettingsForRenderView(
|
||||
int render_view_id,
|
||||
GetPrintSettingsForRenderViewParams params,
|
||||
const base::Closure& callback,
|
||||
scoped_refptr<printing::PrinterQuery> printer_query);
|
||||
|
||||
void OnGetPrintSettingsFailed(
|
||||
const base::Closure& callback,
|
||||
scoped_refptr<printing::PrinterQuery> printer_query);
|
||||
|
||||
// Checks if printing is enabled.
|
||||
void OnIsPrintingEnabled(bool* is_enabled);
|
||||
|
||||
// Get the default print setting.
|
||||
void OnGetDefaultPrintSettings(IPC::Message* reply_msg);
|
||||
void OnGetDefaultPrintSettingsReply(
|
||||
scoped_refptr<printing::PrinterQuery> printer_query,
|
||||
IPC::Message* reply_msg);
|
||||
void OnGetDefaultPrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
|
||||
IPC::Message* reply_msg);
|
||||
|
||||
// The renderer host have to show to the user the print dialog and returns
|
||||
// the selected print settings. The task is handled by the print worker
|
||||
// thread and the UI thread. The reply occurs on the IO thread.
|
||||
void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params,
|
||||
IPC::Message* reply_msg);
|
||||
void OnScriptedPrintReply(
|
||||
scoped_refptr<printing::PrinterQuery> printer_query,
|
||||
IPC::Message* reply_msg);
|
||||
void OnScriptedPrintReply(scoped_refptr<PrinterQuery> printer_query,
|
||||
IPC::Message* reply_msg);
|
||||
|
||||
// Modify the current print settings based on |job_settings|. The task is
|
||||
// handled by the print worker thread and the UI thread. The reply occurs on
|
||||
@@ -117,15 +103,16 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
|
||||
void OnUpdatePrintSettings(int document_cookie,
|
||||
const base::DictionaryValue& job_settings,
|
||||
IPC::Message* reply_msg);
|
||||
void OnUpdatePrintSettingsReply(
|
||||
scoped_refptr<printing::PrinterQuery> printer_query,
|
||||
IPC::Message* reply_msg);
|
||||
void OnUpdatePrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
|
||||
IPC::Message* reply_msg);
|
||||
|
||||
const int render_process_id_;
|
||||
|
||||
scoped_refptr<printing::PrintQueriesQueue> queue_;
|
||||
scoped_refptr<PrintQueriesQueue> queue_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(PrintingMessageFilter);
|
||||
};
|
||||
|
||||
} // namespace printing
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PRINTING_PRINTING_MESSAGE_FILTER_H_
|
||||
|
@@ -68,6 +68,10 @@ class CefRootLayer : public ui::Layer, public ui::LayerDelegate {
|
||||
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
|
||||
}
|
||||
|
||||
virtual void OnDelegatedFrameDamage(
|
||||
const gfx::Rect& damage_rect_in_dip) OVERRIDE {
|
||||
}
|
||||
|
||||
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {
|
||||
}
|
||||
|
||||
@@ -172,7 +176,9 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
#if !defined(OS_MACOSX)
|
||||
// On OS X the ui::Compositor is created/owned by the platform view.
|
||||
compositor_.reset(
|
||||
new ui::Compositor(compositor_widget_, content::GetContextFactory()));
|
||||
new ui::Compositor(compositor_widget_,
|
||||
content::GetContextFactory(),
|
||||
base::MessageLoopProxy::current()));
|
||||
#endif
|
||||
compositor_->SetRootLayer(root_layer_.get());
|
||||
|
||||
@@ -185,9 +191,16 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
}
|
||||
|
||||
CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
|
||||
// Marking the DelegatedFrameHost as removed from the window hierarchy is
|
||||
// necessary to remove all connections to its old ui::Compositor.
|
||||
if (is_showing_)
|
||||
delegated_frame_host_->WasHidden();
|
||||
delegated_frame_host_->RemovingFromWindow();
|
||||
|
||||
PlatformDestroyCompositorWidget();
|
||||
|
||||
delegated_frame_host_.reset(NULL);
|
||||
compositor_.reset(NULL);
|
||||
PlatformDestroyCompositorWidget();
|
||||
root_layer_.reset(NULL);
|
||||
}
|
||||
|
||||
@@ -341,9 +354,9 @@ void CefRenderWidgetHostViewOSR::WasShown() {
|
||||
|
||||
is_showing_ = true;
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->WasShown();
|
||||
render_widget_host_->WasShown(ui::LatencyInfo());
|
||||
delegated_frame_host_->AddedToWindow();
|
||||
delegated_frame_host_->WasShown();
|
||||
delegated_frame_host_->WasShown(ui::LatencyInfo());
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::WasHidden() {
|
||||
@@ -472,21 +485,13 @@ void CefRenderWidgetHostViewOSR::SelectionBoundsChanged(
|
||||
const ViewHostMsg_SelectionBounds_Params& params) {
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ScrollOffsetChanged() {
|
||||
if (!browser_impl_)
|
||||
return;
|
||||
|
||||
browser_impl_->GetClient()->GetRenderHandler()->
|
||||
OnScrollOffsetChanged(browser_impl_.get());
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::CopyFromCompositingSurface(
|
||||
const gfx::Rect& src_subrect,
|
||||
const gfx::Size& dst_size,
|
||||
const base::Callback<void(bool, const SkBitmap&)>& callback,
|
||||
const SkBitmap::Config config) {
|
||||
const SkColorType color_type) {
|
||||
delegated_frame_host_->CopyFromCompositingSurface(
|
||||
src_subrect, dst_size, callback, config);
|
||||
src_subrect, dst_size, callback, color_type);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::CopyFromCompositingSurfaceToVideoFrame(
|
||||
@@ -596,6 +601,12 @@ gfx::GLSurfaceHandle CefRenderWidgetHostViewOSR::GetCompositingSurface() {
|
||||
GetSharedSurfaceHandle();
|
||||
}
|
||||
|
||||
content::BrowserAccessibilityManager*
|
||||
CefRenderWidgetHostViewOSR::CreateBrowserAccessibilityManager(
|
||||
content::BrowserAccessibilityDelegate* delegate) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX) && defined(USE_AURA)
|
||||
void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
|
||||
const gfx::Range& range,
|
||||
@@ -615,11 +626,6 @@ content::RenderWidgetHostImpl* CefRenderWidgetHostViewOSR::GetHost() {
|
||||
return render_widget_host_;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SchedulePaintInRect(
|
||||
const gfx::Rect& damage_rect_in_dip) {
|
||||
root_layer_->SchedulePaint(damage_rect_in_dip);
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::IsVisible() {
|
||||
return IsShowing();
|
||||
}
|
||||
@@ -909,13 +915,11 @@ void CefRenderWidgetHostViewOSR::PrepareTextureCopyOutputResult(
|
||||
bitmap_size.height() != result_size.height()) {
|
||||
// Create a new bitmap if the size has changed.
|
||||
bitmap_.reset(new SkBitmap);
|
||||
bitmap_->setConfig(SkBitmap::kARGB_8888_Config,
|
||||
result_size.width(),
|
||||
result_size.height(),
|
||||
0,
|
||||
kOpaque_SkAlphaType);
|
||||
if (!bitmap_->allocPixels())
|
||||
if (!bitmap_->allocN32Pixels(result_size.width(),
|
||||
result_size.height(),
|
||||
true)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
content::ImageTransportFactory* factory =
|
||||
@@ -944,7 +948,7 @@ void CefRenderWidgetHostViewOSR::PrepareTextureCopyOutputResult(
|
||||
gfx::Rect(result_size),
|
||||
result_size,
|
||||
pixels,
|
||||
SkBitmap::kARGB_8888_Config,
|
||||
kN32_SkColorType,
|
||||
base::Bind(
|
||||
&CefRenderWidgetHostViewOSR::CopyFromCompositingSurfaceFinishedProxy,
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
|
@@ -17,6 +17,10 @@
|
||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "content/browser/compositor/browser_compositor_view_mac.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "ui/gfx/win/window_impl.h"
|
||||
#endif
|
||||
@@ -32,8 +36,10 @@ class CefWebContentsViewOSR;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#ifdef __OBJC__
|
||||
@class CALayer;
|
||||
@class NSWindow;
|
||||
#else
|
||||
class CALayer;
|
||||
class NSWindow;
|
||||
#endif
|
||||
#endif
|
||||
@@ -62,6 +68,9 @@ class CefWindowX11;
|
||||
|
||||
class CefRenderWidgetHostViewOSR
|
||||
: public content::RenderWidgetHostViewBase,
|
||||
#if defined(OS_MACOSX)
|
||||
public content::BrowserCompositorViewMacClient,
|
||||
#endif
|
||||
public content::DelegatedFrameHostClient {
|
||||
public:
|
||||
explicit CefRenderWidgetHostViewOSR(content::RenderWidgetHost* widget);
|
||||
@@ -128,12 +137,11 @@ class CefRenderWidgetHostViewOSR
|
||||
virtual gfx::Size GetPhysicalBackingSize() const OVERRIDE;
|
||||
virtual void SelectionBoundsChanged(
|
||||
const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE;
|
||||
virtual void ScrollOffsetChanged() OVERRIDE;
|
||||
virtual void CopyFromCompositingSurface(
|
||||
const gfx::Rect& src_subrect,
|
||||
const gfx::Size& dst_size,
|
||||
const base::Callback<void(bool, const SkBitmap&)>& callback,
|
||||
const SkBitmap::Config config) OVERRIDE;
|
||||
const SkColorType color_type) OVERRIDE;
|
||||
virtual void CopyFromCompositingSurfaceToVideoFrame(
|
||||
const gfx::Rect& src_subrect,
|
||||
const scoped_refptr<media::VideoFrame>& target,
|
||||
@@ -158,6 +166,9 @@ class CefRenderWidgetHostViewOSR
|
||||
virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE;
|
||||
virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE;
|
||||
virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
|
||||
virtual content::BrowserAccessibilityManager*
|
||||
CreateBrowserAccessibilityManager(
|
||||
content::BrowserAccessibilityDelegate* delegate) OVERRIDE;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
virtual bool PostProcessEventForPluginIme(
|
||||
@@ -176,12 +187,19 @@ class CefRenderWidgetHostViewOSR
|
||||
virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE;
|
||||
#endif
|
||||
|
||||
// DelegatedFrameHost implementation.
|
||||
#if defined(OS_MACOSX)
|
||||
// BrowserCompositorViewMacClient implementation.
|
||||
virtual bool BrowserCompositorViewShouldAckImmediately() const OVERRIDE;
|
||||
virtual void BrowserCompositorViewFrameSwapped(
|
||||
const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE;
|
||||
virtual NSView* BrowserCompositorSuperview() OVERRIDE;
|
||||
virtual ui::Layer* BrowserCompositorRootLayer() OVERRIDE;
|
||||
#endif // defined(OS_MACOSX)
|
||||
|
||||
// DelegatedFrameHostClient implementation.
|
||||
virtual ui::Compositor* GetCompositor() const OVERRIDE;
|
||||
virtual ui::Layer* GetLayer() OVERRIDE;
|
||||
virtual content::RenderWidgetHostImpl* GetHost() OVERRIDE;
|
||||
virtual void SchedulePaintInRect(
|
||||
const gfx::Rect& damage_rect_in_dip) OVERRIDE;
|
||||
virtual bool IsVisible() OVERRIDE;
|
||||
virtual scoped_ptr<content::ResizeLock> CreateResizeLock(
|
||||
bool defer_compositor_lock) OVERRIDE;
|
||||
@@ -295,6 +313,8 @@ class CefRenderWidgetHostViewOSR
|
||||
scoped_ptr<gfx::WindowImpl> window_;
|
||||
#elif defined(OS_MACOSX)
|
||||
NSWindow* window_;
|
||||
CALayer* background_layer_;
|
||||
scoped_ptr<content::BrowserCompositorViewMac> compositor_view_;
|
||||
#elif defined(USE_X11)
|
||||
CefWindowX11* window_;
|
||||
#endif
|
||||
|
@@ -10,7 +10,8 @@
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/text_input_client_osr_mac.h"
|
||||
|
||||
#include "content/browser/compositor/browser_compositor_view_private_mac.h"
|
||||
#include "content/browser/compositor/browser_compositor_view_mac.h"
|
||||
#include "ui/events/latency_info.h"
|
||||
|
||||
#if !defined(UNUSED)
|
||||
#define UNUSED(x) ((void)(x)) /* to avoid warnings */
|
||||
@@ -86,6 +87,30 @@ void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
|
||||
client->composition_bounds_ = character_bounds;
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::BrowserCompositorViewShouldAckImmediately()
|
||||
const {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::BrowserCompositorViewFrameSwapped(
|
||||
const std::vector<ui::LatencyInfo>& all_latency_info) {
|
||||
if (!render_widget_host_)
|
||||
return;
|
||||
for (auto latency_info : all_latency_info) {
|
||||
latency_info.AddLatencyNumber(
|
||||
ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0);
|
||||
render_widget_host_->FrameSwapped(latency_info);
|
||||
}
|
||||
}
|
||||
|
||||
NSView* CefRenderWidgetHostViewOSR::BrowserCompositorSuperview() {
|
||||
return [window_ contentView];
|
||||
}
|
||||
|
||||
ui::Layer* CefRenderWidgetHostViewOSR::BrowserCompositorRootLayer() {
|
||||
return root_layer_.get();
|
||||
}
|
||||
|
||||
CefTextInputContext CefRenderWidgetHostViewOSR::GetNSTextInputContext() {
|
||||
if (!text_input_context_osr_mac_) {
|
||||
CefTextInputClientOSRMac* text_input_client_osr_mac =
|
||||
@@ -260,21 +285,30 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
|
||||
styleMask:NSBorderlessWindowMask
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
BrowserCompositorViewCocoa* view = [[BrowserCompositorViewCocoa alloc] init];
|
||||
[window_ setContentView:view];
|
||||
compositor_.reset([view compositor]);
|
||||
|
||||
// Create a CALayer which is used by BrowserCompositorViewMac for rendering.
|
||||
background_layer_ = [[[CALayer alloc] init] retain];
|
||||
[background_layer_ setBackgroundColor:CGColorGetConstantColor(kCGColorClear)];
|
||||
NSView* content_view = [window_ contentView];
|
||||
[content_view setLayer:background_layer_];
|
||||
[content_view setWantsLayer:YES];
|
||||
|
||||
compositor_view_.reset(new content::BrowserCompositorViewMac(this));
|
||||
compositor_.reset(compositor_view_->GetCompositor());
|
||||
DCHECK(compositor_);
|
||||
compositor_widget_ = view;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
|
||||
DCHECK(window_);
|
||||
|
||||
// Compositor is owned by and will be freed by BrowserCompositorViewCocoa.
|
||||
// Compositor is owned by and will be freed by BrowserCompositorViewMac.
|
||||
ui::Compositor* compositor = compositor_.release();
|
||||
UNUSED(compositor);
|
||||
|
||||
[window_ close];
|
||||
window_ = nil;
|
||||
compositor_widget_ = gfx::kNullAcceleratedWidget;
|
||||
[background_layer_ release];
|
||||
background_layer_ = nil;
|
||||
|
||||
compositor_view_.reset(NULL);
|
||||
}
|
||||
|
@@ -62,12 +62,10 @@ void CefResourceDispatcherHostDelegate::RequestBeginning(
|
||||
net::URLRequest* request,
|
||||
content::ResourceContext* resource_context,
|
||||
content::AppCacheService* appcache_service,
|
||||
ResourceType::Type resource_type,
|
||||
int child_id,
|
||||
int route_id,
|
||||
content::ResourceType resource_type,
|
||||
ScopedVector<content::ResourceThrottle>* throttles) {
|
||||
if (resource_type == ResourceType::MAIN_FRAME ||
|
||||
resource_type == ResourceType::SUB_FRAME) {
|
||||
if (resource_type == content::ResourceType::RESOURCE_TYPE_MAIN_FRAME ||
|
||||
resource_type == content::ResourceType::RESOURCE_TYPE_SUB_FRAME) {
|
||||
int64 frame_id = -1;
|
||||
|
||||
// ResourceRequestInfo will not exist for requests originating from
|
||||
@@ -94,8 +92,7 @@ void CefResourceDispatcherHostDelegate::RequestBeginning(
|
||||
bool CefResourceDispatcherHostDelegate::HandleExternalProtocol(
|
||||
const GURL& url,
|
||||
int child_id,
|
||||
int route_id,
|
||||
bool initiated_by_user_gesture) {
|
||||
int route_id) {
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForView(child_id, route_id);
|
||||
if (browser.get())
|
||||
|
@@ -21,14 +21,11 @@ class CefResourceDispatcherHostDelegate
|
||||
net::URLRequest* request,
|
||||
content::ResourceContext* resource_context,
|
||||
content::AppCacheService* appcache_service,
|
||||
ResourceType::Type resource_type,
|
||||
int child_id,
|
||||
int route_id,
|
||||
content::ResourceType resource_type,
|
||||
ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE;
|
||||
virtual bool HandleExternalProtocol(const GURL& url,
|
||||
int child_id,
|
||||
int route_id,
|
||||
bool initiated_by_user_gesture) OVERRIDE;
|
||||
int route_id) OVERRIDE;
|
||||
virtual void OnRequestRedirected(
|
||||
const GURL& redirect_url,
|
||||
net::URLRequest* request,
|
||||
|
@@ -44,7 +44,7 @@ void ExtractUnderlines(NSAttributedString* string,
|
||||
[colorAttr colorUsingColorSpaceName:NSDeviceRGBColorSpace]);
|
||||
}
|
||||
underlines->push_back(blink::WebCompositionUnderline(
|
||||
range.location, NSMaxRange(range), color, [style intValue] > 1));
|
||||
range.location, NSMaxRange(range), color, [style intValue] > 1, 0));
|
||||
}
|
||||
i = range.location + range.length;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ extern "C" {
|
||||
} else {
|
||||
// Use a thin black underline by default.
|
||||
underlines_.push_back(blink::WebCompositionUnderline(0, length,
|
||||
SK_ColorBLACK, false));
|
||||
SK_ColorBLACK, false, 0));
|
||||
}
|
||||
|
||||
// If we are handling a key down event, then SetComposition() will be
|
||||
|
@@ -41,7 +41,9 @@ bool CefTraceSubscriber::BeginTracing(
|
||||
done_callback = base::Bind(&CefCompletionCallback::OnComplete, callback);
|
||||
|
||||
TracingController::GetInstance()->EnableRecording(
|
||||
categories, TracingController::DEFAULT_OPTIONS, done_callback);
|
||||
base::debug::CategoryFilter(categories),
|
||||
base::debug::TraceOptions(),
|
||||
done_callback);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -44,8 +44,8 @@
|
||||
#include "net/http/http_util.h"
|
||||
#include "net/http/transport_security_state.h"
|
||||
#include "net/proxy/proxy_service.h"
|
||||
#include "net/ssl/default_server_bound_cert_store.h"
|
||||
#include "net/ssl/server_bound_cert_service.h"
|
||||
#include "net/ssl/channel_id_service.h"
|
||||
#include "net/ssl/default_channel_id_store.h"
|
||||
#include "net/ssl/ssl_config_service_defaults.h"
|
||||
#include "url/url_constants.h"
|
||||
#include "net/url_request/http_user_agent_settings.h"
|
||||
@@ -141,8 +141,8 @@ net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() {
|
||||
|
||||
storage_->set_network_delegate(new CefNetworkDelegate);
|
||||
|
||||
storage_->set_server_bound_cert_service(new net::ServerBoundCertService(
|
||||
new net::DefaultServerBoundCertStore(NULL),
|
||||
storage_->set_channel_id_service(new net::ChannelIDService(
|
||||
new net::DefaultChannelIDStore(NULL),
|
||||
base::WorkerPool::GetTaskRunner(true)));
|
||||
storage_->set_http_user_agent_settings(
|
||||
new CefHttpUserAgentSettings("en-us,en"));
|
||||
@@ -201,8 +201,8 @@ net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() {
|
||||
url_request_context_->cert_verifier();
|
||||
network_session_params.transport_security_state =
|
||||
url_request_context_->transport_security_state();
|
||||
network_session_params.server_bound_cert_service =
|
||||
url_request_context_->server_bound_cert_service();
|
||||
network_session_params.channel_id_service =
|
||||
url_request_context_->channel_id_service();
|
||||
network_session_params.proxy_service =
|
||||
url_request_context_->proxy_service();
|
||||
network_session_params.ssl_config_service =
|
||||
|
@@ -151,7 +151,7 @@ void CefURLRequestContextProxy::Initialize(
|
||||
set_host_resolver(context->host_resolver());
|
||||
set_cert_verifier(context->cert_verifier());
|
||||
set_transport_security_state(context->transport_security_state());
|
||||
set_server_bound_cert_service(context->server_bound_cert_service());
|
||||
set_channel_id_service(context->channel_id_service());
|
||||
set_fraudulent_certificate_reporter(
|
||||
context->fraudulent_certificate_reporter());
|
||||
set_proxy_service(context->proxy_service());
|
||||
|
@@ -96,20 +96,13 @@ void CefWebContentsViewOSR::SetOverscrollControllerEnabled(bool enabled) {
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
void CefWebContentsViewOSR::SetAllowOverlappingViews(bool overlapping) {
|
||||
void CefWebContentsViewOSR::SetAllowOtherViews(bool allow) {
|
||||
}
|
||||
|
||||
bool CefWebContentsViewOSR::GetAllowOverlappingViews() const {
|
||||
bool CefWebContentsViewOSR::GetAllowOtherViews() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::SetOverlayView(
|
||||
content::WebContentsView* overlay,
|
||||
const gfx::Point& offset) {
|
||||
}
|
||||
void CefWebContentsViewOSR::RemoveOverlayView() {
|
||||
}
|
||||
|
||||
bool CefWebContentsViewOSR::IsEventTracking() const {
|
||||
return false;
|
||||
}
|
||||
|
@@ -48,11 +48,8 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
virtual void SetOverscrollControllerEnabled(bool enabled) OVERRIDE;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE;
|
||||
virtual bool GetAllowOverlappingViews() const OVERRIDE;
|
||||
virtual void SetOverlayView(content::WebContentsView* overlay,
|
||||
const gfx::Point& offset) OVERRIDE;
|
||||
virtual void RemoveOverlayView() OVERRIDE;
|
||||
virtual void SetAllowOtherViews(bool allow) OVERRIDE;
|
||||
virtual bool GetAllowOtherViews() const OVERRIDE;
|
||||
virtual bool IsEventTracking() const OVERRIDE;
|
||||
virtual void CloseTabAfterEventTracking() OVERRIDE;
|
||||
#endif
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#define CEF_LIBCEF_COMMON_BREAKPAD_CLIENT_H_
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "components/breakpad/app/breakpad_client.h"
|
||||
#include "components/crash/app/breakpad_client.h"
|
||||
|
||||
class CefBreakpadClient : public breakpad::BreakpadClient {
|
||||
public:
|
||||
|
@@ -202,28 +202,6 @@ IPC_MESSAGE_ROUTED1(CefHostMsg_ResponseAck,
|
||||
int /* request_id */)
|
||||
|
||||
|
||||
// Pepper PDF plugin messages excerpted from chrome/common/render_messages.h.
|
||||
// Including all of render_messages.h would bring in a number of chrome
|
||||
// dependencies that are better off avoided.
|
||||
|
||||
// The currently displayed PDF has an unsupported feature.
|
||||
IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_PDFHasUnsupportedFeature)
|
||||
|
||||
// Brings up SaveAs... dialog to save specified URL.
|
||||
IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_PDFSaveURLAs,
|
||||
GURL /* url */,
|
||||
content::Referrer /* referrer */)
|
||||
|
||||
// Updates the content restrictions, i.e. to disable print/copy.
|
||||
IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_PDFUpdateContentRestrictions,
|
||||
int /* restrictions */)
|
||||
|
||||
// Brings up a Password... dialog for protected documents.
|
||||
IPC_SYNC_MESSAGE_ROUTED1_1(ChromeViewHostMsg_PDFModalPromptForPassword,
|
||||
std::string /* prompt */,
|
||||
std::string /* actual_value */)
|
||||
|
||||
|
||||
// Singly-included section for struct and custom IPC traits.
|
||||
#ifndef CEF_LIBCEF_COMMON_CEF_MESSAGES_H_
|
||||
#define CEF_LIBCEF_COMMON_CEF_MESSAGES_H_
|
||||
|
@@ -34,19 +34,19 @@
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <Objbase.h> // NOLINT(build/include_order)
|
||||
#include "components/breakpad/app/breakpad_win.h"
|
||||
#include "components/crash/app/breakpad_win.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "base/mac/os_crash_dumps.h"
|
||||
#include "base/mac/bundle_locations.h"
|
||||
#include "base/mac/foundation_util.h"
|
||||
#include "components/breakpad/app/breakpad_mac.h"
|
||||
#include "components/crash/app/breakpad_mac.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#include "components/breakpad/app/breakpad_linux.h"
|
||||
#include "components/crash/app/breakpad_linux.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
@@ -541,8 +541,10 @@ void CefMainDelegate::InitializeResourceBundle() {
|
||||
DCHECK(!locale.empty());
|
||||
|
||||
const std::string loaded_locale =
|
||||
ui::ResourceBundle::InitSharedInstanceWithLocale(locale,
|
||||
&content_client_);
|
||||
ui::ResourceBundle::InitSharedInstanceWithLocale(
|
||||
locale,
|
||||
&content_client_,
|
||||
ui::ResourceBundle::LOAD_COMMON_RESOURCES);
|
||||
ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance();
|
||||
|
||||
if (!content_client_.pack_loading_disabled()) {
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "content/public/browser/resource_request_info.h"
|
||||
#include "content/public/common/resource_type.h"
|
||||
#include "net/base/upload_data_stream.h"
|
||||
#include "net/base/upload_element_reader.h"
|
||||
#include "net/base/upload_bytes_element_reader.h"
|
||||
@@ -23,7 +24,6 @@
|
||||
#include "third_party/WebKit/public/platform/WebURL.h"
|
||||
#include "third_party/WebKit/public/platform/WebURLError.h"
|
||||
#include "third_party/WebKit/public/platform/WebURLRequest.h"
|
||||
#include "webkit/common/resource_type.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -313,9 +313,6 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) {
|
||||
flags_ |= UR_FLAG_REPORT_RAW_HEADERS;
|
||||
|
||||
first_party_for_cookies_ = request.firstPartyForCookies().spec().utf16();
|
||||
|
||||
resource_type_ = static_cast<cef_resource_type_t>(
|
||||
::ResourceType::FromTargetType(request.targetType()));
|
||||
}
|
||||
|
||||
void CefRequestImpl::Get(blink::WebURLRequest& request) {
|
||||
@@ -327,7 +324,6 @@ void CefRequestImpl::Get(blink::WebURLRequest& request) {
|
||||
|
||||
std::string method(method_);
|
||||
request.setHTTPMethod(blink::WebString::fromUTF8(method.c_str()));
|
||||
request.setTargetType(blink::WebURLRequest::TargetIsMainFrame);
|
||||
|
||||
blink::WebHTTPBody body;
|
||||
if (postdata_.get()) {
|
||||
|
@@ -5,12 +5,13 @@
|
||||
#ifndef CEF_LIBCEF_COMMON_UPLOAD_DATA_H_
|
||||
#define CEF_LIBCEF_COMMON_UPLOAD_DATA_H_
|
||||
|
||||
#include "libcef/common/upload_element.h"
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/scoped_vector.h"
|
||||
#include "base/supports_user_data.h"
|
||||
#include "net/base/net_export.h"
|
||||
#include "net/base/upload_element.h"
|
||||
|
||||
namespace base {
|
||||
class FilePath;
|
||||
|
25
libcef/common/upload_element.cc
Normal file
25
libcef/common/upload_element.cc
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/common/upload_element.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "net/base/file_stream.h"
|
||||
#include "net/base/net_errors.h"
|
||||
|
||||
namespace net {
|
||||
|
||||
UploadElement::UploadElement()
|
||||
: type_(TYPE_BYTES),
|
||||
bytes_start_(NULL),
|
||||
bytes_length_(0),
|
||||
file_range_offset_(0),
|
||||
file_range_length_(kuint64max) {
|
||||
}
|
||||
|
||||
UploadElement::~UploadElement() {
|
||||
}
|
||||
|
||||
} // namespace net
|
110
libcef/common/upload_element.h
Normal file
110
libcef/common/upload_element.h
Normal file
@@ -0,0 +1,110 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_COMMON_UPLOAD_ELEMENT_H_
|
||||
#define CEF_LIBCEF_COMMON_UPLOAD_ELEMENT_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/time/time.h"
|
||||
#include "net/base/net_export.h"
|
||||
|
||||
namespace net {
|
||||
|
||||
// A class representing an element contained by UploadData.
|
||||
class NET_EXPORT UploadElement {
|
||||
public:
|
||||
enum Type {
|
||||
TYPE_BYTES,
|
||||
TYPE_FILE,
|
||||
};
|
||||
|
||||
UploadElement();
|
||||
~UploadElement();
|
||||
|
||||
Type type() const { return type_; }
|
||||
|
||||
const char* bytes() const { return bytes_start_ ? bytes_start_ : &buf_[0]; }
|
||||
uint64 bytes_length() const { return buf_.size() + bytes_length_; }
|
||||
const base::FilePath& file_path() const { return file_path_; }
|
||||
uint64 file_range_offset() const { return file_range_offset_; }
|
||||
uint64 file_range_length() const { return file_range_length_; }
|
||||
// If NULL time is returned, we do not do the check.
|
||||
const base::Time& expected_file_modification_time() const {
|
||||
return expected_file_modification_time_;
|
||||
}
|
||||
|
||||
void SetToBytes(const char* bytes, int bytes_len) {
|
||||
type_ = TYPE_BYTES;
|
||||
buf_.assign(bytes, bytes + bytes_len);
|
||||
}
|
||||
|
||||
// This does not copy the given data and the caller should make sure
|
||||
// the data is secured somewhere else (e.g. by attaching the data
|
||||
// using SetUserData).
|
||||
void SetToSharedBytes(const char* bytes, int bytes_len) {
|
||||
type_ = TYPE_BYTES;
|
||||
bytes_start_ = bytes;
|
||||
bytes_length_ = bytes_len;
|
||||
}
|
||||
|
||||
void SetToFilePath(const base::FilePath& path) {
|
||||
SetToFilePathRange(path, 0, kuint64max, base::Time());
|
||||
}
|
||||
|
||||
// If expected_modification_time is NULL, we do not check for the file
|
||||
// change. Also note that the granularity for comparison is time_t, not
|
||||
// the full precision.
|
||||
void SetToFilePathRange(const base::FilePath& path,
|
||||
uint64 offset, uint64 length,
|
||||
const base::Time& expected_modification_time) {
|
||||
type_ = TYPE_FILE;
|
||||
file_path_ = path;
|
||||
file_range_offset_ = offset;
|
||||
file_range_length_ = length;
|
||||
expected_file_modification_time_ = expected_modification_time;
|
||||
}
|
||||
|
||||
private:
|
||||
Type type_;
|
||||
std::vector<char> buf_;
|
||||
const char* bytes_start_;
|
||||
uint64 bytes_length_;
|
||||
base::FilePath file_path_;
|
||||
uint64 file_range_offset_;
|
||||
uint64 file_range_length_;
|
||||
base::Time expected_file_modification_time_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(UploadElement);
|
||||
};
|
||||
|
||||
#if defined(UNIT_TEST)
|
||||
inline bool operator==(const UploadElement& a,
|
||||
const UploadElement& b) {
|
||||
if (a.type() != b.type())
|
||||
return false;
|
||||
if (a.type() == UploadElement::TYPE_BYTES)
|
||||
return a.bytes_length() == b.bytes_length() &&
|
||||
memcmp(a.bytes(), b.bytes(), b.bytes_length()) == 0;
|
||||
if (a.type() == UploadElement::TYPE_FILE) {
|
||||
return a.file_path() == b.file_path() &&
|
||||
a.file_range_offset() == b.file_range_offset() &&
|
||||
a.file_range_length() == b.file_range_length() &&
|
||||
a.expected_file_modification_time() ==
|
||||
b.expected_file_modification_time();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool operator!=(const UploadElement& a,
|
||||
const UploadElement& b) {
|
||||
return !(a == b);
|
||||
}
|
||||
#endif // defined(UNIT_TEST)
|
||||
|
||||
} // namespace net
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_UPLOAD_ELEMENT_H_
|
@@ -384,7 +384,7 @@ bool CefDictionaryValueImpl::SetBool(const CefString& key, bool value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
RemoveInternal(key);
|
||||
mutable_value()->SetWithoutPathExpansion(key,
|
||||
base::Value::CreateBooleanValue(value));
|
||||
new base::FundamentalValue(value));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ bool CefDictionaryValueImpl::SetInt(const CefString& key, int value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
RemoveInternal(key);
|
||||
mutable_value()->SetWithoutPathExpansion(key,
|
||||
base::Value::CreateIntegerValue(value));
|
||||
new base::FundamentalValue(value));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ bool CefDictionaryValueImpl::SetDouble(const CefString& key, double value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
RemoveInternal(key);
|
||||
mutable_value()->SetWithoutPathExpansion(key,
|
||||
base::Value::CreateDoubleValue(value));
|
||||
new base::FundamentalValue(value));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ bool CefDictionaryValueImpl::SetString(const CefString& key,
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
RemoveInternal(key);
|
||||
mutable_value()->SetWithoutPathExpansion(key,
|
||||
base::Value::CreateStringValue(value.ToString()));
|
||||
new base::StringValue(value.ToString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -729,7 +729,7 @@ bool CefListValueImpl::SetNull(int index) {
|
||||
|
||||
bool CefListValueImpl::SetBool(int index, bool value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
base::Value* new_value = base::Value::CreateBooleanValue(value);
|
||||
base::Value* new_value = new base::FundamentalValue(value);
|
||||
if (RemoveInternal(index))
|
||||
mutable_value()->Insert(index, new_value);
|
||||
else
|
||||
@@ -739,7 +739,7 @@ bool CefListValueImpl::SetBool(int index, bool value) {
|
||||
|
||||
bool CefListValueImpl::SetInt(int index, int value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
base::Value* new_value = base::Value::CreateIntegerValue(value);
|
||||
base::Value* new_value = new base::FundamentalValue(value);
|
||||
if (RemoveInternal(index))
|
||||
mutable_value()->Insert(index, new_value);
|
||||
else
|
||||
@@ -749,7 +749,7 @@ bool CefListValueImpl::SetInt(int index, int value) {
|
||||
|
||||
bool CefListValueImpl::SetDouble(int index, double value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
base::Value* new_value = base::Value::CreateDoubleValue(value);
|
||||
base::Value* new_value = new base::FundamentalValue(value);
|
||||
if (RemoveInternal(index))
|
||||
mutable_value()->Insert(index, new_value);
|
||||
else
|
||||
@@ -759,7 +759,7 @@ bool CefListValueImpl::SetDouble(int index, double value) {
|
||||
|
||||
bool CefListValueImpl::SetString(int index, const CefString& value) {
|
||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||
base::Value* new_value = base::Value::CreateStringValue(value.ToString());
|
||||
base::Value* new_value = new base::StringValue(value.ToString());
|
||||
if (RemoveInternal(index))
|
||||
mutable_value()->Insert(index, new_value);
|
||||
else
|
||||
|
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "config.h"
|
||||
MSVC_PUSH_WARNING_LEVEL(0);
|
||||
#include "bindings/v8/V8Binding.h"
|
||||
#include "bindings/v8/V8RecursionScope.h"
|
||||
#include "bindings/core/v8/V8Binding.h"
|
||||
#include "bindings/core/v8/V8RecursionScope.h"
|
||||
MSVC_POP_WARNING();
|
||||
#undef ceil
|
||||
#undef FROM_HERE
|
||||
@@ -37,8 +37,9 @@ MSVC_POP_WARNING();
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/renderer/loadtimes_extension_bindings.h"
|
||||
#include "chrome/renderer/pepper/ppb_pdf_impl.h"
|
||||
#include "chrome/renderer/pepper/chrome_pdf_print_client.h"
|
||||
#include "chrome/renderer/printing/print_web_view_helper.h"
|
||||
#include "components/pdf/renderer/ppb_pdf_impl.h"
|
||||
#include "content/child/child_thread.h"
|
||||
#include "content/child/worker_task_runner.h"
|
||||
#include "content/common/frame_messages.h"
|
||||
@@ -65,7 +66,6 @@ MSVC_POP_WARNING();
|
||||
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
|
||||
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
||||
#include "third_party/WebKit/public/web/WebView.h"
|
||||
#include "third_party/WebKit/public/web/WebWorkerInfo.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
@@ -468,6 +468,9 @@ void CefContentRendererClient::RenderThreadStarted() {
|
||||
// Cross-origin entries need to be added after WebKit is initialized.
|
||||
cross_origin_whitelist_entries_ = params.cross_origin_whitelist_entries;
|
||||
|
||||
pdf_print_client_.reset(new ChromePDFPrintClient());
|
||||
pdf::PPB_PDF_Impl::SetPrintClient(pdf_print_client_.get());
|
||||
|
||||
// Notify the render process handler.
|
||||
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
|
||||
if (application.get()) {
|
||||
@@ -650,9 +653,9 @@ void CefContentRendererClient::DidCreateScriptContext(
|
||||
v8::Isolate* isolate = blink::mainThreadIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Context::Scope scope(context);
|
||||
WebCore::V8RecursionScope recursion_scope(
|
||||
blink::V8RecursionScope recursion_scope(
|
||||
isolate,
|
||||
WebCore::toExecutionContext(context));
|
||||
blink::toExecutionContext(context));
|
||||
|
||||
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(isolate, context));
|
||||
|
||||
@@ -671,7 +674,7 @@ const void* CefContentRendererClient::CreatePPAPIInterface(
|
||||
#if defined(ENABLE_PLUGINS)
|
||||
// Used for in-process PDF plugin.
|
||||
if (interface_name == PPB_PDF_INTERFACE)
|
||||
return PPB_PDF_Impl::GetInterface();
|
||||
return pdf::PPB_PDF_Impl::GetInterface();
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
@@ -693,9 +696,9 @@ void CefContentRendererClient::WillReleaseScriptContext(
|
||||
v8::Isolate* isolate = blink::mainThreadIsolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Context::Scope scope(context);
|
||||
WebCore::V8RecursionScope recursion_scope(
|
||||
blink::V8RecursionScope recursion_scope(
|
||||
isolate,
|
||||
WebCore::toExecutionContext(context));
|
||||
blink::toExecutionContext(context));
|
||||
|
||||
CefRefPtr<CefV8Context> contextPtr(
|
||||
new CefV8ContextImpl(isolate, context));
|
||||
@@ -746,7 +749,7 @@ void CefContentRendererClient::BrowserCreated(
|
||||
browsers_.insert(std::make_pair(render_view, browser));
|
||||
|
||||
new CefPrerendererClient(render_view);
|
||||
new printing::PrintWebViewHelper(render_view);
|
||||
new printing::PrintWebViewHelper(render_view, false, false);
|
||||
|
||||
// Notify the render process handler.
|
||||
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
class CefRenderProcessObserver;
|
||||
struct Cef_CrossOriginWhiteListEntry_Params;
|
||||
class ChromePDFPrintClient;
|
||||
|
||||
class CefContentRendererClient : public content::ContentRendererClient,
|
||||
public base::MessageLoop::DestructionObserver {
|
||||
@@ -121,6 +122,8 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
||||
typedef std::vector<Cef_CrossOriginWhiteListEntry_Params> CrossOriginList;
|
||||
CrossOriginList cross_origin_whitelist_entries_;
|
||||
|
||||
scoped_ptr<ChromePDFPrintClient> pdf_print_client_;
|
||||
|
||||
int devtools_agent_count_;
|
||||
int uncaught_exception_stack_size_;
|
||||
|
||||
|
@@ -1,154 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/renderer/dom_event_impl.h"
|
||||
#include "libcef/renderer/dom_document_impl.h"
|
||||
#include "libcef/renderer/thread_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/web/WebDOMEvent.h"
|
||||
|
||||
using blink::WebDOMEvent;
|
||||
using blink::WebString;
|
||||
|
||||
|
||||
CefDOMEventImpl::CefDOMEventImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||
const blink::WebDOMEvent& event)
|
||||
: document_(document),
|
||||
event_(event) {
|
||||
DCHECK(!event_.isNull());
|
||||
}
|
||||
|
||||
CefDOMEventImpl::~CefDOMEventImpl() {
|
||||
CEF_REQUIRE_RT();
|
||||
DCHECK(event_.isNull());
|
||||
}
|
||||
|
||||
CefString CefDOMEventImpl::GetType() {
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
return str;
|
||||
|
||||
const WebString& type = event_.type();
|
||||
if (!type.isNull())
|
||||
str = type;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
CefDOMEventImpl::Category CefDOMEventImpl::GetCategory() {
|
||||
if (!VerifyContext())
|
||||
return DOM_EVENT_CATEGORY_UNKNOWN;
|
||||
|
||||
int flags = 0;
|
||||
if (event_.isUIEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_UI;
|
||||
if (event_.isMouseEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_MOUSE;
|
||||
if (event_.isMutationEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_MUTATION;
|
||||
if (event_.isKeyboardEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_KEYBOARD;
|
||||
if (event_.isTextEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_TEXT;
|
||||
if (event_.isCompositionEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_COMPOSITION;
|
||||
if (event_.isDragEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_DRAG;
|
||||
if (event_.isClipboardEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_CLIPBOARD;
|
||||
if (event_.isMessageEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_MESSAGE;
|
||||
if (event_.isWheelEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_WHEEL;
|
||||
if (event_.isBeforeTextInsertedEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_BEFORE_TEXT_INSERTED;
|
||||
if (event_.isOverflowEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_OVERFLOW;
|
||||
if (event_.isPageTransitionEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_PAGE_TRANSITION;
|
||||
if (event_.isPopStateEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_POPSTATE;
|
||||
if (event_.isProgressEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_PROGRESS;
|
||||
if (event_.isXMLHttpRequestProgressEvent())
|
||||
flags |= DOM_EVENT_CATEGORY_XMLHTTPREQUEST_PROGRESS;
|
||||
|
||||
return static_cast<Category>(flags);
|
||||
}
|
||||
|
||||
CefDOMEventImpl::Phase CefDOMEventImpl::GetPhase() {
|
||||
if (!VerifyContext())
|
||||
return DOM_EVENT_PHASE_UNKNOWN;
|
||||
|
||||
switch (event_.eventPhase()) {
|
||||
case WebDOMEvent::CapturingPhase:
|
||||
return DOM_EVENT_PHASE_CAPTURING;
|
||||
case WebDOMEvent::AtTarget:
|
||||
return DOM_EVENT_PHASE_AT_TARGET;
|
||||
case WebDOMEvent::BubblingPhase:
|
||||
return DOM_EVENT_PHASE_BUBBLING;
|
||||
}
|
||||
|
||||
return DOM_EVENT_PHASE_UNKNOWN;
|
||||
}
|
||||
|
||||
bool CefDOMEventImpl::CanBubble() {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
return event_.bubbles();
|
||||
}
|
||||
|
||||
bool CefDOMEventImpl::CanCancel() {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
return event_.cancelable();
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMDocument> CefDOMEventImpl::GetDocument() {
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_.get();
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMEventImpl::GetTarget() {
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(event_.target());
|
||||
}
|
||||
|
||||
CefRefPtr<CefDOMNode> CefDOMEventImpl::GetCurrentTarget() {
|
||||
if (!VerifyContext())
|
||||
return NULL;
|
||||
|
||||
return document_->GetOrCreateNode(event_.currentTarget());
|
||||
}
|
||||
|
||||
void CefDOMEventImpl::Detach() {
|
||||
// If you hit this assert it means that you are keeping references to this
|
||||
// event object beyond the valid scope.
|
||||
DCHECK(HasOneRef());
|
||||
|
||||
document_ = NULL;
|
||||
event_.assign(WebDOMEvent());
|
||||
}
|
||||
|
||||
bool CefDOMEventImpl::VerifyContext() {
|
||||
if (!document_.get()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
if (!document_->VerifyContext())
|
||||
return false;
|
||||
if (event_.isNull()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_DOM_EVENT_IMPL_H_
|
||||
#define CEF_LIBCEF_DOM_EVENT_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_dom.h"
|
||||
#include "third_party/WebKit/public/web/WebDOMEvent.h"
|
||||
|
||||
class CefDOMDocumentImpl;
|
||||
|
||||
class CefDOMEventImpl : public CefDOMEvent {
|
||||
public:
|
||||
CefDOMEventImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||
const blink::WebDOMEvent& event);
|
||||
virtual ~CefDOMEventImpl();
|
||||
|
||||
// CefDOMEvent methods.
|
||||
virtual CefString GetType() OVERRIDE;
|
||||
virtual Category GetCategory() OVERRIDE;
|
||||
virtual Phase GetPhase() OVERRIDE;
|
||||
virtual bool CanBubble() OVERRIDE;
|
||||
virtual bool CanCancel() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMDocument> GetDocument() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetTarget() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetCurrentTarget() OVERRIDE;
|
||||
|
||||
// Will be called from CefDOMEventListenerWrapper::handleEvent().
|
||||
void Detach();
|
||||
|
||||
// Verify that the object exists and is being accessed on the UI thread.
|
||||
bool VerifyContext();
|
||||
|
||||
protected:
|
||||
CefRefPtr<CefDOMDocumentImpl> document_;
|
||||
blink::WebDOMEvent event_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefDOMEventImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DOM_EVENT_IMPL_H_
|
@@ -6,7 +6,6 @@
|
||||
#include "libcef/common/tracker.h"
|
||||
#include "libcef/renderer/browser_impl.h"
|
||||
#include "libcef/renderer/dom_document_impl.h"
|
||||
#include "libcef/renderer/dom_event_impl.h"
|
||||
#include "libcef/renderer/thread_util.h"
|
||||
#include "libcef/renderer/webkit_glue.h"
|
||||
|
||||
@@ -16,7 +15,6 @@
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/web/WebDocument.h"
|
||||
#include "third_party/WebKit/public/web/WebDOMEvent.h"
|
||||
#include "third_party/WebKit/public/web/WebDOMEventListener.h"
|
||||
#include "third_party/WebKit/public/web/WebElement.h"
|
||||
#include "third_party/WebKit/public/web/WebFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebFormControlElement.h"
|
||||
@@ -26,7 +24,6 @@
|
||||
|
||||
using blink::WebDocument;
|
||||
using blink::WebDOMEvent;
|
||||
using blink::WebDOMEventListener;
|
||||
using blink::WebElement;
|
||||
using blink::WebFrame;
|
||||
using blink::WebFormControlElement;
|
||||
@@ -35,55 +32,6 @@ using blink::WebNode;
|
||||
using blink::WebSelectElement;
|
||||
using blink::WebString;
|
||||
|
||||
namespace {
|
||||
|
||||
// Wrapper implementation for WebDOMEventListener.
|
||||
class CefDOMEventListenerWrapper : public WebDOMEventListener,
|
||||
public CefTrackNode {
|
||||
public:
|
||||
CefDOMEventListenerWrapper(CefBrowserImpl* browser, WebFrame* frame,
|
||||
CefRefPtr<CefDOMEventListener> listener)
|
||||
: browser_(browser),
|
||||
frame_(frame),
|
||||
listener_(listener) {
|
||||
// Cause this object to be deleted immediately before the frame is closed.
|
||||
browser->AddFrameObject(webkit_glue::GetIdentifier(frame), this);
|
||||
}
|
||||
virtual ~CefDOMEventListenerWrapper() {
|
||||
CEF_REQUIRE_RT();
|
||||
}
|
||||
|
||||
virtual void handleEvent(const WebDOMEvent& event) {
|
||||
CefRefPtr<CefDOMDocumentImpl> documentImpl;
|
||||
CefRefPtr<CefDOMEventImpl> eventImpl;
|
||||
|
||||
if (!event.isNull()) {
|
||||
// Create CefDOMDocumentImpl and CefDOMEventImpl objects that are valid
|
||||
// only for the scope of this method.
|
||||
const WebDocument& document = frame_->document();
|
||||
if (!document.isNull()) {
|
||||
documentImpl = new CefDOMDocumentImpl(browser_, frame_);
|
||||
eventImpl = new CefDOMEventImpl(documentImpl, event);
|
||||
}
|
||||
}
|
||||
|
||||
listener_->HandleEvent(eventImpl.get());
|
||||
|
||||
if (eventImpl.get())
|
||||
eventImpl->Detach();
|
||||
if (documentImpl.get())
|
||||
documentImpl->Detach();
|
||||
}
|
||||
|
||||
protected:
|
||||
CefBrowserImpl* browser_;
|
||||
WebFrame* frame_;
|
||||
CefRefPtr<CefDOMEventListener> listener_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
CefDOMNodeImpl::CefDOMNodeImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||
const blink::WebNode& node)
|
||||
: document_(document),
|
||||
@@ -331,18 +279,6 @@ CefRefPtr<CefDOMNode> CefDOMNodeImpl::GetLastChild() {
|
||||
return document_->GetOrCreateNode(node_.lastChild());
|
||||
}
|
||||
|
||||
void CefDOMNodeImpl::AddEventListener(const CefString& eventType,
|
||||
CefRefPtr<CefDOMEventListener> listener,
|
||||
bool useCapture) {
|
||||
if (!VerifyContext())
|
||||
return;
|
||||
|
||||
node_.addEventListener(base::string16(eventType),
|
||||
new CefDOMEventListenerWrapper(document_->GetBrowser(),
|
||||
document_->GetFrame(), listener),
|
||||
useCapture);
|
||||
}
|
||||
|
||||
CefString CefDOMNodeImpl::GetElementTagName() {
|
||||
CefString str;
|
||||
if (!VerifyContext())
|
||||
|
@@ -36,9 +36,6 @@ class CefDOMNodeImpl : public CefDOMNode {
|
||||
virtual bool HasChildren() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetFirstChild() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetLastChild() OVERRIDE;
|
||||
virtual void AddEventListener(const CefString& eventType,
|
||||
CefRefPtr<CefDOMEventListener> listener,
|
||||
bool useCapture) OVERRIDE;
|
||||
virtual CefString GetElementTagName() OVERRIDE;
|
||||
virtual bool HasElementAttributes() OVERRIDE;
|
||||
virtual bool HasElementAttribute(const CefString& attrName) OVERRIDE;
|
||||
|
@@ -17,8 +17,8 @@ MSVC_PUSH_WARNING_LEVEL(0);
|
||||
#include "core/frame/Frame.h"
|
||||
#include "core/frame/LocalFrame.h"
|
||||
#include "core/workers/WorkerGlobalScope.h"
|
||||
#include "bindings/v8/ScriptController.h"
|
||||
#include "bindings/v8/V8Binding.h"
|
||||
#include "bindings/core/v8/ScriptController.h"
|
||||
#include "bindings/core/v8/V8Binding.h"
|
||||
MSVC_POP_WARNING();
|
||||
#undef FROM_HERE
|
||||
#undef LOG
|
||||
@@ -551,15 +551,15 @@ v8::Local<v8::Value> CallV8Function(v8::Handle<v8::Context> context,
|
||||
// Execute the function call using the ScriptController so that inspector
|
||||
// instrumentation works.
|
||||
if (CEF_CURRENTLY_ON_RT()) {
|
||||
RefPtr<WebCore::LocalFrame> frame = WebCore::toFrameIfNotDetached(context);
|
||||
RefPtr<blink::LocalFrame> frame = blink::toFrameIfNotDetached(context);
|
||||
DCHECK(frame);
|
||||
if (frame &&
|
||||
frame->script().canExecuteScripts(WebCore::AboutToExecuteScript)) {
|
||||
frame->script().canExecuteScripts(blink::AboutToExecuteScript)) {
|
||||
func_rv = frame->script().callFunction(function, receiver, argc, args);
|
||||
}
|
||||
} else {
|
||||
func_rv = WebCore::ScriptController::callFunction(
|
||||
WebCore::toExecutionContext(context),
|
||||
func_rv = blink::ScriptController::callFunction(
|
||||
blink::toExecutionContext(context),
|
||||
function, receiver, argc, args, isolate);
|
||||
}
|
||||
|
||||
@@ -888,7 +888,7 @@ bool CefV8ContextImpl::Enter() {
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
WebCore::V8PerIsolateData::from(isolate)->incrementRecursionLevel();
|
||||
blink::V8PerIsolateData::from(isolate)->incrementRecursionLevel();
|
||||
handle_->GetNewV8Handle()->Enter();
|
||||
#ifndef NDEBUG
|
||||
++enter_count_;
|
||||
@@ -904,7 +904,7 @@ bool CefV8ContextImpl::Exit() {
|
||||
|
||||
DLOG_ASSERT(enter_count_ > 0);
|
||||
handle_->GetNewV8Handle()->Exit();
|
||||
WebCore::V8PerIsolateData::from(isolate)->decrementRecursionLevel();
|
||||
blink::V8PerIsolateData::from(isolate)->decrementRecursionLevel();
|
||||
#ifndef NDEBUG
|
||||
--enter_count_;
|
||||
#endif
|
||||
@@ -1712,8 +1712,17 @@ bool CefV8ValueImpl::SetValue(const CefString& key,
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
try_catch.SetVerbose(true);
|
||||
bool set = obj->Set(GetV8String(isolate, key), impl->GetV8Value(true),
|
||||
static_cast<v8::PropertyAttribute>(attribute));
|
||||
bool set;
|
||||
// TODO(cef): This usage may not exactly match the previous implementation.
|
||||
// Set will trigger interceptors and/or accessors whereas ForceSet will not.
|
||||
// It might be better to split this functionality into separate methods.
|
||||
if (attribute == V8_PROPERTY_ATTRIBUTE_NONE) {
|
||||
set = obj->Set(GetV8String(isolate, key), impl->GetV8Value(true));
|
||||
} else {
|
||||
set = obj->ForceSet(GetV8String(isolate, key),
|
||||
impl->GetV8Value(true),
|
||||
static_cast<v8::PropertyAttribute>(attribute));
|
||||
}
|
||||
return (!HasCaught(try_catch) && set);
|
||||
} else {
|
||||
NOTREACHED() << "invalid input parameter";
|
||||
|
@@ -78,7 +78,7 @@ std::string DumpDocumentText(blink::WebFrame* frame) {
|
||||
}
|
||||
|
||||
bool SetNodeValue(blink::WebNode& node, const blink::WebString& value) {
|
||||
WebCore::Node* web_node = node.unwrap<WebCore::Node>();
|
||||
blink::Node* web_node = node.unwrap<blink::Node>();
|
||||
web_node->setNodeValue(value);
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user