commit
82b9ced3e0
11 changed files with 61 additions and 43 deletions
|
@ -118,6 +118,8 @@
|
|||
'Common_Base': {
|
||||
'abstract': 1,
|
||||
'defines': [
|
||||
# Used by content_browser_client.h:
|
||||
'ENABLE_WEBRTC',
|
||||
# We are using Release version libchromiumcontent:
|
||||
'NDEBUG',
|
||||
# Needed by gin:
|
||||
|
|
|
@ -20,7 +20,8 @@ namespace brightray {
|
|||
|
||||
namespace {
|
||||
|
||||
const char kChromeUIDevToolsBundledHost[] = "devtools";
|
||||
const char kChromeUIDevToolsHost[] = "devtools";
|
||||
const char kChromeUIDevToolsBundledPath[] = "bundled";
|
||||
|
||||
std::string PathWithoutParams(const std::string& path) {
|
||||
return GURL(std::string("chrome-devtools://devtools/") + path)
|
||||
|
@ -29,19 +30,19 @@ std::string PathWithoutParams(const std::string& path) {
|
|||
|
||||
std::string GetMimeTypeForPath(const std::string& path) {
|
||||
std::string filename = PathWithoutParams(path);
|
||||
if (EndsWith(filename, ".html", false)) {
|
||||
if (base::EndsWith(filename, ".html", false)) {
|
||||
return "text/html";
|
||||
} else if (EndsWith(filename, ".css", false)) {
|
||||
} else if (base::EndsWith(filename, ".css", false)) {
|
||||
return "text/css";
|
||||
} else if (EndsWith(filename, ".js", false)) {
|
||||
} else if (base::EndsWith(filename, ".js", false)) {
|
||||
return "application/javascript";
|
||||
} else if (EndsWith(filename, ".png", false)) {
|
||||
} else if (base::EndsWith(filename, ".png", false)) {
|
||||
return "image/png";
|
||||
} else if (EndsWith(filename, ".gif", false)) {
|
||||
} else if (base::EndsWith(filename, ".gif", false)) {
|
||||
return "image/gif";
|
||||
} else if (EndsWith(filename, ".svg", false)) {
|
||||
} else if (base::EndsWith(filename, ".svg", false)) {
|
||||
return "image/svg+xml";
|
||||
} else if (EndsWith(filename, ".manifest", false)) {
|
||||
} else if (base::EndsWith(filename, ".manifest", false)) {
|
||||
return "text/cache-manifest";
|
||||
}
|
||||
return "text/html";
|
||||
|
@ -53,19 +54,23 @@ class BundledDataSource : public content::URLDataSource {
|
|||
|
||||
// content::URLDataSource implementation.
|
||||
std::string GetSource() const override {
|
||||
return kChromeUIDevToolsBundledHost;
|
||||
return kChromeUIDevToolsHost;
|
||||
}
|
||||
|
||||
void StartDataRequest(const std::string& path,
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int render_frame_id,
|
||||
const GotDataCallback& callback) override {
|
||||
std::string filename = PathWithoutParams(path);
|
||||
base::StringPiece resource =
|
||||
content::DevToolsFrontendHost::GetFrontendResource(filename);
|
||||
scoped_refptr<base::RefCountedStaticMemory> bytes(
|
||||
new base::RefCountedStaticMemory(resource.data(), resource.length()));
|
||||
callback.Run(bytes.get());
|
||||
// Serve request from local bundle.
|
||||
std::string bundled_path_prefix(kChromeUIDevToolsBundledPath);
|
||||
bundled_path_prefix += "/";
|
||||
if (base::StartsWith(path, bundled_path_prefix,
|
||||
base::CompareCase::INSENSITIVE_ASCII)) {
|
||||
StartBundledDataRequest(path.substr(bundled_path_prefix.length()),
|
||||
render_process_id, render_frame_id, callback);
|
||||
return;
|
||||
}
|
||||
callback.Run(nullptr);
|
||||
}
|
||||
|
||||
std::string GetMimeType(const std::string& path) const override {
|
||||
|
@ -84,6 +89,24 @@ class BundledDataSource : public content::URLDataSource {
|
|||
return true;
|
||||
}
|
||||
|
||||
void StartBundledDataRequest(
|
||||
const std::string& path,
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
const content::URLDataSource::GotDataCallback& callback) {
|
||||
std::string filename = PathWithoutParams(path);
|
||||
base::StringPiece resource =
|
||||
content::DevToolsFrontendHost::GetFrontendResource(filename);
|
||||
|
||||
DLOG_IF(WARNING, resource.empty())
|
||||
<< "Unable to find dev tool resource: " << filename
|
||||
<< ". If you compiled with debug_devtools=1, try running with "
|
||||
"--debug-devtools.";
|
||||
scoped_refptr<base::RefCountedStaticMemory> bytes(
|
||||
new base::RefCountedStaticMemory(resource.data(), resource.length()));
|
||||
callback.Run(bytes.get());
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~BundledDataSource() {}
|
||||
DISALLOW_COPY_AND_ASSIGN(BundledDataSource);
|
||||
|
|
|
@ -38,11 +38,13 @@ const double kPresetZoomFactors[] = { 0.25, 0.333, 0.5, 0.666, 0.75, 0.9, 1.0,
|
|||
1.1, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0,
|
||||
5.0 };
|
||||
|
||||
const char kChromeUIDevToolsURL[] = "chrome-devtools://devtools/devtools.html?"
|
||||
"can_dock=%s&"
|
||||
"toolbarColor=rgba(223,223,223,1)&"
|
||||
"textColor=rgba(0,0,0,1)&"
|
||||
"experiments=true";
|
||||
const char kChromeUIDevToolsURL[] =
|
||||
"chrome-devtools://devtools/bundled/inspector.html?"
|
||||
"can_dock=%s&"
|
||||
"toolbarColor=rgba(223,223,223,1)&"
|
||||
"textColor=rgba(0,0,0,1)&"
|
||||
"experiments=true";
|
||||
|
||||
const char kDevToolsBoundsPref[] = "brightray.devtools.bounds";
|
||||
const char kDevToolsZoomPref[] = "brightray.devtools.zoom";
|
||||
const char kDevToolsPreferences[] = "brightray.devtools.preferences";
|
||||
|
@ -282,13 +284,13 @@ void InspectableWebContentsImpl::CallClientFunction(const std::string& function_
|
|||
std::string javascript = function_name + "(";
|
||||
if (arg1) {
|
||||
std::string json;
|
||||
base::JSONWriter::Write(arg1, &json);
|
||||
base::JSONWriter::Write(*arg1, &json);
|
||||
javascript.append(json);
|
||||
if (arg2) {
|
||||
base::JSONWriter::Write(arg2, &json);
|
||||
base::JSONWriter::Write(*arg2, &json);
|
||||
javascript.append(", ").append(json);
|
||||
if (arg3) {
|
||||
base::JSONWriter::Write(arg3, &json);
|
||||
base::JSONWriter::Write(*arg3, &json);
|
||||
javascript.append(", ").append(json);
|
||||
}
|
||||
}
|
||||
|
@ -586,7 +588,7 @@ bool InspectableWebContentsImpl::ShouldCreateWebContents(
|
|||
int route_id,
|
||||
int main_frame_route_id,
|
||||
WindowContainerType window_container_type,
|
||||
const base::string16& frame_name,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
content::SessionStorageNamespace* session_storage_namespace) {
|
||||
|
|
|
@ -143,7 +143,7 @@ class InspectableWebContentsImpl :
|
|||
int route_id,
|
||||
int main_frame_route_id,
|
||||
WindowContainerType window_container_type,
|
||||
const base::string16& frame_name,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
const std::string& partition_id,
|
||||
content::SessionStorageNamespace* session_storage_namespace) override;
|
||||
|
|
|
@ -129,11 +129,6 @@ bool NetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool NetworkDelegate::OnCanThrottleRequest(
|
||||
const net::URLRequest& request) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NetworkDelegate::OnCanEnablePrivacyMode(
|
||||
const GURL& url,
|
||||
const GURL& first_party_for_cookies) const {
|
||||
|
|
|
@ -61,7 +61,6 @@ class NetworkDelegate : public net::NetworkDelegate {
|
|||
net::CookieOptions* options) override;
|
||||
bool OnCanAccessFile(const net::URLRequest& request,
|
||||
const base::FilePath& path) const override;
|
||||
bool OnCanThrottleRequest(const net::URLRequest& request) const override;
|
||||
bool OnCanEnablePrivacyMode(
|
||||
const GURL& url,
|
||||
const GURL& first_party_for_cookies) const override;
|
||||
|
|
|
@ -17,7 +17,7 @@ PermissionManager::~PermissionManager() {
|
|||
|
||||
void PermissionManager::RequestPermission(
|
||||
content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
int request_id,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
|
@ -27,7 +27,7 @@ void PermissionManager::RequestPermission(
|
|||
|
||||
void PermissionManager::CancelPermissionRequest(
|
||||
content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
int request_id,
|
||||
const GURL& requesting_origin) {
|
||||
}
|
||||
|
|
|
@ -19,13 +19,13 @@ class PermissionManager : public content::PermissionManager {
|
|||
// content::PermissionManager:
|
||||
void RequestPermission(
|
||||
content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
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::WebContents* web_contents,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
int request_id,
|
||||
const GURL& requesting_origin) override;
|
||||
void ResetPermission(content::PermissionType permission,
|
||||
|
|
|
@ -143,7 +143,7 @@ URLRequestContextGetter::URLRequestContextGetter(
|
|||
// 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_->message_loop_proxy(), file_loop_->message_loop_proxy()));
|
||||
io_loop_->task_runner(), file_loop_->task_runner()));
|
||||
}
|
||||
|
||||
URLRequestContextGetter::~URLRequestContextGetter() {
|
||||
|
@ -233,7 +233,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
|||
url_sec_mgr_.get(),
|
||||
host_resolver.get(),
|
||||
std::string(), // gssapi_library_name
|
||||
false, // negotiate_disable_cname_lookup
|
||||
std::string(), // gssapi_library_nam
|
||||
false, // auth_android_negotiate_account_type
|
||||
true); // negotiate_enable_port
|
||||
|
||||
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
|
||||
|
|
|
@ -13,13 +13,9 @@
|
|||
namespace brightray {
|
||||
|
||||
ViewsDelegate::ViewsDelegate() {
|
||||
DCHECK(!views::ViewsDelegate::views_delegate);
|
||||
views::ViewsDelegate::views_delegate = this;
|
||||
}
|
||||
|
||||
ViewsDelegate::~ViewsDelegate() {
|
||||
DCHECK_EQ(views::ViewsDelegate::views_delegate, this);
|
||||
views::ViewsDelegate::views_delegate = NULL;
|
||||
}
|
||||
|
||||
void ViewsDelegate::SaveWindowPlacement(const views::Widget* window,
|
||||
|
|
2
brightray/vendor/libchromiumcontent
vendored
2
brightray/vendor/libchromiumcontent
vendored
|
@ -1 +1 @@
|
|||
Subproject commit cf133b8ebfeb3579032d3092351c801a3112aa7c
|
||||
Subproject commit 10d2bfe683038c79d76d5facd3771da535c9329b
|
Loading…
Reference in a new issue