Fix API changes of Chrome 53

This commit is contained in:
Cheng Zhao 2016-09-06 17:22:52 +09:00
parent bff2d41e73
commit ab14221a85
13 changed files with 46 additions and 61 deletions

View file

@ -25,15 +25,6 @@
#include "content/public/browser/resource_context.h"
#include "content/public/browser/storage_partition.h"
#include "net/base/escape.h"
#include "net/ssl/client_cert_store.h"
#if defined(USE_NSS_CERTS)
#include "net/ssl/client_cert_store_nss.h"
#elif defined(OS_WIN)
#include "net/ssl/client_cert_store_win.h"
#elif defined(OS_MACOSX)
#include "net/ssl/client_cert_store_mac.h"
#endif
using content::BrowserThread;
@ -65,19 +56,6 @@ class BrowserContext::ResourceContext : public content::ResourceContext {
return getter_->GetURLRequestContext();
}
std::unique_ptr<net::ClientCertStore> CreateClientCertStore() override {
#if defined(USE_NSS_CERTS)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(
net::ClientCertStoreNSS::PasswordDelegateFactory()));
#elif defined(OS_WIN)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
#elif defined(OS_MACOSX)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac());
#elif defined(USE_OPENSSL)
return std::unique_ptr<net::ClientCertStore>();
#endif
}
URLRequestContextGetter* getter_;
};

View file

@ -13,21 +13,21 @@ namespace {
using DispatchCallback = DevToolsEmbedderMessageDispatcher::DispatchCallback;
bool GetValue(const base::Value* value, std::string* result) {
return value->GetAsString(result);
bool GetValue(const base::Value& value, std::string* result) {
return value.GetAsString(result);
}
bool GetValue(const base::Value* value, int* result) {
return value->GetAsInteger(result);
bool GetValue(const base::Value& value, int* result) {
return value.GetAsInteger(result);
}
bool GetValue(const base::Value* value, bool* result) {
return value->GetAsBoolean(result);
bool GetValue(const base::Value& value, bool* result) {
return value.GetAsBoolean(result);
}
bool GetValue(const base::Value* value, gfx::Rect* rect) {
bool GetValue(const base::Value& value, gfx::Rect* rect) {
const base::DictionaryValue* dict;
if (!value->GetAsDictionary(&dict))
if (!value.GetAsDictionary(&dict))
return false;
int x = 0;
int y = 0;
@ -69,7 +69,8 @@ template <typename T, typename... Ts>
struct ParamTuple<T, Ts...> {
bool Parse(const base::ListValue& list,
const base::ListValue::const_iterator& it) {
return it != list.end() && GetValue(*it, &head) && tail.Parse(list, it + 1);
return it != list.end() && GetValue(**it, &head) &&
tail.Parse(list, it + 1);
}
template <typename H, typename... As>

View file

@ -317,7 +317,7 @@ void InspectableWebContentsImpl::AttachTo(const scoped_refptr<content::DevToolsA
void InspectableWebContentsImpl::Detach() {
if (agent_host_.get())
agent_host_->DetachClient();
agent_host_->DetachClient(this);
agent_host_ = nullptr;
}
@ -530,7 +530,7 @@ void InspectableWebContentsImpl::DispatchProtocolMessageFromDevToolsFrontend(
}
if (agent_host_.get())
agent_host_->DispatchProtocolMessage(message);
agent_host_->DispatchProtocolMessage(this, message);
}
void InspectableWebContentsImpl::RecordActionUMA(const std::string& name, int action) {
@ -687,11 +687,11 @@ content::ColorChooser* InspectableWebContentsImpl::OpenColorChooser(
}
void InspectableWebContentsImpl::RunFileChooser(
content::WebContents* source,
content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params) {
auto delegate = web_contents_->GetDelegate();
if (delegate)
delegate->RunFileChooser(source, params);
delegate->RunFileChooser(render_frame_host, params);
}
void InspectableWebContentsImpl::EnumerateDirectory(

View file

@ -157,7 +157,7 @@ class InspectableWebContentsImpl :
content::WebContents* source,
SkColor color,
const std::vector<content::ColorSuggestion>& suggestions) override;
void RunFileChooser(content::WebContents* source,
void RunFileChooser(content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params) override;
void EnumerateDirectory(content::WebContents* source,
int request_id,

View file

@ -284,9 +284,9 @@ void DevToolsNetworkTransaction::SetBeforeNetworkStartCallback(
transaction_->SetBeforeNetworkStartCallback(callback);
}
void DevToolsNetworkTransaction::SetBeforeProxyHeadersSentCallback(
const BeforeProxyHeadersSentCallback& callback) {
transaction_->SetBeforeProxyHeadersSentCallback(callback);
void DevToolsNetworkTransaction::SetBeforeHeadersSentCallback(
const BeforeHeadersSentCallback& callback) {
transaction_->SetBeforeHeadersSentCallback(callback);
}
int DevToolsNetworkTransaction::ResumeNetworkStart() {

View file

@ -62,8 +62,8 @@ class DevToolsNetworkTransaction : public net::HttpTransaction {
net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) override;
void SetBeforeNetworkStartCallback(
const BeforeNetworkStartCallback& callback) override;
void SetBeforeProxyHeadersSentCallback(
const BeforeProxyHeadersSentCallback& callback) override;
void SetBeforeHeadersSentCallback(
const BeforeHeadersSentCallback& callback) override;
int ResumeNetworkStart() override;
void GetConnectionAttempts(net::ConnectionAttempts* out) const override;

View file

@ -50,23 +50,25 @@ int NetworkDelegate::OnBeforeURLRequest(
return net::OK;
}
int NetworkDelegate::OnBeforeSendHeaders(
int NetworkDelegate::OnBeforeStartTransaction(
net::URLRequest* request,
const net::CompletionCallback& callback,
net::HttpRequestHeaders* headers) {
return net::OK;
}
void NetworkDelegate::OnBeforeSendProxyHeaders(net::URLRequest* request,
const net::ProxyInfo& proxy_info,
net::HttpRequestHeaders* headers) {
}
void NetworkDelegate::OnSendHeaders(
void NetworkDelegate::OnStartTransaction(
net::URLRequest* request,
const net::HttpRequestHeaders& headers) {
}
void NetworkDelegate::OnBeforeSendHeaders(
net::URLRequest* request,
const net::ProxyInfo& proxy_info,
const net::ProxyRetryInfoMap& proxy_retry_info,
net::HttpRequestHeaders* headers) {
}
int NetworkDelegate::OnHeadersReceived(
net::URLRequest* request,
const net::CompletionCallback& callback,

View file

@ -22,14 +22,15 @@ class NetworkDelegate : public net::NetworkDelegate {
int OnBeforeURLRequest(net::URLRequest* request,
const net::CompletionCallback& callback,
GURL* new_url) override;
int OnBeforeSendHeaders(net::URLRequest* request,
const net::CompletionCallback& callback,
net::HttpRequestHeaders* headers) override;
void OnBeforeSendProxyHeaders(net::URLRequest* request,
const net::ProxyInfo& proxy_info,
net::HttpRequestHeaders* headers) override;
void OnSendHeaders(net::URLRequest* request,
const net::HttpRequestHeaders& headers) override;
int OnBeforeStartTransaction(net::URLRequest* request,
const net::CompletionCallback& callback,
net::HttpRequestHeaders* headers) override;
void OnBeforeSendHeaders(net::URLRequest* request,
const net::ProxyInfo& proxy_info,
const net::ProxyRetryInfoMap& proxy_retry_info,
net::HttpRequestHeaders* headers) override;
void OnStartTransaction(net::URLRequest* request,
const net::HttpRequestHeaders& headers) override;
int OnHeadersReceived(
net::URLRequest* request,
const net::CompletionCallback& callback,

View file

@ -295,7 +295,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
}
// --ignore-certificate-errors
if (command_line.HasSwitch(::switches::kIgnoreCertificateErrors))
if (command_line.HasSwitch(switches::kIgnoreCertificateErrors))
network_session_params.ignore_certificate_errors = true;
// --host-rules

View file

@ -54,8 +54,8 @@ gfx::Image& ContentClient::GetNativeImageNamed(int resource_id) const {
resource_id);
}
base::RefCountedStaticMemory* ContentClient::GetDataResourceBytes(
int resource_id) const {
base::RefCountedMemory* ContentClient::GetDataResourceBytes(
int resource_id) const {
return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id);
}

View file

@ -24,8 +24,7 @@ class ContentClient : public content::ContentClient {
base::StringPiece GetDataResource(int resource_id,
ui::ScaleFactor) const override;
gfx::Image& GetNativeImageNamed(int resource_id) const override;
base::RefCountedStaticMemory* GetDataResourceBytes(
int resource_id) const override;
base::RefCountedMemory* GetDataResourceBytes(int resource_id) const override;
DISALLOW_COPY_AND_ASSIGN(ContentClient);
};

View file

@ -49,6 +49,9 @@ const char kAuthServerWhitelist[] = "auth-server-whitelist";
// Whitelist containing servers for which Kerberos delegation is allowed.
const char kAuthNegotiateDelegateWhitelist[] = "auth-negotiate-delegate-whitelist";
// Ignores certificate-related errors.
const char kIgnoreCertificateErrors[] = "ignore-certificate-errors";
} // namespace switches
} // namespace brightray

View file

@ -17,6 +17,7 @@ extern const char kProxyPacUrl[];
extern const char kDisableHttp2[];
extern const char kAuthServerWhitelist[];
extern const char kAuthNegotiateDelegateWhitelist[];
extern const char kIgnoreCertificateErrors[];
} // namespace switches