Merge pull request #288 from electron/chrome58

Upgrade to Chrome 58
This commit is contained in:
Kevin Sawicki 2017-05-02 08:52:42 -07:00 committed by GitHub
commit 93d7973590
19 changed files with 54 additions and 73 deletions

View file

@ -35,6 +35,7 @@
'<(libchromiumcontent_src_dir)/third_party/khronos', '<(libchromiumcontent_src_dir)/third_party/khronos',
'<(libchromiumcontent_src_dir)/third_party/WebKit', '<(libchromiumcontent_src_dir)/third_party/WebKit',
'<(libchromiumcontent_dir)/gen', '<(libchromiumcontent_dir)/gen',
'<(libchromiumcontent_dir)/gen/third_party/WebKit',
], ],
}, },
'sources': [ '<@(brightray_sources)' ], 'sources': [ '<@(brightray_sources)' ],
@ -161,6 +162,8 @@
# Required by webrtc: # Required by webrtc:
'$(SDKROOT)/System/Library/Frameworks/OpenGL.framework', '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
'$(SDKROOT)/System/Library/Frameworks/IOKit.framework', '$(SDKROOT)/System/Library/Frameworks/IOKit.framework',
# Required by media:
'$(SDKROOT)/System/Library/Frameworks/VideoToolbox.framework',
], ],
}, },
'conditions': [ 'conditions': [

View file

@ -92,8 +92,6 @@
'Common_Base': { 'Common_Base': {
'abstract': 1, 'abstract': 1,
'defines': [ 'defines': [
# Used by content_browser_client.h:
'ENABLE_WEBRTC',
# We are using Release version libchromiumcontent: # We are using Release version libchromiumcontent:
'NDEBUG', 'NDEBUG',
# Needed by gin: # Needed by gin:

View file

@ -15,7 +15,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "media/base/media_resources.h" #include "media/base/localized_strings.h"
#include "net/proxy/proxy_resolver_v8.h" #include "net/proxy/proxy_resolver_v8.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/material_design/material_design_controller.h" #include "ui/base/material_design/material_design_controller.h"
@ -163,7 +163,7 @@ void BrowserMainParts::PreEarlyInitialization() {
base::FeatureList::SetInstance(std::move(feature_list)); base::FeatureList::SetInstance(std::move(feature_list));
#if defined(USE_X11) #if defined(USE_X11)
views::LinuxUI::SetInstance(BuildGtk2UI()); views::LinuxUI::SetInstance(BuildGtkUi());
OverrideLinuxAppDataPath(); OverrideLinuxAppDataPath();
// Installs the X11 error handlers for the browser process used during // Installs the X11 error handlers for the browser process used during

View file

@ -194,7 +194,6 @@ DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(
d->RegisterHandler("dispatchProtocolMessage", d->RegisterHandler("dispatchProtocolMessage",
&Delegate::DispatchProtocolMessageFromDevToolsFrontend, &Delegate::DispatchProtocolMessageFromDevToolsFrontend,
delegate); delegate);
d->RegisterHandler("recordActionUMA", &Delegate::RecordActionUMA, delegate);
d->RegisterHandlerWithCallback("sendJsonRequest", d->RegisterHandlerWithCallback("sendJsonRequest",
&Delegate::SendJsonRequest, delegate); &Delegate::SendJsonRequest, delegate);
d->RegisterHandlerWithCallback("getPreferences", d->RegisterHandlerWithCallback("getPreferences",

View file

@ -70,7 +70,6 @@ class DevToolsEmbedderMessageDispatcher {
virtual void SetDevicesUpdatesEnabled(bool enabled) = 0; virtual void SetDevicesUpdatesEnabled(bool enabled) = 0;
virtual void DispatchProtocolMessageFromDevToolsFrontend( virtual void DispatchProtocolMessageFromDevToolsFrontend(
const std::string& message) = 0; const std::string& message) = 0;
virtual void RecordActionUMA(const std::string& name, int action) = 0;
virtual void SendJsonRequest(const DispatchCallback& callback, virtual void SendJsonRequest(const DispatchCallback& callback,
const std::string& browser_id, const std::string& browser_id,
const std::string& url) = 0; const std::string& url) = 0;

View file

@ -61,11 +61,6 @@ const char kFrontendHostMethod[] = "method";
const char kFrontendHostParams[] = "params"; const char kFrontendHostParams[] = "params";
const char kTitleFormat[] = "Developer Tools - %s"; const char kTitleFormat[] = "Developer Tools - %s";
const char kDevToolsActionTakenHistogram[] = "DevTools.ActionTaken";
const int kDevToolsActionTakenBoundary = 100;
const char kDevToolsPanelShownHistogram[] = "DevTools.PanelShown";
const int kDevToolsPanelShownBoundary = 20;
const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
void RectToDictionary(const gfx::Rect& bounds, base::DictionaryValue* dict) { void RectToDictionary(const gfx::Rect& bounds, base::DictionaryValue* dict) {
@ -171,7 +166,7 @@ int ResponseWriter::Initialize(const net::CompletionCallback& callback) {
int ResponseWriter::Write(net::IOBuffer* buffer, int ResponseWriter::Write(net::IOBuffer* buffer,
int num_bytes, int num_bytes,
const net::CompletionCallback& callback) { const net::CompletionCallback& callback) {
auto* id = new base::FundamentalValue(stream_id_); auto* id = new base::Value(stream_id_);
base::StringValue* chunk = base::StringValue* chunk =
new base::StringValue(std::string(buffer->data(), num_bytes)); new base::StringValue(std::string(buffer->data(), num_bytes));
@ -240,9 +235,14 @@ InspectableWebContentsImpl::InspectableWebContentsImpl(
} }
InspectableWebContentsImpl::~InspectableWebContentsImpl() { InspectableWebContentsImpl::~InspectableWebContentsImpl() {
if (devtools_web_contents_) // Unsubscribe from devtools and Clean up resources.
devtools_web_contents_->Close(); if (devtools_web_contents_) {
Observe(nullptr); devtools_web_contents_->SetDelegate(nullptr);
// Calling this also unsubscribes the observer, so WebContentsDestroyed
// won't be called again.
WebContentsDestroyed();
}
// Let destructor destroy devtools_web_contents_.
} }
InspectableWebContentsView* InspectableWebContentsImpl::GetView() const { InspectableWebContentsView* InspectableWebContentsImpl::GetView() const {
@ -310,6 +310,7 @@ void InspectableWebContentsImpl::ShowDevTools() {
void InspectableWebContentsImpl::CloseDevTools() { void InspectableWebContentsImpl::CloseDevTools() {
if (devtools_web_contents_) { if (devtools_web_contents_) {
frontend_loaded_ = false;
view_->CloseDevTools(); view_->CloseDevTools();
devtools_web_contents_.reset(); devtools_web_contents_.reset();
web_contents_->Focus(); web_contents_->Focus();
@ -563,14 +564,6 @@ void InspectableWebContentsImpl::DispatchProtocolMessageFromDevToolsFrontend(
agent_host_->DispatchProtocolMessage(this, message); agent_host_->DispatchProtocolMessage(this, message);
} }
void InspectableWebContentsImpl::RecordActionUMA(const std::string& name,
int action) {
if (name == kDevToolsActionTakenHistogram)
UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsActionTakenBoundary);
else if (name == kDevToolsPanelShownHistogram)
UMA_HISTOGRAM_ENUMERATION(name, action, kDevToolsPanelShownBoundary);
}
void InspectableWebContentsImpl::SendJsonRequest( void InspectableWebContentsImpl::SendJsonRequest(
const DispatchCallback& callback, const DispatchCallback& callback,
const std::string& browser_id, const std::string& browser_id,
@ -639,7 +632,7 @@ void InspectableWebContentsImpl::DispatchProtocolMessage(
return; return;
} }
base::FundamentalValue total_size(static_cast<int>(message.length())); base::Value total_size(static_cast<int>(message.length()));
for (size_t pos = 0; pos < message.length(); pos += kMaxMessageChunkSize) { for (size_t pos = 0; pos < message.length(); pos += kMaxMessageChunkSize) {
base::StringValue message_value(message.substr(pos, kMaxMessageChunkSize)); base::StringValue message_value(message.substr(pos, kMaxMessageChunkSize));
CallClientFunction("DevToolsAPI.dispatchMessageChunk", CallClientFunction("DevToolsAPI.dispatchMessageChunk",
@ -664,6 +657,7 @@ void InspectableWebContentsImpl::RenderFrameHostChanged(
void InspectableWebContentsImpl::WebContentsDestroyed() { void InspectableWebContentsImpl::WebContentsDestroyed() {
frontend_loaded_ = false; frontend_loaded_ = false;
Observe(nullptr);
Detach(); Detach();
for (const auto& pair : pending_requests_) for (const auto& pair : pending_requests_)
@ -686,10 +680,12 @@ bool InspectableWebContentsImpl::DidAddMessageToConsole(
bool InspectableWebContentsImpl::ShouldCreateWebContents( bool InspectableWebContentsImpl::ShouldCreateWebContents(
content::WebContents* web_contents, content::WebContents* web_contents,
content::SiteInstance* source_site_instance,
int32_t route_id, int32_t route_id,
int32_t main_frame_route_id, int32_t main_frame_route_id,
int32_t main_frame_widget_route_id, int32_t main_frame_widget_route_id,
WindowContainerType window_container_type, content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
const std::string& frame_name, const std::string& frame_name,
const GURL& target_url, const GURL& target_url,
const std::string& partition_id, const std::string& partition_id,
@ -706,6 +702,7 @@ void InspectableWebContentsImpl::HandleKeyboardEvent(
} }
void InspectableWebContentsImpl::CloseContents(content::WebContents* source) { void InspectableWebContentsImpl::CloseContents(content::WebContents* source) {
// This is where the devtools closes itself (by clicking the x button).
CloseDevTools(); CloseDevTools();
} }
@ -777,7 +774,7 @@ void InspectableWebContentsImpl::OnURLFetchComplete(
void InspectableWebContentsImpl::SendMessageAck(int request_id, void InspectableWebContentsImpl::SendMessageAck(int request_id,
const base::Value* arg) { const base::Value* arg) {
base::FundamentalValue id_value(request_id); base::Value id_value(request_id);
CallClientFunction("DevToolsAPI.embedderMessageAck", CallClientFunction("DevToolsAPI.embedderMessageAck",
&id_value, arg, nullptr); &id_value, arg, nullptr);
} }

View file

@ -107,7 +107,6 @@ class InspectableWebContentsImpl :
void SetDevicesUpdatesEnabled(bool enabled) override; void SetDevicesUpdatesEnabled(bool enabled) override;
void DispatchProtocolMessageFromDevToolsFrontend( void DispatchProtocolMessageFromDevToolsFrontend(
const std::string& message) override; const std::string& message) override;
void RecordActionUMA(const std::string& name, int action) override;
void SendJsonRequest(const DispatchCallback& callback, void SendJsonRequest(const DispatchCallback& callback,
const std::string& browser_id, const std::string& browser_id,
const std::string& url) override; const std::string& url) override;
@ -143,10 +142,12 @@ class InspectableWebContentsImpl :
const base::string16& source_id) override; const base::string16& source_id) override;
bool ShouldCreateWebContents( bool ShouldCreateWebContents(
content::WebContents* web_contents, content::WebContents* web_contents,
content::SiteInstance* source_site_instance,
int32_t route_id, int32_t route_id,
int32_t main_frame_route_id, int32_t main_frame_route_id,
int32_t main_frame_widget_route_id, int32_t main_frame_widget_route_id,
WindowContainerType window_container_type, content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,
const std::string& frame_name, const std::string& frame_name,
const GURL& target_url, const GURL& target_url,
const std::string& partition_id, const std::string& partition_id,

View file

@ -27,29 +27,28 @@ void DevToolsNetworkController::SetNetworkState(
std::unique_ptr<DevToolsNetworkConditions> conditions) { std::unique_ptr<DevToolsNetworkConditions> conditions) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
DevToolsNetworkInterceptor* interceptor = interceptors_.get(client_id); auto it = interceptors_.find(client_id);
if (!interceptor) { if (it == interceptors_.end()) {
if (!conditions) if (!conditions)
return; return;
std::unique_ptr<DevToolsNetworkInterceptor> new_interceptor( std::unique_ptr<DevToolsNetworkInterceptor> new_interceptor(
new DevToolsNetworkInterceptor); new DevToolsNetworkInterceptor);
new_interceptor->UpdateConditions(std::move(conditions)); new_interceptor->UpdateConditions(std::move(conditions));
interceptors_.set(client_id, std::move(new_interceptor)); interceptors_[client_id] = std::move(new_interceptor);
} else { } else {
if (!conditions) { if (!conditions) {
std::unique_ptr<DevToolsNetworkConditions> online_conditions( std::unique_ptr<DevToolsNetworkConditions> online_conditions(
new DevToolsNetworkConditions(false)); new DevToolsNetworkConditions(false));
interceptor->UpdateConditions(std::move(online_conditions)); it->second->UpdateConditions(std::move(online_conditions));
interceptors_.erase(client_id); interceptors_.erase(client_id);
} else { } else {
interceptor->UpdateConditions(std::move(conditions)); it->second->UpdateConditions(std::move(conditions));
} }
} }
bool has_offline_interceptors = false; bool has_offline_interceptors = false;
auto it = interceptors_.begin(); for (const auto& interceptor : interceptors_) {
for (; it != interceptors_.end(); ++it) { if (interceptor.second->IsOffline()) {
if (it->second->IsOffline()) {
has_offline_interceptors = true; has_offline_interceptors = true;
break; break;
} }
@ -70,11 +69,11 @@ DevToolsNetworkController::GetInterceptor(const std::string& client_id) {
if (interceptors_.empty() || client_id.empty()) if (interceptors_.empty() || client_id.empty())
return nullptr; return nullptr;
DevToolsNetworkInterceptor* interceptor = interceptors_.get(client_id); auto it = interceptors_.find(client_id);
if (!interceptor) if (it == interceptors_.end())
return nullptr; return nullptr;
return interceptor; return it->second.get();
} }
} // namespace brightray } // namespace brightray

View file

@ -5,8 +5,12 @@
#ifndef BROWSER_DEVTOOLS_NETWORK_CONTROLLER_H_ #ifndef BROWSER_DEVTOOLS_NETWORK_CONTROLLER_H_
#define BROWSER_DEVTOOLS_NETWORK_CONTROLLER_H_ #define BROWSER_DEVTOOLS_NETWORK_CONTROLLER_H_
#include "base/containers/scoped_ptr_hash_map.h" #include <unordered_map>
#include <memory>
#include <string>
#include "base/macros.h" #include "base/macros.h"
#include "base/threading/thread_checker.h"
namespace brightray { namespace brightray {
@ -21,11 +25,12 @@ class DevToolsNetworkController {
void SetNetworkState(const std::string& client_id, void SetNetworkState(const std::string& client_id,
std::unique_ptr<DevToolsNetworkConditions> conditions); std::unique_ptr<DevToolsNetworkConditions> conditions);
DevToolsNetworkInterceptor* GetInterceptor(const std::string& client_id); DevToolsNetworkInterceptor* GetInterceptor(const std::string& client_id);
private: private:
using InterceptorMap = using InterceptorMap =
base::ScopedPtrHashMap<std::string, std::unordered_map<std::string,
std::unique_ptr<DevToolsNetworkInterceptor>>; std::unique_ptr<DevToolsNetworkInterceptor>>;
std::unique_ptr<DevToolsNetworkInterceptor> appcache_interceptor_; std::unique_ptr<DevToolsNetworkInterceptor> appcache_interceptor_;

View file

@ -134,10 +134,6 @@ bool NetworkDelegate::OnCanEnablePrivacyMode(
return false; return false;
} }
bool NetworkDelegate::OnAreStrictSecureCookiesEnabled() const {
return true;
}
bool NetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { bool NetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const {
return true; return true;
} }

View file

@ -63,7 +63,6 @@ class NetworkDelegate : public net::NetworkDelegate {
bool OnCanEnablePrivacyMode( bool OnCanEnablePrivacyMode(
const GURL& url, const GURL& url,
const GURL& first_party_for_cookies) const override; const GURL& first_party_for_cookies) const override;
bool OnAreStrictSecureCookiesEnabled() const override;
bool OnAreExperimentalCookieFeaturesEnabled() const override; bool OnAreExperimentalCookieFeaturesEnabled() const override;
bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
const net::URLRequest& request, const net::URLRequest& request,

View file

@ -70,12 +70,6 @@ blink::mojom::PermissionStatus PermissionManager::GetPermissionStatus(
return blink::mojom::PermissionStatus::GRANTED; return blink::mojom::PermissionStatus::GRANTED;
} }
void PermissionManager::RegisterPermissionUsage(
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
}
int PermissionManager::SubscribePermissionStatusChange( int PermissionManager::SubscribePermissionStatusChange(
content::PermissionType permission, content::PermissionType permission,
const GURL& requesting_origin, const GURL& requesting_origin,

View file

@ -40,9 +40,6 @@ class PermissionManager : public content::PermissionManager {
content::PermissionType permission, content::PermissionType permission,
const GURL& requesting_origin, const GURL& requesting_origin,
const GURL& embedding_origin) override; const GURL& embedding_origin) override;
void RegisterPermissionUsage(content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
int SubscribePermissionStatusChange( int SubscribePermissionStatusChange(
content::PermissionType permission, content::PermissionType permission,
const GURL& requesting_origin, const GURL& requesting_origin,

View file

@ -100,7 +100,7 @@ void PlatformNotificationService::ClosePersistentNotification(
const std::string& notification_id) { const std::string& notification_id) {
} }
bool PlatformNotificationService::GetDisplayedPersistentNotifications( bool PlatformNotificationService::GetDisplayedNotifications(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
std::set<std::string>* displayed_notifications) { std::set<std::string>* displayed_notifications) {
return false; return false;

View file

@ -45,7 +45,7 @@ class PlatformNotificationService
const content::NotificationResources& notification_resources) override; const content::NotificationResources& notification_resources) override;
void ClosePersistentNotification(content::BrowserContext* browser_context, void ClosePersistentNotification(content::BrowserContext* browser_context,
const std::string& notification_id) override; const std::string& notification_id) override;
bool GetDisplayedPersistentNotifications( bool GetDisplayedNotifications(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
std::set<std::string>* displayed_notifications) override; std::set<std::string>* displayed_notifications) override;

View file

@ -24,20 +24,16 @@ bool SpecialStoragePolicy::IsStorageDurable(const GURL& origin) {
return true; return true;
} }
bool SpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) { bool SpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) {
return false; return false;
} }
bool SpecialStoragePolicy::CanQueryDiskSize(const GURL& origin) { bool SpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
return true; return false;
} }
bool SpecialStoragePolicy::HasSessionOnlyOrigins() { bool SpecialStoragePolicy::HasSessionOnlyOrigins() {
return false; return false;
} }
bool SpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) {
return false;
}
} // namespace brightray } // namespace brightray

View file

@ -17,9 +17,8 @@ class SpecialStoragePolicy : public storage::SpecialStoragePolicy {
bool IsStorageProtected(const GURL& origin) override; bool IsStorageProtected(const GURL& origin) override;
bool IsStorageUnlimited(const GURL& origin) override; bool IsStorageUnlimited(const GURL& origin) override;
bool IsStorageDurable(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; bool HasIsolatedStorage(const GURL& origin) override;
bool IsStorageSessionOnly(const GURL& origin) override;
bool HasSessionOnlyOrigins() override; bool HasSessionOnlyOrigins() override;
protected: protected:

View file

@ -195,9 +195,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
std::unique_ptr<net::CookieStore> cookie_store = std::unique_ptr<net::CookieStore> cookie_store =
content::CreateCookieStore(cookie_config); content::CreateCookieStore(cookie_config);
storage_->set_cookie_store(std::move(cookie_store)); storage_->set_cookie_store(std::move(cookie_store));
storage_->set_channel_id_service(base::WrapUnique( storage_->set_channel_id_service(base::MakeUnique<net::ChannelIDService>(
new net::ChannelIDService(new net::DefaultChannelIDStore(nullptr), new net::DefaultChannelIDStore(nullptr)));
base::WorkerPool::GetTaskRunner(true))));
std::string accept_lang = l10n_util::GetApplicationLocale(""); std::string accept_lang = l10n_util::GetApplicationLocale("");
storage_->set_http_user_agent_settings(base::WrapUnique( storage_->set_http_user_agent_settings(base::WrapUnique(
@ -354,9 +353,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
it != protocol_interceptors_.rend(); it != protocol_interceptors_.rend();
++it) { ++it) {
top_job_factory.reset(new net::URLRequestInterceptingJobFactory( top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
std::move(top_job_factory), base::WrapUnique(*it))); std::move(top_job_factory), std::move(*it)));
} }
protocol_interceptors_.weak_clear(); protocol_interceptors_.clear();
storage_->set_job_factory(std::move(top_job_factory)); storage_->set_job_factory(std::move(top_job_factory));
} }

@ -1 +1 @@
Subproject commit 44448acf6a21024b9adb7140ffef6402a509f8bf Subproject commit 3ca4584486acbfb4b344c7ce956fdcd40a4ed63e