void LLInspectObject::updateSecureBrowsing()
{
	bool is_secure_browsing = false;
	
	if(mMediaImpl.notNull() 
	   && mMediaImpl->hasMedia())
	{
		LLPluginClassMedia* media_plugin = NULL;
		std::string current_url = "";
		media_plugin = mMediaImpl->getMediaPlugin();
		if(media_plugin)
		{
			if(media_plugin->pluginSupportsMediaTime())
			{
				current_url = mMediaImpl->getMediaURL();
			}
			else
			{
				current_url =  media_plugin->getLocation();
			}
		}
		
		std::string prefix =  std::string("https://");
		std::string test_prefix = current_url.substr(0, prefix.length());
		LLStringUtil::toLower(test_prefix);	
		if(test_prefix == prefix)
		{
			is_secure_browsing = true;
		}
	}
	getChild<LLUICtrl>("secure_browsing")->setVisible(is_secure_browsing);
}
void LLInspectObject::updateMediaCurrentURL()
{	
	if(!mMediaEntry)
		return;
	LLTextBox* textbox = getChild<LLTextBox>("object_media_url");
	std::string media_url = "";
	textbox->setValue(media_url);
	textbox->setToolTip(media_url);
	LLStringUtil::format_map_t args;
	
	if(mMediaImpl.notNull() && mMediaImpl->hasMedia())
	{
		
		LLPluginClassMedia* media_plugin = NULL;
		media_plugin = mMediaImpl->getMediaPlugin();
		if(media_plugin)
		{
			if(media_plugin->pluginSupportsMediaTime())
			{
				args["[CurrentURL]"] =  mMediaImpl->getMediaURL();
			}
			else
			{
				args["[CurrentURL]"] =  media_plugin->getLocation();
			}
			media_url = LLTrans::getString("CurrentURL", args);

		}
	}
	else if(mMediaEntry->getCurrentURL() != "")
	{
		args["[CurrentURL]"] = mMediaEntry->getCurrentURL();
		media_url = LLTrans::getString("CurrentURL", args);
	}

	textbox->setText(media_url);
	textbox->setToolTip(media_url);
}
void LLViewerMediaFocus::setFocusFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal)
{	
	LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
	
	LLViewerMediaImpl *old_media_impl = getFocusedMediaImpl();
	if(old_media_impl)
	{
		old_media_impl->focus(false);
	}
	
	// Always clear the current selection.  If we're setting focus on a face, we'll reselect the correct object below.
	LLSelectMgr::getInstance()->deselectAll();
	mSelection = NULL;

	if (media_impl.notNull() && objectp.notNull())
	{
		bool face_auto_zoom = false;

		mFocusedImplID = media_impl->getMediaTextureID();
		mFocusedObjectID = objectp->getID();
		mFocusedObjectFace = face;
		mFocusedObjectNormal = pick_normal;
		
		// Set the selection in the selection manager so we can draw the focus ring.
		mSelection = LLSelectMgr::getInstance()->selectObjectOnly(objectp, face);

		// Focusing on a media face clears its disable flag.
		media_impl->setDisabled(false);

		LLTextureEntry* tep = objectp->getTE(face);
		if(tep->hasMedia())
		{
			LLMediaEntry* mep = tep->getMediaData();
			face_auto_zoom = mep->getAutoZoom();
			if(!media_impl->hasMedia())
			{
				std::string url = mep->getCurrentURL().empty() ? mep->getHomeURL() : mep->getCurrentURL();
				media_impl->navigateTo(url, "", true);
			}
		}
		else
		{
			// This should never happen.
			llwarns << "Can't find media entry for focused face" << llendl;
		}

		media_impl->focus(true);
		gFocusMgr.setKeyboardFocus(this);
		
		// We must do this before  processing the media HUD zoom, or it may zoom to the wrong face. 
		update();

		if(mMediaControls.get())
		{
			if(face_auto_zoom && ! parcel->getMediaPreventCameraZoom())
			{
				// Zoom in on this face
				mMediaControls.get()->resetZoomLevel(false);
				mMediaControls.get()->nextZoomLevel();
			}
			else
			{
				// Reset the controls' zoom level without moving the camera.
				// This fixes the case where clicking focus between two non-autozoom faces doesn't change the zoom-out button back to a zoom-in button.
				mMediaControls.get()->resetZoomLevel(false);
			}
		}
	}
	else
	{
		if(hasFocus())
		{
			gFocusMgr.setKeyboardFocus(NULL);
		}
		
		mFocusedImplID = LLUUID::null;
		if (objectp.notNull())
		{
			// Still record the focused object...it may mean we need to load media data.
			// This will aid us in determining this object is "important enough"
			mFocusedObjectID = objectp->getID();
			mFocusedObjectFace = face;
		}
		else {
			mFocusedObjectID = LLUUID::null;
			mFocusedObjectFace = 0;
		}
	}
}