mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 176706.
- See crbug.com/167209 for a description of why NSPrincipalClass needs to be specified in helper-Info.plist. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@987 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -1608,7 +1608,7 @@ void CefBrowserHostImpl::UpdatePreferredSize(content::WebContents* source,
|
||||
|
||||
void CefBrowserHostImpl::RequestMediaAccessPermission(
|
||||
content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest* request,
|
||||
const content::MediaStreamRequest& request,
|
||||
const content::MediaResponseCallback& callback) {
|
||||
CEF_CURRENTLY_ON_UIT();
|
||||
|
||||
@@ -1734,7 +1734,8 @@ void CefBrowserHostImpl::DidFailLoad(
|
||||
OnLoadEnd(frame, validated_url, error_code);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::PluginCrashed(const FilePath& plugin_path) {
|
||||
void CefBrowserHostImpl::PluginCrashed(const FilePath& plugin_path,
|
||||
base::ProcessId plugin_pid) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler();
|
||||
if (handler.get())
|
||||
|
@@ -291,7 +291,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
const gfx::Size& pref_size) OVERRIDE;
|
||||
virtual void RequestMediaAccessPermission(
|
||||
content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest* request,
|
||||
const content::MediaStreamRequest& request,
|
||||
const content::MediaResponseCallback& callback) OVERRIDE;
|
||||
|
||||
// content::WebContentsObserver methods.
|
||||
@@ -321,7 +321,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
int error_code,
|
||||
const string16& error_description,
|
||||
content::RenderViewHost* render_view_host) OVERRIDE;
|
||||
virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE;
|
||||
virtual void PluginCrashed(const FilePath& plugin_path,
|
||||
base::ProcessId plugin_pid) OVERRIDE;
|
||||
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
||||
// Override to provide a thread safe implementation.
|
||||
virtual bool Send(IPC::Message* message) OVERRIDE;
|
||||
|
@@ -24,73 +24,99 @@
|
||||
#include "ui/base/layout.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
namespace {
|
||||
// CefDevToolsBindingHandler
|
||||
|
||||
class CefDevToolsBindingHandler
|
||||
: public content::DevToolsHttpHandler::RenderViewHostBinding {
|
||||
public:
|
||||
CefDevToolsBindingHandler() {
|
||||
}
|
||||
CefDevToolsBindingHandler::CefDevToolsBindingHandler() {
|
||||
}
|
||||
|
||||
virtual std::string GetIdentifier(content::RenderViewHost* rvh) OVERRIDE {
|
||||
int process_id = rvh->GetProcess()->GetID();
|
||||
int routing_id = rvh->GetRoutingID();
|
||||
std::string CefDevToolsBindingHandler::GetIdentifier(
|
||||
content::DevToolsAgentHost* agent_host) {
|
||||
GarbageCollect();
|
||||
|
||||
if (random_seed_.empty()) {
|
||||
// Generate a random seed that is used to make identifier guessing more
|
||||
// difficult.
|
||||
random_seed_ = base::StringPrintf("%lf|%u",
|
||||
base::Time::Now().ToDoubleT(), base::RandInt(0, INT_MAX));
|
||||
}
|
||||
const std::string& identifier =
|
||||
GetIdentifier(agent_host->GetRenderViewHost());
|
||||
agents_map_[identifier] = agent_host;
|
||||
return identifier;
|
||||
}
|
||||
|
||||
// Create a key that combines RVH IDs and the random seed.
|
||||
std::string key = base::StringPrintf("%d|%d|%s",
|
||||
process_id,
|
||||
routing_id,
|
||||
random_seed_.c_str());
|
||||
content::DevToolsAgentHost* CefDevToolsBindingHandler::ForIdentifier(
|
||||
const std::string& identifier) {
|
||||
GarbageCollect();
|
||||
|
||||
// Return the existing agent host, if any.
|
||||
AgentsMap::const_iterator it = agents_map_.find(identifier);
|
||||
if (it != agents_map_.end())
|
||||
return it->second;
|
||||
|
||||
// Return an MD5 hash of the key.
|
||||
return base::MD5String(key);
|
||||
}
|
||||
// Iterate through the existing RVH instances to find a match.
|
||||
for (content::RenderProcessHost::iterator it(
|
||||
content::RenderProcessHost::AllHostsIterator());
|
||||
!it.IsAtEnd(); it.Advance()) {
|
||||
content::RenderProcessHost* render_process_host = it.GetCurrentValue();
|
||||
DCHECK(render_process_host);
|
||||
|
||||
virtual content::RenderViewHost* ForIdentifier(
|
||||
const std::string& identifier) OVERRIDE {
|
||||
// Iterate through the existing RVH instances to find a match.
|
||||
for (content::RenderProcessHost::iterator it(
|
||||
content::RenderProcessHost::AllHostsIterator());
|
||||
!it.IsAtEnd(); it.Advance()) {
|
||||
content::RenderProcessHost* render_process_host = it.GetCurrentValue();
|
||||
DCHECK(render_process_host);
|
||||
// Ignore processes that don't have a connection, such as crashed contents.
|
||||
if (!render_process_host->HasConnection())
|
||||
continue;
|
||||
|
||||
// Ignore processes that don't have a connection, such as crashed
|
||||
// contents.
|
||||
if (!render_process_host->HasConnection())
|
||||
content::RenderProcessHost::RenderWidgetHostsIterator rwit(
|
||||
render_process_host->GetRenderWidgetHostsIterator());
|
||||
for (; !rwit.IsAtEnd(); rwit.Advance()) {
|
||||
const content::RenderWidgetHost* widget = rwit.GetCurrentValue();
|
||||
DCHECK(widget);
|
||||
if (!widget || !widget->IsRenderView())
|
||||
continue;
|
||||
|
||||
content::RenderProcessHost::RenderWidgetHostsIterator rwit(
|
||||
render_process_host->GetRenderWidgetHostsIterator());
|
||||
for (; !rwit.IsAtEnd(); rwit.Advance()) {
|
||||
const content::RenderWidgetHost* widget = rwit.GetCurrentValue();
|
||||
DCHECK(widget);
|
||||
if (!widget || !widget->IsRenderView())
|
||||
continue;
|
||||
|
||||
content::RenderViewHost* host =
|
||||
content::RenderViewHost::From(
|
||||
const_cast<content::RenderWidgetHost*>(widget));
|
||||
if (GetIdentifier(host) == identifier)
|
||||
return host;
|
||||
content::RenderViewHost* host =
|
||||
content::RenderViewHost::From(
|
||||
const_cast<content::RenderWidgetHost*>(widget));
|
||||
if (GetIdentifier(host) == identifier) {
|
||||
// May create a new agent host.
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host(
|
||||
content::DevToolsAgentHost::GetFor(host));
|
||||
agents_map_[identifier] = agent_host;
|
||||
return agent_host;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string random_seed_;
|
||||
};
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
std::string CefDevToolsBindingHandler::GetIdentifier(
|
||||
content::RenderViewHost* rvh) {
|
||||
int process_id = rvh->GetProcess()->GetID();
|
||||
int routing_id = rvh->GetRoutingID();
|
||||
|
||||
if (random_seed_.empty()) {
|
||||
// Generate a random seed that is used to make identifier guessing more
|
||||
// difficult.
|
||||
random_seed_ = base::StringPrintf("%lf|%u",
|
||||
base::Time::Now().ToDoubleT(), base::RandInt(0, INT_MAX));
|
||||
}
|
||||
|
||||
// Create a key that combines RVH IDs and the random seed.
|
||||
std::string key = base::StringPrintf("%d|%d|%s",
|
||||
process_id,
|
||||
routing_id,
|
||||
random_seed_.c_str());
|
||||
|
||||
// Return an MD5 hash of the key.
|
||||
return base::MD5String(key);
|
||||
}
|
||||
|
||||
void CefDevToolsBindingHandler::GarbageCollect() {
|
||||
AgentsMap::iterator it = agents_map_.begin();
|
||||
while (it != agents_map_.end()) {
|
||||
if (!it->second->GetRenderViewHost())
|
||||
agents_map_.erase(it++);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CefDevToolsDelegate
|
||||
|
||||
CefDevToolsDelegate::CefDevToolsDelegate(int port) {
|
||||
devtools_http_handler_ = content::DevToolsHttpHandler::Start(
|
||||
@@ -99,7 +125,7 @@ CefDevToolsDelegate::CefDevToolsDelegate(int port) {
|
||||
this);
|
||||
|
||||
binding_.reset(new CefDevToolsBindingHandler());
|
||||
devtools_http_handler_->SetRenderViewHostBinding(binding_.get());
|
||||
devtools_http_handler_->SetDevToolsAgentHostBinding(binding_.get());
|
||||
}
|
||||
|
||||
CefDevToolsDelegate::~CefDevToolsDelegate() {
|
||||
|
@@ -6,11 +6,13 @@
|
||||
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DELEGATE_H_
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "content/public/browser/devtools_agent_host.h"
|
||||
#include "content/public/browser/devtools_http_handler.h"
|
||||
#include "content/public/browser/devtools_http_handler_delegate.h"
|
||||
|
||||
@@ -18,6 +20,33 @@ namespace content {
|
||||
class RenderViewHost;
|
||||
}
|
||||
|
||||
class CefDevToolsBindingHandler
|
||||
: public content::DevToolsHttpHandler::DevToolsAgentHostBinding {
|
||||
public:
|
||||
CefDevToolsBindingHandler();
|
||||
|
||||
// DevToolsAgentHostBinding overrides.
|
||||
virtual std::string GetIdentifier(
|
||||
content::DevToolsAgentHost* agent_host) OVERRIDE;
|
||||
virtual content::DevToolsAgentHost* ForIdentifier(
|
||||
const std::string& identifier) OVERRIDE;
|
||||
|
||||
std::string GetIdentifier(content::RenderViewHost* rvh);
|
||||
|
||||
private:
|
||||
void GarbageCollect();
|
||||
|
||||
std::string random_seed_;
|
||||
|
||||
// Map of identifier to DevToolsAgentHost. Keeps the DevToolsAgentHost objects
|
||||
// alive until the associated RVH is disconnected.
|
||||
typedef std::map<std::string, scoped_refptr<content::DevToolsAgentHost> >
|
||||
AgentsMap;
|
||||
AgentsMap agents_map_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsBindingHandler);
|
||||
};
|
||||
|
||||
class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
|
||||
public:
|
||||
explicit CefDevToolsDelegate(int port);
|
||||
@@ -38,7 +67,7 @@ class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
|
||||
|
||||
private:
|
||||
content::DevToolsHttpHandler* devtools_http_handler_;
|
||||
scoped_ptr<content::DevToolsHttpHandler::RenderViewHostBinding> binding_;
|
||||
scoped_ptr<CefDevToolsBindingHandler> binding_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsDelegate);
|
||||
};
|
||||
|
@@ -1,10 +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 "chrome/browser/diagnostics/sqlite_diagnostics.h"
|
||||
|
||||
// Used by SQLitePersistentCookieStore
|
||||
sql::ErrorDelegate* GetErrorHandlerForCookieDb() {
|
||||
return NULL;
|
||||
}
|
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "libcef/common/http_header_utils.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/task_runner_impl.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "net/base/upload_data.h"
|
||||
@@ -43,12 +44,20 @@ class BytesElementReader : public net::UploadBytesElementReader {
|
||||
DISALLOW_COPY_AND_ASSIGN(BytesElementReader);
|
||||
};
|
||||
|
||||
base::TaskRunner* GetFileTaskRunner() {
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner =
|
||||
CefTaskRunnerImpl::GetTaskRunner(TID_FILE);
|
||||
DCHECK(task_runner);
|
||||
return task_runner;
|
||||
}
|
||||
|
||||
// A subclass of net::UploadFileElementReader that keeps the associated
|
||||
// UploadElement alive until the request completes.
|
||||
class FileElementReader : public net::UploadFileElementReader {
|
||||
public:
|
||||
explicit FileElementReader(scoped_ptr<net::UploadElement> element)
|
||||
: net::UploadFileElementReader(
|
||||
GetFileTaskRunner(),
|
||||
element->file_path(),
|
||||
element->file_range_offset(),
|
||||
element->file_range_length(),
|
||||
|
@@ -120,7 +120,7 @@ CefBinaryValueImpl::CefBinaryValueImpl(char* data,
|
||||
bool copy)
|
||||
: CefValueBase<CefBinaryValue, base::BinaryValue>(
|
||||
copy ? base::BinaryValue::CreateWithCopiedBuffer(data, data_size) :
|
||||
base::BinaryValue::Create(data, data_size),
|
||||
new base::BinaryValue(scoped_ptr<char[]>(data), data_size),
|
||||
NULL, kOwnerWillDelete, true, NULL) {
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user