Branch CEF3 files from /branches/cef3 to /trunk/cef3 (issue #564).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@571 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-04-03 01:34:16 +00:00
parent b568f160d9
commit 34adee805c
516 changed files with 83249 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
/// Copyright (c) 2012 The Chromium Embedded Framework Authors.
// Portions (c) 2011 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/browser/browser_message_filter.h"
#include "libcef/browser/origin_whitelist_impl.h"
#include "libcef/browser/scheme_impl.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/cef_messages.h"
#include "base/compiler_specific.h"
#include "base/bind.h"
CefBrowserMessageFilter::CefBrowserMessageFilter(
content::RenderProcessHost* host)
: host_(host),
channel_(NULL) {
}
CefBrowserMessageFilter::~CefBrowserMessageFilter() {
}
void CefBrowserMessageFilter::OnFilterAdded(IPC::Channel* channel) {
channel_ = channel;
}
void CefBrowserMessageFilter::OnFilterRemoved() {
}
bool CefBrowserMessageFilter::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(CefBrowserMessageFilter, message)
IPC_MESSAGE_HANDLER(CefProcessHostMsg_RenderThreadStarted,
OnRenderThreadStarted)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
void CefBrowserMessageFilter::OnRenderThreadStarted() {
// Execute registration on the UI thread.
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserMessageFilter::RegisterOnUIThread, this));
}
void CefBrowserMessageFilter::RegisterOnUIThread() {
CEF_REQUIRE_UIT();
// Send existing registrations to the new render process.
RegisterSchemesWithHost(host_);
RegisterCrossOriginWhitelistEntriesWithHost(host_);
}