mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
WebBrowserComponent: Improve formatting
This commit is contained in:
parent
14ee9e46ff
commit
8e4832dcf5
2 changed files with 31 additions and 36 deletions
|
|
@ -169,7 +169,6 @@ static void evaluationHandler (WebBrowserComponent::EvaluationResult r)
|
|||
// result that cannot be translated and returned to native code such as a Promise.
|
||||
jassert (r.getError()->type == WebBrowserComponent::EvaluationResult::Error::Type::unsupportedReturnType);
|
||||
DBG (r.getError()->message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1036,8 +1036,9 @@ public:
|
|||
WebKitNavigationAction* action,
|
||||
WebKitPolicyDecision* decision)
|
||||
{
|
||||
if (decision != nullptr && frameName.isEmpty())
|
||||
{
|
||||
if (decision == nullptr || ! frameName.isEmpty())
|
||||
return false;
|
||||
|
||||
WebKitSymbols::getInstance()->juce_g_object_ref (decision);
|
||||
decisions.add (decision);
|
||||
|
||||
|
|
@ -1050,15 +1051,13 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool onNewWindow (String /*frameName*/,
|
||||
WebKitNavigationAction* action,
|
||||
WebKitPolicyDecision* decision)
|
||||
{
|
||||
if (decision != nullptr)
|
||||
{
|
||||
if (decision == nullptr)
|
||||
return false;
|
||||
|
||||
DynamicObject::Ptr params = new DynamicObject;
|
||||
|
||||
params->setProperty ("url", getURIStringForAction (action));
|
||||
|
|
@ -1070,19 +1069,16 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void onLoadChanged (WebKitLoadEvent loadEvent)
|
||||
{
|
||||
if (loadEvent == WEBKIT_LOAD_FINISHED)
|
||||
{
|
||||
if (loadEvent != WEBKIT_LOAD_FINISHED)
|
||||
return;
|
||||
|
||||
DynamicObject::Ptr params = new DynamicObject;
|
||||
|
||||
params->setProperty ("url", String (WebKitSymbols::getInstance()->juce_webkit_web_view_get_uri (webview)));
|
||||
CommandReceiver::sendCommand (outChannel, "pageFinishedLoading", var (params.get()));
|
||||
}
|
||||
}
|
||||
|
||||
bool onDecidePolicy (WebKitPolicyDecision* decision,
|
||||
WebKitPolicyDecisionType decisionType)
|
||||
|
|
@ -1244,7 +1240,7 @@ private:
|
|||
return;
|
||||
}
|
||||
|
||||
const auto jsValueResult = [&]() -> std::tuple<std::optional<var>, String>
|
||||
const auto jsValueResult = std::invoke ([&]() -> std::tuple<std::optional<var>, String>
|
||||
{
|
||||
auto* jsValue = wk.juce_webkit_javascript_result_get_js_value (jsResult.get());
|
||||
|
||||
|
|
@ -1252,7 +1248,7 @@ private:
|
|||
return { std::nullopt, String{} };
|
||||
|
||||
return { fromJSCValue (jsValue), String{} };
|
||||
}();
|
||||
});
|
||||
|
||||
owner->handleEvaluationCallback (std::get<0> (jsValueResult), std::get<1> (jsValueResult));
|
||||
}
|
||||
|
|
@ -1356,7 +1352,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
const auto result = [&]
|
||||
const auto result = std::invoke ([&]
|
||||
{
|
||||
using Error = EvaluationResult::Error;
|
||||
|
||||
|
|
@ -1369,7 +1365,7 @@ public:
|
|||
}
|
||||
|
||||
return EvaluationResult { params->hasPayload ? params->payload : var::undefined() };
|
||||
}();
|
||||
});
|
||||
|
||||
auto& cb = evaluationCallbacks.front();
|
||||
cb (result);
|
||||
|
|
@ -1430,14 +1426,14 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
receiver.reset (new CommandReceiver (this, inChannel));
|
||||
receiver = std::make_unique<CommandReceiver> (static_cast<Responder*> (this), inChannel);
|
||||
|
||||
pfds.push_back ({ threadControl[0], POLLIN, 0 });
|
||||
pfds.push_back ({ receiver->getFd(), POLLIN, 0 });
|
||||
|
||||
startThread();
|
||||
|
||||
xembed.reset (new XEmbedComponent (windowHandle));
|
||||
xembed = std::make_unique<XEmbedComponent> (windowHandle);
|
||||
browser.addAndMakeVisible (xembed.get());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue