commit
93d7973590
19 changed files with 54 additions and 73 deletions
|
@ -35,6 +35,7 @@
|
|||
'<(libchromiumcontent_src_dir)/third_party/khronos',
|
||||
'<(libchromiumcontent_src_dir)/third_party/WebKit',
|
||||
'<(libchromiumcontent_dir)/gen',
|
||||
'<(libchromiumcontent_dir)/gen/third_party/WebKit',
|
||||
],
|
||||
},
|
||||
'sources': [ '<@(brightray_sources)' ],
|
||||
|
@ -161,6 +162,8 @@
|
|||
# Required by webrtc:
|
||||
'$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
|
||||
'$(SDKROOT)/System/Library/Frameworks/IOKit.framework',
|
||||
# Required by media:
|
||||
'$(SDKROOT)/System/Library/Frameworks/VideoToolbox.framework',
|
||||
],
|
||||
},
|
||||
'conditions': [
|
||||
|
|
|
@ -92,8 +92,6 @@
|
|||
'Common_Base': {
|
||||
'abstract': 1,
|
||||
'defines': [
|
||||
# Used by content_browser_client.h:
|
||||
'ENABLE_WEBRTC',
|
||||
# We are using Release version libchromiumcontent:
|
||||
'NDEBUG',
|
||||
# Needed by gin:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "content/public/browser/browser_thread.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 "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/material_design/material_design_controller.h"
|
||||
|
@ -163,7 +163,7 @@ void BrowserMainParts::PreEarlyInitialization() {
|
|||
base::FeatureList::SetInstance(std::move(feature_list));
|
||||
|
||||
#if defined(USE_X11)
|
||||
views::LinuxUI::SetInstance(BuildGtk2UI());
|
||||
views::LinuxUI::SetInstance(BuildGtkUi());
|
||||
OverrideLinuxAppDataPath();
|
||||
|
||||
// Installs the X11 error handlers for the browser process used during
|
||||
|
|
|
@ -194,7 +194,6 @@ DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(
|
|||
d->RegisterHandler("dispatchProtocolMessage",
|
||||
&Delegate::DispatchProtocolMessageFromDevToolsFrontend,
|
||||
delegate);
|
||||
d->RegisterHandler("recordActionUMA", &Delegate::RecordActionUMA, delegate);
|
||||
d->RegisterHandlerWithCallback("sendJsonRequest",
|
||||
&Delegate::SendJsonRequest, delegate);
|
||||
d->RegisterHandlerWithCallback("getPreferences",
|
||||
|
|
|
@ -70,7 +70,6 @@ class DevToolsEmbedderMessageDispatcher {
|
|||
virtual void SetDevicesUpdatesEnabled(bool enabled) = 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,
|
||||
const std::string& url) = 0;
|
||||
|
|
|
@ -61,11 +61,6 @@ const char kFrontendHostMethod[] = "method";
|
|||
const char kFrontendHostParams[] = "params";
|
||||
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;
|
||||
|
||||
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 num_bytes,
|
||||
const net::CompletionCallback& callback) {
|
||||
auto* id = new base::FundamentalValue(stream_id_);
|
||||
auto* id = new base::Value(stream_id_);
|
||||
base::StringValue* chunk =
|
||||
new base::StringValue(std::string(buffer->data(), num_bytes));
|
||||
|
||||
|
@ -240,9 +235,14 @@ InspectableWebContentsImpl::InspectableWebContentsImpl(
|
|||
}
|
||||
|
||||
InspectableWebContentsImpl::~InspectableWebContentsImpl() {
|
||||
if (devtools_web_contents_)
|
||||
devtools_web_contents_->Close();
|
||||
Observe(nullptr);
|
||||
// Unsubscribe from devtools and Clean up resources.
|
||||
if (devtools_web_contents_) {
|
||||
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 {
|
||||
|
@ -310,6 +310,7 @@ void InspectableWebContentsImpl::ShowDevTools() {
|
|||
|
||||
void InspectableWebContentsImpl::CloseDevTools() {
|
||||
if (devtools_web_contents_) {
|
||||
frontend_loaded_ = false;
|
||||
view_->CloseDevTools();
|
||||
devtools_web_contents_.reset();
|
||||
web_contents_->Focus();
|
||||
|
@ -563,14 +564,6 @@ void InspectableWebContentsImpl::DispatchProtocolMessageFromDevToolsFrontend(
|
|||
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(
|
||||
const DispatchCallback& callback,
|
||||
const std::string& browser_id,
|
||||
|
@ -639,7 +632,7 @@ void InspectableWebContentsImpl::DispatchProtocolMessage(
|
|||
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) {
|
||||
base::StringValue message_value(message.substr(pos, kMaxMessageChunkSize));
|
||||
CallClientFunction("DevToolsAPI.dispatchMessageChunk",
|
||||
|
@ -664,6 +657,7 @@ void InspectableWebContentsImpl::RenderFrameHostChanged(
|
|||
|
||||
void InspectableWebContentsImpl::WebContentsDestroyed() {
|
||||
frontend_loaded_ = false;
|
||||
Observe(nullptr);
|
||||
Detach();
|
||||
|
||||
for (const auto& pair : pending_requests_)
|
||||
|
@ -686,10 +680,12 @@ bool InspectableWebContentsImpl::DidAddMessageToConsole(
|
|||
|
||||
bool InspectableWebContentsImpl::ShouldCreateWebContents(
|
||||
content::WebContents* web_contents,
|
||||
content::SiteInstance* source_site_instance,
|
||||
int32_t route_id,
|
||||
int32_t main_frame_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 GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
|
@ -706,6 +702,7 @@ void InspectableWebContentsImpl::HandleKeyboardEvent(
|
|||
}
|
||||
|
||||
void InspectableWebContentsImpl::CloseContents(content::WebContents* source) {
|
||||
// This is where the devtools closes itself (by clicking the x button).
|
||||
CloseDevTools();
|
||||
}
|
||||
|
||||
|
@ -777,7 +774,7 @@ void InspectableWebContentsImpl::OnURLFetchComplete(
|
|||
|
||||
void InspectableWebContentsImpl::SendMessageAck(int request_id,
|
||||
const base::Value* arg) {
|
||||
base::FundamentalValue id_value(request_id);
|
||||
base::Value id_value(request_id);
|
||||
CallClientFunction("DevToolsAPI.embedderMessageAck",
|
||||
&id_value, arg, nullptr);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,6 @@ class InspectableWebContentsImpl :
|
|||
void SetDevicesUpdatesEnabled(bool enabled) 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,
|
||||
const std::string& url) override;
|
||||
|
@ -143,10 +142,12 @@ class InspectableWebContentsImpl :
|
|||
const base::string16& source_id) override;
|
||||
bool ShouldCreateWebContents(
|
||||
content::WebContents* web_contents,
|
||||
content::SiteInstance* source_site_instance,
|
||||
int32_t route_id,
|
||||
int32_t main_frame_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 GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
|
|
|
@ -27,29 +27,28 @@ void DevToolsNetworkController::SetNetworkState(
|
|||
std::unique_ptr<DevToolsNetworkConditions> conditions) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
|
||||
DevToolsNetworkInterceptor* interceptor = interceptors_.get(client_id);
|
||||
if (!interceptor) {
|
||||
auto it = interceptors_.find(client_id);
|
||||
if (it == interceptors_.end()) {
|
||||
if (!conditions)
|
||||
return;
|
||||
std::unique_ptr<DevToolsNetworkInterceptor> new_interceptor(
|
||||
new DevToolsNetworkInterceptor);
|
||||
new_interceptor->UpdateConditions(std::move(conditions));
|
||||
interceptors_.set(client_id, std::move(new_interceptor));
|
||||
interceptors_[client_id] = std::move(new_interceptor);
|
||||
} else {
|
||||
if (!conditions) {
|
||||
std::unique_ptr<DevToolsNetworkConditions> online_conditions(
|
||||
new DevToolsNetworkConditions(false));
|
||||
interceptor->UpdateConditions(std::move(online_conditions));
|
||||
it->second->UpdateConditions(std::move(online_conditions));
|
||||
interceptors_.erase(client_id);
|
||||
} else {
|
||||
interceptor->UpdateConditions(std::move(conditions));
|
||||
it->second->UpdateConditions(std::move(conditions));
|
||||
}
|
||||
}
|
||||
|
||||
bool has_offline_interceptors = false;
|
||||
auto it = interceptors_.begin();
|
||||
for (; it != interceptors_.end(); ++it) {
|
||||
if (it->second->IsOffline()) {
|
||||
for (const auto& interceptor : interceptors_) {
|
||||
if (interceptor.second->IsOffline()) {
|
||||
has_offline_interceptors = true;
|
||||
break;
|
||||
}
|
||||
|
@ -70,11 +69,11 @@ DevToolsNetworkController::GetInterceptor(const std::string& client_id) {
|
|||
if (interceptors_.empty() || client_id.empty())
|
||||
return nullptr;
|
||||
|
||||
DevToolsNetworkInterceptor* interceptor = interceptors_.get(client_id);
|
||||
if (!interceptor)
|
||||
auto it = interceptors_.find(client_id);
|
||||
if (it == interceptors_.end())
|
||||
return nullptr;
|
||||
|
||||
return interceptor;
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
|
@ -5,8 +5,12 @@
|
|||
#ifndef 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/threading/thread_checker.h"
|
||||
|
||||
namespace brightray {
|
||||
|
||||
|
@ -21,11 +25,12 @@ class DevToolsNetworkController {
|
|||
|
||||
void SetNetworkState(const std::string& client_id,
|
||||
std::unique_ptr<DevToolsNetworkConditions> conditions);
|
||||
|
||||
DevToolsNetworkInterceptor* GetInterceptor(const std::string& client_id);
|
||||
|
||||
private:
|
||||
using InterceptorMap =
|
||||
base::ScopedPtrHashMap<std::string,
|
||||
std::unordered_map<std::string,
|
||||
std::unique_ptr<DevToolsNetworkInterceptor>>;
|
||||
|
||||
std::unique_ptr<DevToolsNetworkInterceptor> appcache_interceptor_;
|
||||
|
|
|
@ -134,10 +134,6 @@ bool NetworkDelegate::OnCanEnablePrivacyMode(
|
|||
return false;
|
||||
}
|
||||
|
||||
bool NetworkDelegate::OnAreStrictSecureCookiesEnabled() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ class NetworkDelegate : public net::NetworkDelegate {
|
|||
bool OnCanEnablePrivacyMode(
|
||||
const GURL& url,
|
||||
const GURL& first_party_for_cookies) const override;
|
||||
bool OnAreStrictSecureCookiesEnabled() const override;
|
||||
bool OnAreExperimentalCookieFeaturesEnabled() const override;
|
||||
bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
|
||||
const net::URLRequest& request,
|
||||
|
|
|
@ -70,12 +70,6 @@ blink::mojom::PermissionStatus PermissionManager::GetPermissionStatus(
|
|||
return blink::mojom::PermissionStatus::GRANTED;
|
||||
}
|
||||
|
||||
void PermissionManager::RegisterPermissionUsage(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) {
|
||||
}
|
||||
|
||||
int PermissionManager::SubscribePermissionStatusChange(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
|
|
|
@ -40,9 +40,6 @@ class PermissionManager : public content::PermissionManager {
|
|||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) override;
|
||||
void RegisterPermissionUsage(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) override;
|
||||
int SubscribePermissionStatusChange(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
|
|
|
@ -100,7 +100,7 @@ void PlatformNotificationService::ClosePersistentNotification(
|
|||
const std::string& notification_id) {
|
||||
}
|
||||
|
||||
bool PlatformNotificationService::GetDisplayedPersistentNotifications(
|
||||
bool PlatformNotificationService::GetDisplayedNotifications(
|
||||
content::BrowserContext* browser_context,
|
||||
std::set<std::string>* displayed_notifications) {
|
||||
return false;
|
||||
|
|
|
@ -45,7 +45,7 @@ class PlatformNotificationService
|
|||
const content::NotificationResources& notification_resources) override;
|
||||
void ClosePersistentNotification(content::BrowserContext* browser_context,
|
||||
const std::string& notification_id) override;
|
||||
bool GetDisplayedPersistentNotifications(
|
||||
bool GetDisplayedNotifications(
|
||||
content::BrowserContext* browser_context,
|
||||
std::set<std::string>* displayed_notifications) override;
|
||||
|
||||
|
|
|
@ -24,20 +24,16 @@ bool SpecialStoragePolicy::IsStorageDurable(const GURL& origin) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool SpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
|
||||
bool SpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SpecialStoragePolicy::CanQueryDiskSize(const GURL& origin) {
|
||||
return true;
|
||||
bool SpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SpecialStoragePolicy::HasSessionOnlyOrigins() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SpecialStoragePolicy::HasIsolatedStorage(const GURL& origin) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
|
@ -17,9 +17,8 @@ class SpecialStoragePolicy : public storage::SpecialStoragePolicy {
|
|||
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;
|
||||
bool IsStorageSessionOnly(const GURL& origin) override;
|
||||
bool HasSessionOnlyOrigins() override;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -195,9 +195,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
|||
std::unique_ptr<net::CookieStore> cookie_store =
|
||||
content::CreateCookieStore(cookie_config);
|
||||
storage_->set_cookie_store(std::move(cookie_store));
|
||||
storage_->set_channel_id_service(base::WrapUnique(
|
||||
new net::ChannelIDService(new net::DefaultChannelIDStore(nullptr),
|
||||
base::WorkerPool::GetTaskRunner(true))));
|
||||
storage_->set_channel_id_service(base::MakeUnique<net::ChannelIDService>(
|
||||
new net::DefaultChannelIDStore(nullptr)));
|
||||
|
||||
std::string accept_lang = l10n_util::GetApplicationLocale("");
|
||||
storage_->set_http_user_agent_settings(base::WrapUnique(
|
||||
|
@ -354,9 +353,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
|||
it != protocol_interceptors_.rend();
|
||||
++it) {
|
||||
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));
|
||||
}
|
||||
|
|
2
brightray/vendor/libchromiumcontent
vendored
2
brightray/vendor/libchromiumcontent
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 44448acf6a21024b9adb7140ffef6402a509f8bf
|
||||
Subproject commit 3ca4584486acbfb4b344c7ce956fdcd40a4ed63e
|
Loading…
Reference in a new issue