EXT-8540 - Implement mime type override for web_browser ctrl
reviewed by Monroemaster
parent
3c27e119b4
commit
bd20eddd4e
|
|
@ -67,7 +67,8 @@ LLMediaCtrl::Params::Params()
|
|||
decouple_texture_size("decouple_texture_size", false),
|
||||
texture_width("texture_width", 1024),
|
||||
texture_height("texture_height", 1024),
|
||||
caret_color("caret_color")
|
||||
caret_color("caret_color"),
|
||||
initial_mime_type("initial_mime_type")
|
||||
{
|
||||
tab_stop(false);
|
||||
}
|
||||
|
|
@ -92,7 +93,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
|
|||
mDecoupleTextureSize ( false ),
|
||||
mTextureWidth ( 1024 ),
|
||||
mTextureHeight ( 1024 ),
|
||||
mClearCache(false)
|
||||
mClearCache(false),
|
||||
mHomePageMimeType(p.initial_mime_type)
|
||||
{
|
||||
{
|
||||
LLColor4 color = p.caret_color().get();
|
||||
|
|
@ -101,7 +103,7 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
|
|||
|
||||
setIgnoreUIScale(p.ignore_ui_scale);
|
||||
|
||||
setHomePageUrl(p.start_url);
|
||||
setHomePageUrl(p.start_url, p.initial_mime_type);
|
||||
|
||||
setBorderVisible(p.border_visible);
|
||||
|
||||
|
|
@ -567,12 +569,12 @@ void LLMediaCtrl::navigateHome()
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void LLMediaCtrl::setHomePageUrl( const std::string urlIn )
|
||||
void LLMediaCtrl::setHomePageUrl( const std::string& urlIn, const std::string& mime_type )
|
||||
{
|
||||
mHomePageUrl = urlIn;
|
||||
if (mMediaSource)
|
||||
{
|
||||
mMediaSource->setHomeURL(mHomePageUrl);
|
||||
mMediaSource->setHomeURL(mHomePageUrl, mime_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -616,7 +618,7 @@ bool LLMediaCtrl::ensureMediaSourceExists()
|
|||
if ( mMediaSource )
|
||||
{
|
||||
mMediaSource->setUsedInUI(true);
|
||||
mMediaSource->setHomeURL(mHomePageUrl);
|
||||
mMediaSource->setHomeURL(mHomePageUrl, mHomePageMimeType);
|
||||
mMediaSource->setVisible( getVisible() );
|
||||
mMediaSource->addObserver( this );
|
||||
mMediaSource->setBackgroundColor( getBackgroundColor() );
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ public:
|
|||
texture_height;
|
||||
|
||||
Optional<LLUIColor> caret_color;
|
||||
|
||||
Optional<std::string> initial_mime_type;
|
||||
|
||||
Params();
|
||||
};
|
||||
|
|
@ -109,7 +111,7 @@ public:
|
|||
// because we control the page content. See DEV-9530. JC.
|
||||
void setTrusted( bool valIn );
|
||||
|
||||
void setHomePageUrl( const std::string urlIn );
|
||||
void setHomePageUrl( const std::string& urlIn, const std::string& mime_type = LLStringUtil::null );
|
||||
std::string getHomePageUrl();
|
||||
|
||||
// set/clear URL to visit when a 404 page is reached
|
||||
|
|
@ -173,6 +175,7 @@ public:
|
|||
bool mForceUpdate;
|
||||
bool mTrusted;
|
||||
std::string mHomePageUrl;
|
||||
std::string mHomePageMimeType;
|
||||
std::string mCurrentNavUrl;
|
||||
bool mIgnoreUIScale;
|
||||
bool mAlwaysRefresh;
|
||||
|
|
|
|||
|
|
@ -2196,7 +2196,8 @@ void LLViewerMediaImpl::navigateReload()
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
void LLViewerMediaImpl::navigateHome()
|
||||
{
|
||||
navigateTo(mHomeURL, "", true, false);
|
||||
bool rediscover_mimetype = mHomeMimeType.empty();
|
||||
navigateTo(mHomeURL, mHomeMimeType, rediscover_mimetype, false);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ public:
|
|||
std::string getCurrentMediaURL();
|
||||
std::string getHomeURL() { return mHomeURL; }
|
||||
std::string getMediaEntryURL() { return mMediaEntryURL; }
|
||||
void setHomeURL(const std::string& home_url) { mHomeURL = home_url; };
|
||||
void setHomeURL(const std::string& home_url, const std::string& mime_type = LLStringUtil::null) { mHomeURL = home_url; mHomeMimeType = mime_type;};
|
||||
void clearCache();
|
||||
std::string getMimeType() { return mMimeType; }
|
||||
void scaleMouse(S32 *mouse_x, S32 *mouse_y);
|
||||
|
|
@ -401,6 +401,7 @@ private:
|
|||
bool mMovieImageHasMips;
|
||||
std::string mMediaURL; // The last media url set with NavigateTo
|
||||
std::string mHomeURL;
|
||||
std::string mHomeMimeType; // forced mime type for home url
|
||||
std::string mMimeType;
|
||||
std::string mCurrentMediaURL; // The most current media url from the plugin (via the "location changed" or "navigate complete" events).
|
||||
std::string mCurrentMimeType; // The MIME type that caused the currently loaded plugin to be loaded.
|
||||
|
|
|
|||
Loading…
Reference in New Issue