summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-05-11 00:10:38 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-05-11 00:10:38 +0300
commit48394bdc23015c8289ef97fa1af99ba3e024ef36 (patch)
tree821716e6e8e64f041085eba81d9c75ef23eedfb8 /indra
parentaac1fc4991338ef7c214e9b4e0dbc5d5bb554771 (diff)
SL-15168 Reorginized contants
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llurlfloaterdispatchhandler.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/indra/newview/llurlfloaterdispatchhandler.cpp b/indra/newview/llurlfloaterdispatchhandler.cpp
index 65fbfe9fa3..40afafa4c0 100644
--- a/indra/newview/llurlfloaterdispatchhandler.cpp
+++ b/indra/newview/llurlfloaterdispatchhandler.cpp
@@ -46,6 +46,24 @@ const std::string KEY_FLOATER("floater_title");
const std::string KEY_URL("floater_url");
const std::string KEY_PARAMS("floater_params");
+// Supported floaters
+const std::string FLOATER_GUIDEBOOK("guidebook"); // alias for how_to
+const std::string FLOATER_HOW_TO("how_to");
+const std::string FLOATER_WEB_CONTENT("web_content");
+
+// Web content universal argument
+const std::string KEY_TRUSTED_CONTENT("trusted_content");
+
+// Guidebook specific arguments
+const std::string KEY_WIDTH("width");
+const std::string KEY_HEGHT("height");
+const std::string KEY_CAN_CLOSE("can_close");
+
+// web_content specific arguments
+const std::string KEY_SHOW_PAGE_TITLE("show_page_title");
+const std::string KEY_ALLOW_ADRESS_ENTRY("allow_address_entry"); // It is not recomended to set this to true if trusted content is allowed
+
+
LLUrlFloaterDispatchHandler LLUrlFloaterDispatchHandler::sUrlDispatchhandler;
LLUrlFloaterDispatchHandler::LLUrlFloaterDispatchHandler()
@@ -118,17 +136,17 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
LLFloaterWebContent::Params params;
params.url = url;
- if (floater == "guidebook" || floater == "how_to")
+ if (floater == FLOATER_GUIDEBOOK || floater == FLOATER_HOW_TO)
{
if (command_params.isMap()) // by default is undefines
{
- params.trusted_content = command_params.has("trusted_content") ? command_params["trusted_content"].asBoolean() : false;
+ params.trusted_content = command_params.has(KEY_TRUSTED_CONTENT) ? command_params[KEY_TRUSTED_CONTENT].asBoolean() : false;
// Script's side argument list can't include other lists, neither
// there is a LLRect type, so expect just width and height
- if (command_params.has("width") && command_params.has("height"))
+ if (command_params.has(KEY_WIDTH) && command_params.has(KEY_HEGHT))
{
- LLRect rect(0, command_params["height"].asInteger(), command_params["width"].asInteger(), 0);
+ LLRect rect(0, command_params[KEY_HEGHT].asInteger(), command_params[KEY_WIDTH].asInteger(), 0);
params.preferred_media_size.setValue(rect);
}
}
@@ -144,14 +162,20 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
}
LLFloaterReg::toggleInstanceOrBringToFront("how_to", params);
+
+ if (command_params.isMap() && command_params.has(KEY_CAN_CLOSE))
+ {
+ LLFloater* instance = LLFloaterReg::findInstance("how_to");
+ instance->setCanClose(command_params[KEY_CAN_CLOSE].asBoolean());
+ }
}
- else if (floater == "web_content")
+ else if (floater == FLOATER_WEB_CONTENT)
{
if (command_params.isMap()) // by default is undefines, might be better idea to init params from command_params
{
- params.trusted_content = command_params.has("trusted_content") ? command_params["trusted_content"].asBoolean() : false;
- params.show_page_title = command_params.has("show_page_title") ? command_params["show_page_title"].asBoolean() : true;
- params.allow_address_entry = command_params.has("allow_address_entry") ? command_params["allow_address_entry"].asBoolean() : true;
+ params.trusted_content = command_params.has(KEY_TRUSTED_CONTENT) ? command_params[KEY_TRUSTED_CONTENT].asBoolean() : false;
+ params.show_page_title = command_params.has(KEY_SHOW_PAGE_TITLE) ? command_params[KEY_SHOW_PAGE_TITLE].asBoolean() : true;
+ params.allow_address_entry = command_params.has(KEY_ALLOW_ADRESS_ENTRY) ? command_params[KEY_ALLOW_ADRESS_ENTRY].asBoolean() : true;
}
LLFloaterReg::showInstance("web_content", params);
}