Backport (3-0-x) - Fix devtools not functioning well (#13571)

* implement devtools showItemInFolder message

* add stubs for new devtools messages

* fix: update devtools url

* spec: enable back devtools tests

* spec: disable the i18nString test

It is failed because of fs.statSyncNoException, I'll fix it in another
PR.
This commit is contained in:
trop[bot] 2018-07-06 13:19:21 +10:00 committed by Samuel Attard
parent 8585372e11
commit c2f4144996
5 changed files with 78 additions and 6 deletions

View file

@ -7,6 +7,7 @@
#include "brightray/browser/inspectable_web_contents_impl.h"
#include "atom/common/platform_util.h"
#include "base/guid.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
@ -47,7 +48,7 @@ const double kPresetZoomFactors[] = {0.25, 0.333, 0.5, 0.666, 0.75, 0.9,
2.5, 3.0, 4.0, 5.0};
const char kChromeUIDevToolsURL[] =
"chrome-devtools://devtools/bundled/inspector.html?"
"chrome-devtools://devtools/bundled/devtools_app.html?"
"remoteBase=%s&"
"can_dock=%s&"
"toolbarColor=rgba(223,223,223,1)&"
@ -485,6 +486,14 @@ void InspectableWebContentsImpl::SetIsDocked(const DispatchCallback& callback,
void InspectableWebContentsImpl::OpenInNewTab(const std::string& url) {}
void InspectableWebContentsImpl::ShowItemInFolder(
const std::string& file_system_path) {
if (file_system_path.empty())
return;
base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path);
platform_util::ShowItemInFolder(path);
}
void InspectableWebContentsImpl::SaveToFile(const std::string& url,
const std::string& content,
bool save_as) {
@ -543,6 +552,10 @@ void InspectableWebContentsImpl::SearchInPath(
void InspectableWebContentsImpl::SetWhitelistedShortcuts(
const std::string& message) {}
void InspectableWebContentsImpl::SetEyeDropperActive(bool active) {}
void InspectableWebContentsImpl::ShowCertificateViewer(
const std::string& cert_chain) {}
void InspectableWebContentsImpl::ZoomIn() {
double new_level = GetNextZoomLevel(GetDevToolsZoomLevel(), false);
SetZoomLevelForWebContents(GetDevToolsWebContents(), new_level);
@ -560,8 +573,24 @@ void InspectableWebContentsImpl::ResetZoom() {
UpdateDevToolsZoomLevel(0.);
}
void InspectableWebContentsImpl::SetDevicesDiscoveryConfig(
bool discover_usb_devices,
bool port_forwarding_enabled,
const std::string& port_forwarding_config,
bool network_discovery_enabled,
const std::string& network_discovery_config) {}
void InspectableWebContentsImpl::SetDevicesUpdatesEnabled(bool enabled) {}
void InspectableWebContentsImpl::PerformActionOnRemotePage(
const std::string& page_id,
const std::string& action) {}
void InspectableWebContentsImpl::OpenRemotePage(const std::string& browser_id,
const std::string& url) {}
void InspectableWebContentsImpl::OpenNodeFrontend() {}
void InspectableWebContentsImpl::DispatchProtocolMessageFromDevToolsFrontend(
const std::string& message) {
// If the devtools wants to reload the page, hijack the message and handle it
@ -609,6 +638,8 @@ void InspectableWebContentsImpl::ClearPreferences() {
update.Get()->Clear();
}
void InspectableWebContentsImpl::ConnectionReady() {}
void InspectableWebContentsImpl::RegisterExtensionsAPI(
const std::string& origin,
const std::string& script) {