Update to API changes of Chrome 47

This commit is contained in:
Cheng Zhao 2015-12-07 19:55:01 +08:00
Родитель 5d8167afd6
Коммит 75d0bc848d
21 изменённых файлов: 103 добавлений и 59 удалений

Просмотреть файл

@ -40,7 +40,7 @@ namespace {
// Convert string to lower case and escape it.
std::string MakePartitionName(const std::string& input) {
return net::EscapePath(base::StringToLowerASCII(input));
return net::EscapePath(base::ToLowerASCII(input));
}
} // namespace

Просмотреть файл

@ -99,6 +99,8 @@ class DevToolsDelegate :
std::string GetDiscoveryPageHTML() override;
std::string GetFrontendResource(const std::string& path) override;
std::string GetPageThumbnailData(const GURL& url) override;
content::DevToolsExternalAgentProxyDelegate* HandleWebSocketConnection(
const std::string& path) override;
private:
DISALLOW_COPY_AND_ASSIGN(DevToolsDelegate);
@ -125,6 +127,11 @@ std::string DevToolsDelegate::GetPageThumbnailData(const GURL& url) {
return std::string();
}
content::DevToolsExternalAgentProxyDelegate*
DevToolsDelegate::HandleWebSocketConnection(const std::string& path) {
return nullptr;
}
} // namespace
// DevToolsManagerDelegate ---------------------------------------------------

Просмотреть файл

@ -30,19 +30,25 @@ std::string PathWithoutParams(const std::string& path) {
std::string GetMimeTypeForPath(const std::string& path) {
std::string filename = PathWithoutParams(path);
if (base::EndsWith(filename, ".html", false)) {
if (base::EndsWith(filename, ".html", base::CompareCase::INSENSITIVE_ASCII)) {
return "text/html";
} else if (base::EndsWith(filename, ".css", false)) {
} else if (base::EndsWith(filename, ".css",
base::CompareCase::INSENSITIVE_ASCII)) {
return "text/css";
} else if (base::EndsWith(filename, ".js", false)) {
} else if (base::EndsWith(filename, ".js",
base::CompareCase::INSENSITIVE_ASCII)) {
return "application/javascript";
} else if (base::EndsWith(filename, ".png", false)) {
} else if (base::EndsWith(filename, ".png",
base::CompareCase::INSENSITIVE_ASCII)) {
return "image/png";
} else if (base::EndsWith(filename, ".gif", false)) {
} else if (base::EndsWith(filename, ".gif",
base::CompareCase::INSENSITIVE_ASCII)) {
return "image/gif";
} else if (base::EndsWith(filename, ".svg", false)) {
} else if (base::EndsWith(filename, ".svg",
base::CompareCase::INSENSITIVE_ASCII)) {
return "image/svg+xml";
} else if (base::EndsWith(filename, ".manifest", false)) {
} else if (base::EndsWith(filename, ".manifest",
base::CompareCase::INSENSITIVE_ASCII)) {
return "text/cache-manifest";
}
return "text/html";

Просмотреть файл

@ -6,7 +6,7 @@
#include "content/public/browser/render_widget_host_view.h"
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
#include "ui/gfx/mac/scoped_ns_disable_screen_updates.h"
#include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h"
using namespace brightray;
@ -89,7 +89,7 @@ using namespace brightray;
// Focus on web view.
devToolsWebContents->RestoreFocus();
} else {
gfx::ScopedNSDisableScreenUpdates disabler;
gfx::ScopedCocoaDisableScreenUpdates disabler;
[devToolsView removeFromSuperview];
[self adjustSubviews];
}

Просмотреть файл

@ -37,7 +37,7 @@ const MediaStreamDevices& EmptyDevices() {
} // namespace
MediaCaptureDevicesDispatcher* MediaCaptureDevicesDispatcher::GetInstance() {
return Singleton<MediaCaptureDevicesDispatcher>::get();
return base::Singleton<MediaCaptureDevicesDispatcher>::get();
}
MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher()

Просмотреть файл

@ -64,7 +64,7 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver {
int render_view_id) override;
private:
friend struct DefaultSingletonTraits<MediaCaptureDevicesDispatcher>;
friend struct base::DefaultSingletonTraits<MediaCaptureDevicesDispatcher>;
MediaCaptureDevicesDispatcher();
virtual ~MediaCaptureDevicesDispatcher();

Просмотреть файл

@ -68,7 +68,7 @@ class DevToolsNetworkInterceptor {
// Transactions waiting certain amount of transfer to be accounted.
std::vector<DevToolsNetworkTransaction*> throttled_transactions_;
base::OneShotTimer<DevToolsNetworkInterceptor> timer_;
base::OneShotTimer timer_;
base::TimeTicks offset_;
base::TimeDelta tick_length_;
base::TimeDelta latency_length_;

Просмотреть файл

@ -151,6 +151,10 @@ int64_t DevToolsNetworkTransaction::GetTotalReceivedBytes() const {
return transaction_->GetTotalReceivedBytes();
}
int64_t DevToolsNetworkTransaction::GetTotalSentBytes() const {
return transaction_->GetTotalSentBytes();
}
void DevToolsNetworkTransaction::DoneReading() {
transaction_->DoneReading();
}
@ -178,6 +182,11 @@ bool DevToolsNetworkTransaction::GetLoadTimingInfo(
return transaction_->GetLoadTimingInfo(info);
}
bool DevToolsNetworkTransaction::GetRemoteEndpoint(
net::IPEndPoint* endpoint) const {
return transaction_->GetRemoteEndpoint(endpoint);
}
void DevToolsNetworkTransaction::SetPriority(net::RequestPriority priority) {
transaction_->SetPriority(priority);
}

Просмотреть файл

@ -55,12 +55,14 @@ class DevToolsNetworkTransaction : public net::HttpTransaction {
void StopCaching() override;
bool GetFullRequestHeaders(net::HttpRequestHeaders* headers) const override;
int64_t GetTotalReceivedBytes() const override;
int64_t GetTotalSentBytes() const override;
void DoneReading() override;
const net::HttpResponseInfo* GetResponseInfo() const override;
net::LoadState GetLoadState() const override;
net::UploadProgress GetUploadProgress() const override;
void SetQuicServerInfo(net::QuicServerInfo* quic_server_info) override;
bool GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override;
bool GetRemoteEndpoint(net::IPEndPoint* endpoint) const override;
void SetPriority(net::RequestPriority priority) override;
void SetWebSocketHandshakeStreamCreateHelper(
net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) override;

Просмотреть файл

@ -26,7 +26,8 @@ NetworkDelegate::NetworkDelegate() {
auto command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(kIgnoreConnectionsLimit)) {
std::string value = command_line->GetSwitchValueASCII(kIgnoreConnectionsLimit);
base::SplitString(value, ',', &ignore_connections_limit_domains_);
ignore_connections_limit_domains_ = base::SplitString(
value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
}
}
@ -38,7 +39,7 @@ int NetworkDelegate::OnBeforeURLRequest(
const net::CompletionCallback& callback,
GURL* new_url) {
for (const auto& domain : ignore_connections_limit_domains_) {
if (request->url().DomainIs(domain.c_str(), domain.size())) {
if (request->url().DomainIs(domain)) {
// Allow unlimited concurrent connections.
request->SetPriority(net::MAXIMUM_PRIORITY);
request->SetLoadFlags(request->load_flags() | net::LOAD_IGNORE_LIMITS);
@ -91,8 +92,15 @@ void NetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
void NetworkDelegate::OnResponseStarted(net::URLRequest* request) {
}
void NetworkDelegate::OnRawBytesRead(const net::URLRequest& request,
int bytes_read) {
void NetworkDelegate::OnURLRequestJobOrphaned(net::URLRequest* request) {
}
void NetworkDelegate::OnNetworkBytesReceived(const net::URLRequest& request,
int64_t bytes_read) {
}
void NetworkDelegate::OnNetworkBytesSent(const net::URLRequest& request,
int64_t bytes_sent) {
}
void NetworkDelegate::OnCompleted(net::URLRequest* request, bool started) {

Просмотреть файл

@ -43,8 +43,11 @@ class NetworkDelegate : public net::NetworkDelegate {
void OnBeforeRedirect(net::URLRequest* request,
const GURL& new_location) override;
void OnResponseStarted(net::URLRequest* request) override;
void OnRawBytesRead(const net::URLRequest& request,
int bytes_read) override;
void OnURLRequestJobOrphaned(net::URLRequest* request) override;
void OnNetworkBytesReceived(const net::URLRequest& request,
int64_t bytes_read) override;
void OnNetworkBytesSent(const net::URLRequest& request,
int64_t bytes_sent) override;
void OnCompleted(net::URLRequest* request, bool started) override;
void OnURLRequestDestroyed(net::URLRequest* request) override;
void OnPACScriptError(int line_number,

Просмотреть файл

@ -18,10 +18,9 @@ PermissionManager::PermissionManager() {
PermissionManager::~PermissionManager() {
}
void PermissionManager::RequestPermission(
int PermissionManager::RequestPermission(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
int request_id,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(content::PermissionStatus)>& callback) {
@ -30,13 +29,10 @@ void PermissionManager::RequestPermission(
GrantSendMidiSysExMessage(render_frame_host->GetProcess()->GetID());
}
callback.Run(content::PERMISSION_STATUS_GRANTED);
return kNoPendingOperation;
}
void PermissionManager::CancelPermissionRequest(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
int request_id,
const GURL& requesting_origin) {
void PermissionManager::CancelPermissionRequest(int request_id) {
}
void PermissionManager::ResetPermission(

Просмотреть файл

@ -17,17 +17,13 @@ class PermissionManager : public content::PermissionManager {
~PermissionManager() override;
// content::PermissionManager:
void RequestPermission(
int RequestPermission(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
int request_id,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(content::PermissionStatus)>& callback) override;
void CancelPermissionRequest(content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
int request_id,
const GURL& requesting_origin) override;
void CancelPermissionRequest(int request_id) override;
void ResetPermission(content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;

Просмотреть файл

@ -17,7 +17,7 @@ namespace brightray {
// static
PlatformNotificationServiceImpl*
PlatformNotificationServiceImpl::GetInstance() {
return Singleton<PlatformNotificationServiceImpl>::get();
return base::Singleton<PlatformNotificationServiceImpl>::get();
}
PlatformNotificationServiceImpl::PlatformNotificationServiceImpl() {}

Просмотреть файл

@ -22,7 +22,7 @@ class PlatformNotificationServiceImpl
NotificationPresenter* notification_presenter();
private:
friend struct DefaultSingletonTraits<PlatformNotificationServiceImpl>;
friend struct base::DefaultSingletonTraits<PlatformNotificationServiceImpl>;
PlatformNotificationServiceImpl();
~PlatformNotificationServiceImpl() override;

Просмотреть файл

@ -20,6 +20,10 @@ bool SpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) {
return true;
}
bool SpecialStoragePolicy::IsStorageDurable(const GURL& origin) {
return true;
}
bool SpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
return false;
}

Просмотреть файл

@ -16,6 +16,7 @@ class SpecialStoragePolicy : public storage::SpecialStoragePolicy {
// storage::SpecialStoragePolicy implementation.
bool IsStorageProtected(const GURL& origin) override;
bool IsStorageUnlimited(const GURL& origin) override;
bool IsStorageDurable(const GURL& origin) override;
bool IsStorageSessionOnly(const GURL& origin) override;
bool CanQueryDiskSize(const GURL& origin) override;
bool HasIsolatedStorage(const GURL& origin) override;

Просмотреть файл

@ -111,19 +111,24 @@ std::string URLRequestContextGetter::Delegate::GetUserAgent() {
return base::EmptyString();
}
net::URLRequestJobFactory* URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
scoped_ptr<net::URLRequestJobFactory>
URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector* protocol_interceptors) {
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(new net::URLRequestJobFactoryImpl);
for (auto it = protocol_handlers->begin(); it != protocol_handlers->end(); ++it)
job_factory->SetProtocolHandler(it->first, it->second.release());
job_factory->SetProtocolHandler(
it->first, make_scoped_ptr(it->second.release()));
protocol_handlers->clear();
job_factory->SetProtocolHandler(url::kDataScheme, new net::DataProtocolHandler);
job_factory->SetProtocolHandler(url::kFileScheme, new net::FileProtocolHandler(
BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
job_factory->SetProtocolHandler(
url::kDataScheme, make_scoped_ptr(new net::DataProtocolHandler));
job_factory->SetProtocolHandler(
url::kFileScheme,
make_scoped_ptr(new net::FileProtocolHandler(
BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))));
// Set up interceptors in the reverse order.
scoped_ptr<net::URLRequestJobFactory> top_job_factory = job_factory.Pass();
@ -133,7 +138,7 @@ net::URLRequestJobFactory* URLRequestContextGetter::Delegate::CreateURLRequestJo
top_job_factory.Pass(), make_scoped_ptr(*i)));
protocol_interceptors->weak_clear();
return top_job_factory.release();
return top_job_factory.Pass();
}
net::HttpCache::BackendFactory*
@ -147,7 +152,8 @@ URLRequestContextGetter::Delegate::CreateHttpCacheBackendFactory(const base::Fil
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE));
}
net::CertVerifier* URLRequestContextGetter::Delegate::CreateCertVerifier() {
scoped_ptr<net::CertVerifier>
URLRequestContextGetter::Delegate::CreateCertVerifier() {
return net::CertVerifier::CreateDefault();
}
@ -191,8 +197,8 @@ URLRequestContextGetter::URLRequestContextGetter(
// We must create the proxy config service on the UI loop on Linux because it
// must synchronously run on the glib message loop. This will be passed to
// the URLRequestContextStorage on the IO thread in GetURLRequestContext().
proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService(
io_loop_->task_runner(), file_loop_->task_runner()));
proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService(
io_loop_->task_runner(), file_loop_->task_runner());
}
URLRequestContextGetter::~URLRequestContextGetter() {
@ -241,8 +247,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
base::WorkerPool::GetTaskRunner(true))));
std::string accept_lang = l10n_util::GetApplicationLocale("");
storage_->set_http_user_agent_settings(new net::StaticHttpUserAgentSettings(
net::HttpUtil::GenerateAcceptLanguageHeader(accept_lang), delegate_->GetUserAgent()));
storage_->set_http_user_agent_settings(make_scoped_ptr(
new net::StaticHttpUserAgentSettings(
net::HttpUtil::GenerateAcceptLanguageHeader(accept_lang),
delegate_->GetUserAgent())));
scoped_ptr<net::HostResolver> host_resolver(net::HostResolver::CreateDefaultResolver(nullptr));
@ -275,7 +283,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
} else {
storage_->set_proxy_service(
net::CreateProxyServiceUsingV8ProxyResolver(
proxy_config_service_.release(),
proxy_config_service_.Pass(),
new net::ProxyScriptFetcherImpl(url_request_context_.get()),
dhcp_factory.Create(url_request_context_.get()),
host_resolver.get(),
@ -289,7 +297,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
schemes.push_back(std::string("ntlm"));
schemes.push_back(std::string("negotiate"));
auto auth_handler_factory =
auto auth_handler_factory = make_scoped_ptr(
net::HttpAuthHandlerRegistryFactory::Create(
schemes,
url_sec_mgr_.get(),
@ -297,12 +305,13 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
std::string(), // gssapi_library_name
std::string(), // gssapi_library_nam
false, // auth_android_negotiate_account_type
true); // negotiate_enable_port
true)); // negotiate_enable_port
storage_->set_cert_verifier(delegate_->CreateCertVerifier());
storage_->set_transport_security_state(new net::TransportSecurityState);
storage_->set_transport_security_state(
make_scoped_ptr(new net::TransportSecurityState));
storage_->set_ssl_config_service(delegate_->CreateSSLConfigService());
storage_->set_http_auth_handler_factory(auth_handler_factory);
storage_->set_http_auth_handler_factory(auth_handler_factory.Pass());
scoped_ptr<net::HttpServerProperties> server_properties(
new net::HttpServerPropertiesImpl);
storage_->set_http_server_properties(server_properties.Pass());
@ -344,10 +353,11 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
} else {
backend = delegate_->CreateHttpCacheBackendFactory(base_path_);
}
storage_->set_http_transaction_factory(new net::HttpCache(
new DevToolsNetworkTransactionFactory(controller_, session),
url_request_context_->net_log(),
backend));
storage_->set_http_transaction_factory(make_scoped_ptr(
new net::HttpCache(
new DevToolsNetworkTransactionFactory(controller_, session),
url_request_context_->net_log(),
backend)));
storage_->set_job_factory(delegate_->CreateURLRequestJobFactory(
&protocol_handlers_, &protocol_interceptors_));

Просмотреть файл

@ -39,12 +39,12 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
virtual net::NetworkDelegate* CreateNetworkDelegate() { return NULL; }
virtual std::string GetUserAgent();
virtual net::URLRequestJobFactory* CreateURLRequestJobFactory(
virtual scoped_ptr<net::URLRequestJobFactory> CreateURLRequestJobFactory(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector* protocol_interceptors);
virtual net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory(
const base::FilePath& base_path);
virtual net::CertVerifier* CreateCertVerifier();
virtual scoped_ptr<net::CertVerifier> CreateCertVerifier();
virtual net::SSLConfigService* CreateSSLConfigService();
virtual bool AllowNTLMCredentialsForDomain(const GURL& auth_origin);
virtual bool CanDelegateURLSecurity(const GURL& auth_origin);

Просмотреть файл

@ -20,7 +20,7 @@ const char kChromeUIDevToolsBundledHost[] = "devtools";
// static
WebUIControllerFactory* WebUIControllerFactory::GetInstance() {
return Singleton<WebUIControllerFactory>::get();
return base::Singleton<WebUIControllerFactory>::get();
}
WebUIControllerFactory::WebUIControllerFactory() {

Просмотреть файл

@ -9,7 +9,9 @@
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller_factory.h"
namespace base {
template <typename T> struct DefaultSingletonTraits;
}
namespace brightray {
@ -33,7 +35,7 @@ class WebUIControllerFactory : public content::WebUIControllerFactory {
const GURL& url) const override;
private:
friend struct DefaultSingletonTraits<WebUIControllerFactory>;
friend struct base::DefaultSingletonTraits<WebUIControllerFactory>;
DISALLOW_COPY_AND_ASSIGN(WebUIControllerFactory);
};