Merge pull request #200 from atom/chrome49

Upgrade to Chrome 49
This commit is contained in:
Cheng Zhao 2016-03-11 10:37:12 +09:00
commit 909c66fa9f
35 changed files with 211 additions and 129 deletions

View file

@ -55,15 +55,15 @@
['OS=="linux"', {
'link_settings': {
'ldflags': [
'<!@(pkg-config --libs-only-L --libs-only-other <(linux_system_libraries))',
'<!@(<(pkg-config) --libs-only-L --libs-only-other <(linux_system_libraries))',
],
'libraries': [
'-lpthread',
'<!@(pkg-config --libs-only-l <(linux_system_libraries))',
'<!@(<(pkg-config) --libs-only-l <(linux_system_libraries))',
],
},
'cflags': [
'<!@(pkg-config --cflags <(linux_system_libraries))',
'<!@(<(pkg-config) --cflags <(linux_system_libraries))',
# Needed by using libgtk2ui:
'-Wno-deprecated-register',
'-Wno-sentinel',
@ -73,7 +73,7 @@
],
'direct_dependent_settings': {
'cflags': [
'<!@(pkg-config --cflags <(linux_system_libraries))',
'<!@(<(pkg-config) --cflags <(linux_system_libraries))',
'-Wno-deprecated-register',
'-Wno-sentinel',
],
@ -117,9 +117,6 @@
}],
['target_arch=="arm"', {
'link_settings': {
'libraries': [
'<(libchromiumcontent_dir)/libyuv_neon.a',
],
'libraries!': [
'<(libchromiumcontent_dir)/libdesktop_capture_differ_sse2.a',
],
@ -201,6 +198,7 @@
'libraries': [
'<(libchromiumcontent_dir)/base_static.lib',
'<(libchromiumcontent_dir)/sandbox.lib',
'<(libchromiumcontent_dir)/sandbox_helper_win.lib',
'<(libchromiumcontent_dir)/devtools_discovery.lib',
'<(libchromiumcontent_dir)/devtools_http_handler.lib',
'<(libchromiumcontent_dir)/http_server.lib',

View file

@ -4,6 +4,7 @@
],
'variables': {
'libchromiumcontent_component%': 1,
'pkg-config%': 'pkg-config',
'conditions': [
# The "libchromiumcontent_component" is defined when calling "gyp".
['libchromiumcontent_component', {

View file

@ -75,7 +75,7 @@ net::URLRequestContextGetter* BrowserClient::CreateRequestContext(
auto context = static_cast<BrowserContext*>(browser_context);
return context->CreateRequestContext(static_cast<NetLog*>(GetNetLog()),
protocol_handlers,
protocol_interceptors.Pass());
std::move(protocol_interceptors));
}
content::MediaObserver* BrowserClient::GetMediaObserver() {

View file

@ -148,7 +148,7 @@ net::URLRequestContextGetter* BrowserContext::CreateRequestContext(
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),
protocol_handlers,
protocol_interceptors.Pass());
std::move(protocol_interceptors));
resource_context_->set_url_request_context_getter(url_request_getter_.get());
return url_request_getter_.get();
}
@ -232,4 +232,8 @@ content::PermissionManager* BrowserContext::GetPermissionManager() {
return permission_manager_.get();
}
content::BackgroundSyncController* BrowserContext::GetBackgroundSyncController() {
return nullptr;
}
} // namespace brightray

View file

@ -57,6 +57,7 @@ class BrowserContext : public base::RefCounted<BrowserContext>,
content::PushMessagingService* GetPushMessagingService() override;
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionManager* GetPermissionManager() override;
content::BackgroundSyncController* GetBackgroundSyncController() override;
net::URLRequestContextGetter* CreateRequestContext(
NetLog* net_log,

View file

@ -5,7 +5,7 @@
#ifndef BRIGHTRAY_BROWSER_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_
#define BRIGHTRAY_BROWSER_DEVTOOLS_CONTENTS_RESIZING_STRATEGY_H_
#include "base/basictypes.h"
#include "base/macros.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"

View file

@ -190,8 +190,9 @@ DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(
d->RegisterHandler("resetZoom", &Delegate::ResetZoom, delegate);
d->RegisterHandler("setDevicesUpdatesEnabled",
&Delegate::SetDevicesUpdatesEnabled, delegate);
d->RegisterHandler("sendMessageToBrowser",
&Delegate::SendMessageToBrowser, delegate);
d->RegisterHandler("dispatchProtocolMessage",
&Delegate::DispatchProtocolMessageFromDevToolsFrontend,
delegate);
d->RegisterHandler("recordActionUMA", &Delegate::RecordActionUMA, delegate);
d->RegisterHandlerWithCallback("sendJsonRequest",
&Delegate::SendJsonRequest, delegate);

View file

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

View file

@ -55,7 +55,7 @@ class TCPServerSocketFactory
}
std::string address_;
uint16 port_;
uint16_t port_;
DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory);
};
@ -109,7 +109,6 @@ DevToolsDelegate::~DevToolsDelegate() {
}
std::string DevToolsDelegate::GetDiscoveryPageHTML() {
LOG(WARNING) << IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE;
return ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string();
}

View file

@ -5,7 +5,7 @@
#ifndef BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_
#define BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_
#include "base/basictypes.h"
#include "base/macros.h"
#include "base/compiler_specific.h"
#include "components/devtools_http_handler/devtools_http_handler_delegate.h"
#include "content/public/browser/devtools_manager_delegate.h"

View file

@ -26,6 +26,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/common/user_agent.h"
#include "ipc/ipc_channel.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_fetcher_response_writer.h"
@ -250,8 +251,6 @@ void InspectableWebContentsImpl::ShowDevTools() {
devtools_web_contents_->SetDelegate(this);
agent_host_ = content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get());
frontend_host_.reset(content::DevToolsFrontendHost::Create(
web_contents_->GetMainFrame(), this));
agent_host_->AttachClient(this);
GURL devtools_url(base::StringPrintf(kChromeUIDevToolsURL,
@ -477,7 +476,8 @@ void InspectableWebContentsImpl::ResetZoom() {
void InspectableWebContentsImpl::SetDevicesUpdatesEnabled(bool enabled) {
}
void InspectableWebContentsImpl::SendMessageToBrowser(const std::string& message) {
void InspectableWebContentsImpl::DispatchProtocolMessageFromDevToolsFrontend(
const std::string& message) {
if (agent_host_.get())
agent_host_->DispatchProtocolMessage(message);
}
@ -543,12 +543,6 @@ void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend(const std::st
params);
}
void InspectableWebContentsImpl::HandleMessageFromDevToolsFrontendToBackend(
const std::string& message) {
if (agent_host_.get())
agent_host_->DispatchProtocolMessage(message);
}
void InspectableWebContentsImpl::DispatchProtocolMessage(
content::DevToolsAgentHost* agent_host, const std::string& message) {
if (!frontend_loaded_)
@ -573,12 +567,15 @@ void InspectableWebContentsImpl::AgentHostClosed(
content::DevToolsAgentHost* agent_host, bool replaced) {
}
void InspectableWebContentsImpl::AboutToNavigateRenderFrame(
void InspectableWebContentsImpl::RenderFrameHostChanged(
content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) {
if (new_host->GetParent())
return;
frontend_host_.reset(content::DevToolsFrontendHost::Create(new_host, this));
frontend_host_.reset(content::DevToolsFrontendHost::Create(
new_host,
base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend,
base::Unretained(this))));
}
void InspectableWebContentsImpl::WebContentsDestroyed() {
@ -592,9 +589,9 @@ void InspectableWebContentsImpl::WebContentsDestroyed() {
bool InspectableWebContentsImpl::AddMessageToConsole(
content::WebContents* source,
int32 level,
int32_t level,
const base::string16& message,
int32 line_no,
int32_t line_no,
const base::string16& source_id) {
logging::LogMessage("CONSOLE", line_no, level).stream() << "\"" <<
message << "\", source: " << source_id << " (" << line_no << ")";
@ -603,8 +600,9 @@ bool InspectableWebContentsImpl::AddMessageToConsole(
bool InspectableWebContentsImpl::ShouldCreateWebContents(
content::WebContents* web_contents,
int route_id,
int main_frame_route_id,
int32_t route_id,
int32_t main_frame_route_id,
int32_t main_frame_widget_route_id,
WindowContainerType window_container_type,
const std::string& frame_name,
const GURL& target_url,
@ -632,6 +630,16 @@ void InspectableWebContentsImpl::OnWebContentsFocused() {
#endif
}
void InspectableWebContentsImpl::DidStartNavigationToPendingEntry(
const GURL& url,
content::NavigationController::ReloadType reload_type) {
frontend_host_.reset(
content::DevToolsFrontendHost::Create(
web_contents()->GetMainFrame(),
base::Bind(&InspectableWebContentsImpl::HandleMessageFromDevToolsFrontend,
base::Unretained(this))));
}
void InspectableWebContentsImpl::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK(source);
PendingRequestsMap::iterator it = pending_requests_.find(source);

View file

@ -33,7 +33,6 @@ class InspectableWebContentsView;
class InspectableWebContentsImpl :
public InspectableWebContents,
public content::DevToolsFrontendHost::Delegate,
public content::DevToolsAgentHostClient,
public content::WebContentsObserver,
public content::WebContentsDelegate,
@ -105,7 +104,8 @@ class InspectableWebContentsImpl :
void ZoomOut() override;
void ResetZoom() override;
void SetDevicesUpdatesEnabled(bool enabled) override;
void SendMessageToBrowser(const std::string& message) override;
void DispatchProtocolMessageFromDevToolsFrontend(
const std::string& message) override;
void RecordActionUMA(const std::string& name, int action) override;
void SendJsonRequest(const DispatchCallback& callback,
const std::string& browser_id,
@ -117,8 +117,7 @@ class InspectableWebContentsImpl :
void ClearPreferences() override;
// content::DevToolsFrontendHostDelegate:
void HandleMessageFromDevToolsFrontend(const std::string& message) override;
void HandleMessageFromDevToolsFrontendToBackend(const std::string& message) override;
void HandleMessageFromDevToolsFrontend(const std::string& message);
// content::DevToolsAgentHostClient:
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
@ -127,21 +126,25 @@ class InspectableWebContentsImpl :
bool replaced) override;
// content::WebContentsObserver:
void AboutToNavigateRenderFrame(content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) override;
void RenderFrameHostChanged(content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) override;
void WebContentsDestroyed() override;
void OnWebContentsFocused() override;
void DidStartNavigationToPendingEntry(
const GURL& url,
content::NavigationController::ReloadType reload_type) override;
// content::WebContentsDelegate:
bool AddMessageToConsole(content::WebContents* source,
int32 level,
int32_t level,
const base::string16& message,
int32 line_no,
int32_t line_no,
const base::string16& source_id) override;
bool ShouldCreateWebContents(
content::WebContents* web_contents,
int route_id,
int main_frame_route_id,
int32_t route_id,
int32_t main_frame_route_id,
int32_t main_frame_widget_route_id,
WindowContainerType window_container_type,
const std::string& frame_name,
const GURL& target_url,

View file

@ -39,11 +39,11 @@ void CocoaNotification::Show(const base::string16& title,
if ([notification_ respondsToSelector:@selector(setContentImage:)] &&
!icon.drawsNothing()) {
NSImage* image = gfx::SkBitmapToNSImageWithColorSpace(
NSImage* image = skia::SkBitmapToNSImageWithColorSpace(
icon, base::mac::GetGenericRGBColorSpace());
[notification_ setContentImage:image];
}
if (silent) {
[notification_ setSoundName:nil];
} else {

View file

@ -33,10 +33,10 @@ MediaStreamDevicesController::MediaStreamDevicesController(
// and microphone to avoid popping two infobars.
microphone_requested_(
request.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE ||
request.request_type == content::MEDIA_OPEN_DEVICE),
request.request_type == content::MEDIA_OPEN_DEVICE_PEPPER_ONLY),
webcam_requested_(
request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE ||
request.request_type == content::MEDIA_OPEN_DEVICE) {
request.request_type == content::MEDIA_OPEN_DEVICE_PEPPER_ONLY) {
}
MediaStreamDevicesController::~MediaStreamDevicesController() {
@ -72,7 +72,7 @@ void MediaStreamDevicesController::Accept() {
content::MediaStreamDevices devices;
if (microphone_requested_ || webcam_requested_) {
switch (request_.request_type) {
case content::MEDIA_OPEN_DEVICE: {
case content::MEDIA_OPEN_DEVICE_PEPPER_ONLY: {
const content::MediaStreamDevice* device = NULL;
// For open device request pick the desired device or fall back to the
// first available of the given type.

View file

@ -30,7 +30,7 @@ void DevToolsNetworkController::SetNetworkState(
if (client_id.empty()) {
if (!conditions)
return;
default_interceptor_->UpdateConditions(conditions.Pass());
default_interceptor_->UpdateConditions(std::move(conditions));
return;
}
@ -40,16 +40,16 @@ void DevToolsNetworkController::SetNetworkState(
return;
scoped_ptr<DevToolsNetworkInterceptor> new_interceptor(
new DevToolsNetworkInterceptor);
new_interceptor->UpdateConditions(conditions.Pass());
interceptors_.set(client_id, new_interceptor.Pass());
new_interceptor->UpdateConditions(std::move(conditions));
interceptors_.set(client_id, std::move(new_interceptor));
} else {
if (!conditions) {
scoped_ptr<DevToolsNetworkConditions> online_conditions(
new DevToolsNetworkConditions(false));
interceptor->UpdateConditions(online_conditions.Pass());
interceptor->UpdateConditions(std::move(online_conditions));
interceptors_.erase(client_id);
} else {
interceptor->UpdateConditions(conditions.Pass());
interceptor->UpdateConditions(std::move(conditions));
}
}
}

View file

@ -40,7 +40,7 @@ void DevToolsNetworkInterceptor::UpdateConditions(
if (conditions_->IsThrottling())
UpdateThrottledTransactions(now);
conditions_ = conditions.Pass();
conditions_ = std::move(conditions);
if (conditions_->offline()) {
timer_.Stop();
@ -207,7 +207,7 @@ void DevToolsNetworkInterceptor::ArmTimer(base::TimeTicks now) {
base::TimeTicks desired_time =
offset_ + tick_length_ * (last_tick_ + min_ticks_left);
int64_t min_baseline = std::numeric_limits<int64>::max();
int64_t min_baseline = std::numeric_limits<int64_t>::max();
for (size_t i = 0; i < suspend_count; ++i) {
if (suspended_transactions_[i].second < min_baseline)
min_baseline = suspended_transactions_[i].second;

View file

@ -64,7 +64,7 @@ CreateSuccessResponse(int id, scoped_ptr<base::DictionaryValue> result) {
scoped_ptr<base::DictionaryValue> response(new base::DictionaryValue);
response->SetInteger(kId, id);
response->Set(params::kResult, result.release());
return response.Pass();
return response;
}
scoped_ptr<base::DictionaryValue>
@ -75,14 +75,14 @@ CreateFailureResponse(int id, const std::string& param) {
error_object->SetInteger(params::kErrorCode, kErrorInvalidParams);
error_object->SetString(params::kErrorMessage,
base::StringPrintf("Missing or Invalid '%s' parameter", param.c_str()));
return response.Pass();
return response;
}
void UpdateNetworkStateInIO(brightray::DevToolsNetworkController* controller,
const std::string& client_id,
scoped_ptr<brightray::DevToolsNetworkConditions> conditions) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
controller->SetNetworkState(client_id, conditions.Pass());
controller->SetNetworkState(client_id, std::move(conditions));
}
} // namespace
@ -119,7 +119,7 @@ DevToolsNetworkProtocolHandler::CanEmulateNetworkConditions(
const base::DictionaryValue* params) {
scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
result->SetBoolean(params::kResult, true);
return CreateSuccessResponse(id, result.Pass());
return CreateSuccessResponse(id, std::move(result));
}
scoped_ptr<base::DictionaryValue>
@ -154,7 +154,7 @@ DevToolsNetworkProtocolHandler::EmulateNetworkConditions(
latency,
download_throughput,
upload_throughput));
UpdateNetworkState(agent_host, conditions.Pass());
UpdateNetworkState(agent_host, std::move(conditions));
return scoped_ptr<base::DictionaryValue>();
}

View file

@ -24,7 +24,7 @@ DevToolsNetworkTransaction::DevToolsNetworkTransaction(
DevToolsNetworkController* controller,
scoped_ptr<net::HttpTransaction> transaction)
: controller_(controller),
transaction_(transaction.Pass()),
transaction_(std::move(transaction)),
request_(nullptr),
failed_(false),
throttled_byte_count_(0),
@ -106,10 +106,11 @@ int DevToolsNetworkTransaction::RestartIgnoringLastError(
int DevToolsNetworkTransaction::RestartWithCertificate(
net::X509Certificate* client_certificate,
net::SSLPrivateKey* client_private_key,
const net::CompletionCallback& callback) {
if (failed_)
return net::ERR_INTERNET_DISCONNECTED;
int rv = transaction_->RestartWithCertificate(client_certificate, proxy_callback_);
int rv = transaction_->RestartWithCertificate(client_certificate, client_private_key, proxy_callback_);
return SetupCallback(callback, rv, RESTART_WITH_CERTIFICATE);
}
@ -185,6 +186,11 @@ bool DevToolsNetworkTransaction::GetRemoteEndpoint(
return transaction_->GetRemoteEndpoint(endpoint);
}
void DevToolsNetworkTransaction::PopulateNetErrorDetails(
net::NetErrorDetails* details) const {
return transaction_->PopulateNetErrorDetails(details);
}
void DevToolsNetworkTransaction::SetPriority(net::RequestPriority priority) {
transaction_->SetPriority(priority);
}

View file

@ -46,6 +46,7 @@ class DevToolsNetworkTransaction : public net::HttpTransaction {
int RestartIgnoringLastError(
const net::CompletionCallback& callback) override;
int RestartWithCertificate(net::X509Certificate* client_cert,
net::SSLPrivateKey* client_private_key,
const net::CompletionCallback& callback) override;
int RestartWithAuth(const net::AuthCredentials& credentials,
const net::CompletionCallback& callback) override;
@ -65,6 +66,7 @@ class DevToolsNetworkTransaction : public net::HttpTransaction {
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 PopulateNetErrorDetails(net::NetErrorDetails* details) const override;
void SetPriority(net::RequestPriority priority) override;
void SetWebSocketHandshakeStreamCreateHelper(
net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) override;

View file

@ -35,7 +35,8 @@ int DevToolsNetworkTransactionFactory::CreateTransaction(
int rv = network_layer_->CreateTransaction(priority, &new_transaction);
if (rv != net::OK)
return rv;
transaction->reset(new DevToolsNetworkTransaction(controller_, new_transaction.Pass()));
transaction->reset(
new DevToolsNetworkTransaction(controller_, std::move(new_transaction)));
return net::OK;
}

View file

@ -55,7 +55,7 @@ void NetLog::StartLogging(net::URLRequestContext* url_request_context) {
scoped_ptr<base::Value> constants(GetConstants());
write_to_file_observer_.StartObserving(this,
log_file_.Pass(),
std::move(log_file_),
constants.get(),
url_request_context);
}

View file

@ -92,14 +92,11 @@ void NetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
void NetworkDelegate::OnResponseStarted(net::URLRequest* request) {
}
void NetworkDelegate::OnURLRequestJobOrphaned(net::URLRequest* request) {
}
void NetworkDelegate::OnNetworkBytesReceived(const net::URLRequest& request,
void NetworkDelegate::OnNetworkBytesReceived(net::URLRequest* request,
int64_t bytes_read) {
}
void NetworkDelegate::OnNetworkBytesSent(const net::URLRequest& request,
void NetworkDelegate::OnNetworkBytesSent(net::URLRequest* request,
int64_t bytes_sent) {
}
@ -143,7 +140,11 @@ bool NetworkDelegate::OnCanEnablePrivacyMode(
return false;
}
bool NetworkDelegate::OnFirstPartyOnlyCookieExperimentEnabled() const {
bool NetworkDelegate::OnAreStrictSecureCookiesEnabled() const {
return true;
}
bool NetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const {
return true;
}

View file

@ -43,10 +43,9 @@ class NetworkDelegate : public net::NetworkDelegate {
void OnBeforeRedirect(net::URLRequest* request,
const GURL& new_location) override;
void OnResponseStarted(net::URLRequest* request) override;
void OnURLRequestJobOrphaned(net::URLRequest* request) override;
void OnNetworkBytesReceived(const net::URLRequest& request,
void OnNetworkBytesReceived(net::URLRequest* request,
int64_t bytes_read) override;
void OnNetworkBytesSent(const net::URLRequest& request,
void OnNetworkBytesSent(net::URLRequest* request,
int64_t bytes_sent) override;
void OnCompleted(net::URLRequest* request, bool started) override;
void OnURLRequestDestroyed(net::URLRequest* request) override;
@ -67,7 +66,8 @@ class NetworkDelegate : public net::NetworkDelegate {
bool OnCanEnablePrivacyMode(
const GURL& url,
const GURL& first_party_for_cookies) const override;
bool OnFirstPartyOnlyCookieExperimentEnabled() const override;
bool OnAreStrictSecureCookiesEnabled() const override;
bool OnAreExperimentalCookieFeaturesEnabled() const override;
bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
const net::URLRequest& request,
const GURL& target_url,

View file

@ -8,7 +8,7 @@ namespace brightray {
NotificationDelegateAdapter::NotificationDelegateAdapter(
scoped_ptr<content::DesktopNotificationDelegate> delegate)
: delegate_(delegate.Pass()) {
: delegate_(std::move(delegate)) {
}
NotificationDelegateAdapter::~NotificationDelegateAdapter() {

View file

@ -32,6 +32,28 @@ int PermissionManager::RequestPermission(
return kNoPendingOperation;
}
int PermissionManager::RequestPermissions(
const std::vector<content::PermissionType>& permissions,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(
const std::vector<content::PermissionStatus>&)>& callback) {
std::vector<content::PermissionStatus> permissionStatuses;
for (auto permission : permissions) {
if (permission == content::PermissionType::MIDI_SYSEX) {
content::ChildProcessSecurityPolicy::GetInstance()->
GrantSendMidiSysExMessage(render_frame_host->GetProcess()->GetID());
}
permissionStatuses.push_back(content::PERMISSION_STATUS_GRANTED);
}
callback.Run(permissionStatuses);
return kNoPendingOperation;
}
void PermissionManager::CancelPermissionRequest(int request_id) {
}

View file

@ -23,6 +23,13 @@ class PermissionManager : public content::PermissionManager {
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(content::PermissionStatus)>& callback) override;
int RequestPermissions(
const std::vector<content::PermissionType>& permissions,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(
const std::vector<content::PermissionStatus>&)>& callback) override;
void CancelPermissionRequest(int request_id) override;
void ResetPermission(content::PermissionType permission,
const GURL& requesting_origin,

View file

@ -33,7 +33,7 @@ void OnWebNotificationAllowed(
if (!presenter)
return;
scoped_ptr<NotificationDelegateAdapter> adapter(
new NotificationDelegateAdapter(delegate.Pass()));
new NotificationDelegateAdapter(std::move(delegate)));
auto notification = presenter->CreateNotification(adapter.get());
if (notification) {
ignore_result(adapter.release()); // it will release itself automatically.

View file

@ -22,7 +22,9 @@
#include "net/cert/cert_verifier.h"
#include "net/cookies/cookie_monster.h"
#include "net/dns/mapped_host_resolver.h"
#include "net/http/http_auth_filter.h"
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_auth_preferences.h"
#include "net/http/http_server_properties_impl.h"
#include "net/log/net_log.h"
#include "net/proxy/dhcp_proxy_script_fetcher_factory.h"
@ -104,8 +106,16 @@ bool URLRequestContextGetter::DelegateURLSecurityManager::CanDelegate
return delegate_->CanDelegateURLSecurity(auth_origin);
}
void URLRequestContextGetter::DelegateURLSecurityManager::SetDefaultWhitelist(
scoped_ptr<net::HttpAuthFilter> whitelist_default) {
}
void URLRequestContextGetter::DelegateURLSecurityManager::SetDelegateWhitelist(
scoped_ptr<net::HttpAuthFilter> whitelist_delegate) {
}
URLRequestContextGetter::Delegate::Delegate() :
orig_url_sec_mgr_(net::URLSecurityManager::Create(NULL, NULL)) {}
orig_url_sec_mgr_(net::URLSecurityManager::Create()) {}
std::string URLRequestContextGetter::Delegate::GetUserAgent() {
return base::EmptyString();
@ -131,14 +141,14 @@ URLRequestContextGetter::Delegate::CreateURLRequestJobFactory(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))));
// Set up interceptors in the reverse order.
scoped_ptr<net::URLRequestJobFactory> top_job_factory = job_factory.Pass();
scoped_ptr<net::URLRequestJobFactory> top_job_factory = std::move(job_factory);
content::URLRequestInterceptorScopedVector::reverse_iterator i;
for (i = protocol_interceptors->rbegin(); i != protocol_interceptors->rend(); ++i)
top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
top_job_factory.Pass(), make_scoped_ptr(*i)));
std::move(top_job_factory), make_scoped_ptr(*i)));
protocol_interceptors->weak_clear();
return top_job_factory.Pass();
return top_job_factory;
}
net::HttpCache::BackendFactory*
@ -187,12 +197,12 @@ URLRequestContextGetter::URLRequestContextGetter(
in_memory_(in_memory),
io_loop_(io_loop),
file_loop_(file_loop),
url_sec_mgr_(new URLRequestContextGetter::DelegateURLSecurityManager(delegate)),
protocol_interceptors_(protocol_interceptors.Pass()) {
protocol_interceptors_(std::move(protocol_interceptors)) {
// Must first be created on the UI thread.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
std::swap(protocol_handlers_, *protocol_handlers);
if (protocol_handlers)
std::swap(protocol_handlers_, *protocol_handlers);
// 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
@ -223,8 +233,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
#endif
// --log-net-log
net_log_->StartLogging(url_request_context_.get());
url_request_context_->set_net_log(net_log_);
if (net_log_) {
net_log_->StartLogging(url_request_context_.get());
url_request_context_->set_net_log(net_log_);
}
network_delegate_.reset(delegate_->CreateNetworkDelegate());
url_request_context_->set_network_delegate(network_delegate_.get());
@ -257,10 +269,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
// --host-resolver-rules
if (command_line.HasSwitch(switches::kHostResolverRules)) {
scoped_ptr<net::MappedHostResolver> remapped_resolver(
new net::MappedHostResolver(host_resolver.Pass()));
new net::MappedHostResolver(std::move(host_resolver)));
remapped_resolver->SetRulesFromString(
command_line.GetSwitchValueASCII(switches::kHostResolverRules));
host_resolver = remapped_resolver.Pass();
host_resolver = std::move(remapped_resolver);
}
// --proxy-server
@ -283,7 +295,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
} else {
storage_->set_proxy_service(
net::CreateProxyServiceUsingV8ProxyResolver(
proxy_config_service_.Pass(),
std::move(proxy_config_service_),
new net::ProxyScriptFetcherImpl(url_request_context_.get()),
dhcp_factory.Create(url_request_context_.get()),
host_resolver.get(),
@ -296,25 +308,24 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
schemes.push_back(std::string("digest"));
schemes.push_back(std::string("ntlm"));
schemes.push_back(std::string("negotiate"));
auto auth_handler_factory = make_scoped_ptr(
#if defined(OS_POSIX)
http_auth_preferences_.reset(new net::HttpAuthPreferences(schemes,
std::string()));
#else
http_auth_preferences_.reset(new net::HttpAuthPreferences(schemes));
#endif
auto auth_handler_factory =
net::HttpAuthHandlerRegistryFactory::Create(
schemes,
url_sec_mgr_.get(),
host_resolver.get(),
std::string(), // gssapi_library_name
std::string(), // gssapi_library_nam
false, // auth_android_negotiate_account_type
true)); // negotiate_enable_port
http_auth_preferences_.get(), host_resolver.get());
storage_->set_cert_verifier(delegate_->CreateCertVerifier());
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.Pass());
storage_->set_http_auth_handler_factory(std::move(auth_handler_factory));
scoped_ptr<net::HttpServerProperties> server_properties(
new net::HttpServerPropertiesImpl);
storage_->set_http_server_properties(server_properties.Pass());
storage_->set_http_server_properties(std::move(server_properties));
net::HttpNetworkSession::Params network_session_params;
network_session_params.cert_verifier = url_request_context_->cert_verifier();
@ -347,21 +358,31 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
}
// Give |storage_| ownership at the end in case it's |mapped_host_resolver|.
storage_->set_host_resolver(host_resolver.Pass());
storage_->set_host_resolver(std::move(host_resolver));
network_session_params.host_resolver = url_request_context_->host_resolver();
net::HttpNetworkSession* session = new net::HttpNetworkSession(network_session_params);
net::HttpCache::BackendFactory* backend = nullptr;
http_network_session_.reset(
new net::HttpNetworkSession(network_session_params));
scoped_ptr<net::HttpCache::BackendFactory> backend;
if (in_memory_) {
backend = net::HttpCache::DefaultBackend::InMemory(0);
} else {
backend = delegate_->CreateHttpCacheBackendFactory(base_path_);
backend.reset(delegate_->CreateHttpCacheBackendFactory(base_path_));
}
if (controller_) {
storage_->set_http_transaction_factory(make_scoped_ptr(
new net::HttpCache(
make_scoped_ptr(new DevToolsNetworkTransactionFactory(
controller_, http_network_session_.get())),
std::move(backend),
false)));
} else {
storage_->set_http_transaction_factory(make_scoped_ptr(
new net::HttpCache(http_network_session_.get(),
std::move(backend),
false)));
}
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_));

View file

@ -19,6 +19,7 @@ class MessageLoop;
namespace net {
class HostMappingRules;
class HostResolver;
class HttpAuthPreferences;
class NetworkDelegate;
class ProxyConfigService;
class URLRequestContextStorage;
@ -59,6 +60,10 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
bool CanUseDefaultCredentials(const GURL& auth_origin) const override;
bool CanDelegate(const GURL& auth_origin) const override;
void SetDefaultWhitelist(
scoped_ptr<net::HttpAuthFilter> whitelist_default) override;
void SetDelegateWhitelist(
scoped_ptr<net::HttpAuthFilter> whitelist_delegate) override;
private:
URLRequestContextGetter::Delegate* delegate_;
@ -99,7 +104,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
scoped_ptr<net::URLRequestContextStorage> storage_;
scoped_ptr<net::URLRequestContext> url_request_context_;
scoped_ptr<net::HostMappingRules> host_mapping_rules_;
scoped_ptr<net::URLSecurityManager> url_sec_mgr_;
scoped_ptr<net::HttpAuthPreferences> http_auth_preferences_;
scoped_ptr<net::HttpNetworkSession> http_network_session_;
content::ProtocolHandlerMap protocol_handlers_;
content::URLRequestInterceptorScopedVector protocol_interceptors_;

View file

@ -5,7 +5,7 @@
#ifndef BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_
#define BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_
#include "base/basictypes.h"
#include "base/macros.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller_factory.h"

View file

@ -10,7 +10,7 @@
#include <hstring.h>
#include <windows.h>
#include "base/basictypes.h"
#include "base/macros.h"
class ScopedHString {
public:

View file

@ -173,10 +173,10 @@ bool WindowsToastNotification::GetToastXml(
if (!SetXmlText(*toast_xml, title, msg))
return false;
}
// Configure the toast's notification sound
if (silent) {
if (FAILED(SetXmlAudioSilent(*toast_xml)))
if (FAILED(SetXmlAudioSilent(*toast_xml)))
return false;
}
@ -200,40 +200,40 @@ bool WindowsToastNotification::SetXmlAudioSilent(
ComPtr<IXmlNode> root;
if (FAILED(node_list->Item(0, &root)))
return false;
ComPtr<IXmlElement> audio_element;
ScopedHString audio_str(L"audio");
if (FAILED(doc->CreateElement(audio_str, &audio_element)))
return false;
ComPtr<IXmlNode> audio_node_tmp;
if (FAILED(audio_element.As(&audio_node_tmp)))
return false;
// Append audio node to toast xml
ComPtr<IXmlNode> audio_node;
if (FAILED(root->AppendChild(audio_node_tmp.Get(), &audio_node)))
return false;
// Create silent attribute
ComPtr<IXmlNamedNodeMap> attributes;
if (FAILED(audio_node->get_Attributes(&attributes)))
return false;
ComPtr<IXmlAttribute> silent_attribute;
ScopedHString silent_str(L"silent");
if (FAILED(doc->CreateAttribute(silent_str, &silent_attribute)))
return false;
ComPtr<IXmlNode> silent_attribute_node;
if (FAILED(silent_attribute.As(&silent_attribute_node)))
return false;
// Set silent attribute to true
ScopedHString silent_value(L"true");
if (!silent_value.success())
return false;
ComPtr<IXmlText> silent_text;
if (FAILED(doc->CreateTextNode(silent_value, &silent_text)))
return false;
@ -241,11 +241,11 @@ bool WindowsToastNotification::SetXmlAudioSilent(
ComPtr<IXmlNode> silent_node;
if (FAILED(silent_text.As(&silent_node)))
return false;
ComPtr<IXmlNode> child_node;
if (FAILED(silent_attribute_node->AppendChild(silent_node.Get(), &child_node)))
return false;
ComPtr<IXmlNode> silent_attribute_pnode;
return SUCCEEDED(attributes.Get()->SetNamedItem(silent_attribute_node.Get(), &silent_attribute_pnode));
}
@ -330,7 +330,7 @@ bool WindowsToastNotification::GetTextNodeList(
ScopedHString* tag,
IXmlDocument* doc,
IXmlNodeList** node_list,
UINT32 req_length) {
uint32_t req_length) {
tag->Reset(L"text");
if (!tag->success())
return false;
@ -338,7 +338,7 @@ bool WindowsToastNotification::GetTextNodeList(
if (FAILED(doc->GetElementsByTagName(*tag, node_list)))
return false;
UINT32 node_length;
uint32_t node_length;
if (FAILED((*node_list)->get_Length(&node_length)))
return false;

View file

@ -70,7 +70,7 @@ class WindowsToastNotification : public Notification {
bool GetTextNodeList(ScopedHString* tag,
ABI::Windows::Data::Xml::Dom::IXmlDocument* doc,
ABI::Windows::Data::Xml::Dom::IXmlNodeList** nodeList,
UINT32 reqLength);
uint32_t reqLength);
bool AppendTextToXml(ABI::Windows::Data::Xml::Dom::IXmlDocument* doc,
ABI::Windows::Data::Xml::Dom::IXmlNode* node,
const std::wstring& text);

View file

@ -81,11 +81,11 @@ MainDelegate::~MainDelegate() {
}
scoped_ptr<ContentClient> MainDelegate::CreateContentClient() {
return make_scoped_ptr(new ContentClient).Pass();
return make_scoped_ptr(new ContentClient);
}
bool MainDelegate::BasicStartupComplete(int* exit_code) {
content_client_ = CreateContentClient().Pass();
content_client_ = CreateContentClient();
SetContentClient(content_client_.get());
#if defined(OS_MACOSX)
OverrideChildProcessPath();
@ -108,12 +108,12 @@ void MainDelegate::PreSandboxStartup() {
}
content::ContentBrowserClient* MainDelegate::CreateContentBrowserClient() {
browser_client_ = CreateBrowserClient().Pass();
browser_client_ = CreateBrowserClient();
return browser_client_.get();
}
scoped_ptr<BrowserClient> MainDelegate::CreateBrowserClient() {
return make_scoped_ptr(new BrowserClient).Pass();
return make_scoped_ptr(new BrowserClient);
}
} // namespace brightray

@ -1 +1 @@
Subproject commit ad63d8ba890bcaad2f1b7e6de148b7992f4d3af7
Subproject commit 217af424022afea696510146cd0d3e6bba453771