diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/media_plugins/webkit/media_plugin_webkit.cpp | 4 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 13 | ||||
-rw-r--r-- | indra/newview/llfloaterwebcontent.cpp | 585 | ||||
-rw-r--r-- | indra/newview/llfloaterwebcontent.h | 148 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_web_content.xml | 275 | ||||
-rw-r--r-- | indra/test_apps/llplugintest/llmediaplugintest.cpp | 2 |
6 files changed, 553 insertions, 474 deletions
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 1666f877e9..19244d2d1f 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -407,6 +407,8 @@ private: { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "navigate_begin"); message.setValue("uri", event.getEventUri()); + message.setValueBoolean("history_back_available", LLQtWebKit::getInstance()->userActionIsEnabled( mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_BACK)); + message.setValueBoolean("history_forward_available", LLQtWebKit::getInstance()->userActionIsEnabled( mBrowserWindowId, LLQtWebKit::UA_NAVIGATE_FORWARD)); sendMessage(message); setStatus(STATUS_LOADING); @@ -605,7 +607,7 @@ private: mAuthPassword = message.getValue("password"); } } - + //////////////////////////////////////////////////////////////////////////////// // virtual void onLinkHovered(const EventType& event) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ef45eaa1db..5548abc623 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6626,7 +6626,18 @@ <key>MediaBrowserWindowLimit</key> <map> <key>Comment</key> - <string>Maximum number of media brower windows that can be open at once (0 for no limit)</string> + <string>Maximum number of media brower windows that can be open at once in the media browser floater (0 for no limit)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>5</integer> + </map> + <key>WebContentWindowLimit</key> + <map> + <key>Comment</key> + <string>Maximum number of web brower windows that can be open at once in the Web content floater (0 for no limit)</string> <key>Persist</key> <integer>1</integer> <key>Type</key> diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 138ddeabda..8321b2914f 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -1,276 +1,309 @@ -/** - * @file llfloaterwebcontent.cpp - * @brief floater for displaying web content - e.g. profiles and search (eventually) - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterwebcontent.h" - -#include "llfloaterreg.h" -#include "llparcel.h" -#include "llpluginclassmedia.h" -#include "lluictrlfactory.h" -#include "llmediactrl.h" -#include "llviewerwindow.h" -#include "llviewercontrol.h" -#include "llviewerparcelmgr.h" -#include "llweb.h" -#include "llui.h" -#include "roles_constants.h" - -#include "llurlhistory.h" -#include "llviewermedia.h" -#include "llviewerparcelmedia.h" -#include "llcombobox.h" -#include "llwindow.h" -#include "lllayoutstack.h" -#include "llcheckboxctrl.h" - -#include "llnotifications.h" - -// TEMP -#include "llsdutil.h" - -LLFloaterWebContent::LLFloaterWebContent(const LLSD& key) - : LLFloater(key) -{ -} - -//static -void LLFloaterWebContent::create(const std::string &url, const std::string& target, const std::string& uuid) -{ - lldebugs << "url = " << url << ", target = " << target << ", uuid = " << uuid << llendl; - - std::string tag = target; - - if(target.empty() || target == "_blank") - { - if(!uuid.empty()) - { - tag = uuid; - } - else - { - // create a unique tag for this instance - LLUUID id; - id.generate(); - tag = id.asString(); - } - } - - S32 browser_window_limit = gSavedSettings.getS32("MediaBrowserWindowLimit"); - - if(LLFloaterReg::findInstance("web_content", tag) != NULL) - { - // There's already a web browser for this tag, so we won't be opening a new window. - } - else if(browser_window_limit != 0) - { - // showInstance will open a new window. Figure out how many web browsers are already open, - // and close the least recently opened one if this will put us over the limit. - - LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList("web_content"); - lldebugs << "total instance count is " << instances.size() << llendl; - - for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++) - { - lldebugs << " " << (*iter)->getKey() << llendl; - } - - if(instances.size() >= (size_t)browser_window_limit) - { - // Destroy the least recently opened instance - (*instances.begin())->closeFloater(); - } - } - - LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*> (LLFloaterReg::showInstance("web_content", tag)); - llassert(browser); - if(browser) - { - browser->mUUID = uuid; - - // tell the browser instance to load the specified URL - browser->openMedia(url, target); - LLViewerMedia::proxyWindowOpened(target, uuid); - } -} - -//static -void LLFloaterWebContent::closeRequest(const std::string &uuid) -{ - LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("web_content"); - lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl; - for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) - { - LLFloaterWebContent* i = dynamic_cast<LLFloaterWebContent*>(*iter); - lldebugs << " " << i->mUUID << llendl; - if (i && i->mUUID == uuid) - { - i->closeFloater(false); - return; - } - } -} - -//static -void LLFloaterWebContent::geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height) -{ - LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("web_content"); - lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl; - for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) - { - LLFloaterWebContent* i = dynamic_cast<LLFloaterWebContent*>(*iter); - lldebugs << " " << i->mUUID << llendl; - if (i && i->mUUID == uuid) - { - i->geometryChanged(x, y, width, height); - return; - } - } -} - -void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height) -{ - // Make sure the layout of the browser control is updated, so this calculation is correct. - LLLayoutStack::updateClass(); - - // TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc. - LLCoordWindow window_size; - getWindow()->getSize(&window_size); - - // Adjust width and height for the size of the chrome on the web Browser window. - width += getRect().getWidth() - mWebBrowser->getRect().getWidth(); - height += getRect().getHeight() - mWebBrowser->getRect().getHeight(); - - LLRect geom; - geom.setOriginAndSize(x, window_size.mY - (y + height), width, height); - - lldebugs << "geometry change: " << geom << llendl; - - handleReshape(geom,false); -} - -void LLFloaterWebContent::openMedia(const std::string& web_url, const std::string& target) -{ - mWebBrowser->setHomePageUrl(web_url); - mWebBrowser->setTarget(target); - mWebBrowser->navigateTo(web_url); - setCurrentURL(web_url); -} - -void LLFloaterWebContent::draw() -{ -// getChildView("go")->setEnabled(!mAddressCombo->getValue().asString().empty()); - - getChildView("back")->setEnabled(mWebBrowser->canNavigateBack()); - getChildView("forward")->setEnabled(mWebBrowser->canNavigateForward()); - - LLFloater::draw(); -} - -BOOL LLFloaterWebContent::postBuild() -{ - mWebBrowser = getChild<LLMediaCtrl>("webbrowser"); - mWebBrowser->addObserver(this); - - childSetAction("back", onClickBack, this); - childSetAction("forward", onClickForward, this); - childSetAction("reload", onClickRefresh, this); - childSetAction("go", onClickGo, this); - - return TRUE; -} - -//virtual -void LLFloaterWebContent::onClose(bool app_quitting) -{ - LLViewerMedia::proxyWindowClosed(mUUID); - destroy(); -} - -void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) -{ - if(event == MEDIA_EVENT_LOCATION_CHANGED) - { - setCurrentURL(self->getLocation()); - } - else if(event == MEDIA_EVENT_NAVIGATE_COMPLETE) - { - // This is the event these flags are sent with. - getChildView("back")->setEnabled(self->getHistoryBackAvailable()); - getChildView("forward")->setEnabled(self->getHistoryForwardAvailable()); - } - else if(event == MEDIA_EVENT_CLOSE_REQUEST) - { - // The browser instance wants its window closed. - closeFloater(); - } - else if(event == MEDIA_EVENT_GEOMETRY_CHANGE) - { - geometryChanged(self->getGeometryX(), self->getGeometryY(), self->getGeometryWidth(), self->getGeometryHeight()); - } -} - -void LLFloaterWebContent::setCurrentURL(const std::string& url) -{ - mCurrentURL = url; - - getChildView("back")->setEnabled(mWebBrowser->canNavigateBack()); - getChildView("forward")->setEnabled(mWebBrowser->canNavigateForward()); - getChildView("reload")->setEnabled(TRUE); -} - -//static -void LLFloaterWebContent::onClickRefresh(void* user_data) -{ - LLFloaterWebContent* self = (LLFloaterWebContent*)user_data; - - self->mWebBrowser->navigateTo(self->mCurrentURL); -} - -//static -void LLFloaterWebContent::onClickForward(void* user_data) -{ - LLFloaterWebContent* self = (LLFloaterWebContent*)user_data; - - self->mWebBrowser->navigateForward(); -} - -//static -void LLFloaterWebContent::onClickBack(void* user_data) -{ - LLFloaterWebContent* self = (LLFloaterWebContent*)user_data; - - self->mWebBrowser->navigateBack(); -} - -//static -void LLFloaterWebContent::onClickGo(void* user_data) -{ -// LLFloaterWebContent* self = (LLFloaterWebContent*)user_data; - -// self->mWebBrowser->navigateTo(self->mAddressCombo->getValue().asString()); -} +/**
+ * @file llfloaterwebcontent.cpp
+ * @brief floater for displaying web content - e.g. profiles and search (eventually)
+ *
+ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llcombobox.h"
+#include "llfloaterreg.h"
+#include "lllayoutstack.h"
+#include "llpluginclassmedia.h"
+#include "llprogressbar.h"
+#include "lltextbox.h"
+#include "llviewercontrol.h"
+#include "llwindow.h"
+
+#include "llfloaterwebcontent.h"
+
+LLFloaterWebContent::LLFloaterWebContent(const LLSD& key)
+ : LLFloater(key)
+{
+ mCommitCallbackRegistrar.add("WebContent.Back", boost::bind( &LLFloaterWebContent::onClickBack, this));
+ mCommitCallbackRegistrar.add("WebContent.Forward", boost::bind( &LLFloaterWebContent::onClickForward, this));
+ mCommitCallbackRegistrar.add("WebContent.Reload", boost::bind( &LLFloaterWebContent::onClickReload, this));
+
+ mCommitCallbackRegistrar.add("WebContent.EnterAddress", boost::bind( &LLFloaterWebContent::onEnterAddress, this));
+ mCommitCallbackRegistrar.add("WebContent.Go", boost::bind( &LLFloaterWebContent::onClickGo, this));
+}
+
+BOOL LLFloaterWebContent::postBuild()
+{
+ // these are used in a bunch of places so cache them
+ mWebBrowser = getChild<LLMediaCtrl>("webbrowser");
+ mAddressCombo = getChild<LLComboBox>("address");
+ mStatusBarText = getChild<LLTextBox>("statusbartext");
+ mStatusBarProgress = getChild<LLProgressBar>("statusbarprogress");
+
+ // observe browser events
+ mWebBrowser->addObserver(this);
+
+ // these button are always enabled
+ getChildView("reload")->setEnabled( true );
+ getChildView("go")->setEnabled( true );
+
+ return TRUE;
+}
+
+//static
+void LLFloaterWebContent::create(const std::string &url, const std::string& target, const std::string& uuid)
+{
+ lldebugs << "url = " << url << ", target = " << target << ", uuid = " << uuid << llendl;
+
+ std::string tag = target;
+
+ if(target.empty() || target == "_blank")
+ {
+ if(!uuid.empty())
+ {
+ tag = uuid;
+ }
+ else
+ {
+ // create a unique tag for this instance
+ LLUUID id;
+ id.generate();
+ tag = id.asString();
+ }
+ }
+
+ S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
+
+ if(LLFloaterReg::findInstance("web_content", tag) != NULL)
+ {
+ // There's already a web browser for this tag, so we won't be opening a new window.
+ }
+ else if(browser_window_limit != 0)
+ {
+ // showInstance will open a new window. Figure out how many web browsers are already open,
+ // and close the least recently opened one if this will put us over the limit.
+
+ LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList("web_content");
+ lldebugs << "total instance count is " << instances.size() << llendl;
+
+ for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
+ {
+ lldebugs << " " << (*iter)->getKey() << llendl;
+ }
+
+ if(instances.size() >= (size_t)browser_window_limit)
+ {
+ // Destroy the least recently opened instance
+ (*instances.begin())->closeFloater();
+ }
+ }
+
+ LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*> (LLFloaterReg::showInstance("web_content", tag));
+ llassert(browser);
+ if(browser)
+ {
+ browser->mUUID = uuid;
+
+ // tell the browser instance to load the specified URL
+ browser->open_media(url, target);
+ LLViewerMedia::proxyWindowOpened(target, uuid);
+ }
+}
+
+//static
+void LLFloaterWebContent::closeRequest(const std::string &uuid)
+{
+ LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("web_content");
+ lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl;
+ for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
+ {
+ LLFloaterWebContent* i = dynamic_cast<LLFloaterWebContent*>(*iter);
+ lldebugs << " " << i->mUUID << llendl;
+ if (i && i->mUUID == uuid)
+ {
+ i->closeFloater(false);
+ return;
+ }
+ }
+}
+
+//static
+void LLFloaterWebContent::geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height)
+{
+ LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("web_content");
+ lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl;
+ for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
+ {
+ LLFloaterWebContent* i = dynamic_cast<LLFloaterWebContent*>(*iter);
+ lldebugs << " " << i->mUUID << llendl;
+ if (i && i->mUUID == uuid)
+ {
+ i->geometryChanged(x, y, width, height);
+ return;
+ }
+ }
+}
+
+void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height)
+{
+ // Make sure the layout of the browser control is updated, so this calculation is correct.
+ LLLayoutStack::updateClass();
+
+ // TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc.
+ LLCoordWindow window_size;
+ getWindow()->getSize(&window_size);
+
+ // Adjust width and height for the size of the chrome on the web Browser window.
+ width += getRect().getWidth() - mWebBrowser->getRect().getWidth();
+ height += getRect().getHeight() - mWebBrowser->getRect().getHeight();
+
+ LLRect geom;
+ geom.setOriginAndSize(x, window_size.mY - (y + height), width, height);
+
+ lldebugs << "geometry change: " << geom << llendl;
+
+ handleReshape(geom,false);
+}
+
+void LLFloaterWebContent::open_media(const std::string& web_url, const std::string& target)
+{
+ mWebBrowser->setHomePageUrl(web_url);
+ mWebBrowser->setTarget(target);
+ mWebBrowser->navigateTo(web_url);
+ set_current_url(web_url);
+}
+
+//virtual
+void LLFloaterWebContent::onClose(bool app_quitting)
+{
+ LLViewerMedia::proxyWindowClosed(mUUID);
+ destroy();
+}
+
+void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
+{
+ if(event == MEDIA_EVENT_LOCATION_CHANGED)
+ {
+ const std::string url = self->getStatusText();
+
+ if ( url.length() )
+ mStatusBarText->setText( url );
+
+ set_current_url( url );
+ }
+ else if(event == MEDIA_EVENT_NAVIGATE_BEGIN)
+ {
+ // flags are sent with this event
+ getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
+ getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
+
+ // manually decide on the state of this button
+ getChildView("stop")->setEnabled( true );
+
+ // turn "on" progress bar now we're loaded
+ mStatusBarProgress->setVisible( true );
+ }
+ else if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
+ {
+ // flags are sent with this event
+ getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
+ getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
+
+ // manually decide on the state of this button
+ getChildView("stop")->setEnabled( false );
+
+ // turn "off" progress bar now we're loaded
+ mStatusBarProgress->setVisible( false );
+ }
+ else if(event == MEDIA_EVENT_CLOSE_REQUEST)
+ {
+ // The browser instance wants its window closed.
+ closeFloater();
+ }
+ else if(event == MEDIA_EVENT_GEOMETRY_CHANGE)
+ {
+ geometryChanged(self->getGeometryX(), self->getGeometryY(), self->getGeometryWidth(), self->getGeometryHeight());
+ }
+ else if(event == MEDIA_EVENT_STATUS_TEXT_CHANGED )
+ {
+ const std::string text = self->getStatusText();
+ if ( text.length() )
+ mStatusBarText->setText( text );
+ }
+ else if(event == MEDIA_EVENT_PROGRESS_UPDATED )
+ {
+ int percent = (int)self->getProgressPercent();
+ mStatusBarProgress->setPercent( percent );
+ }
+ else if(event == MEDIA_EVENT_NAME_CHANGED )
+ {
+ std::string page_title = self->getMediaName();
+ setTitle( page_title );
+ }
+}
+
+void LLFloaterWebContent::set_current_url(const std::string& url)
+{
+ mCurrentURL = url;
+
+ // redirects will navigate momentarily to about:blank, don't add to history
+ if ( mCurrentURL != "about:blank" )
+ {
+ mAddressCombo->remove( mCurrentURL );
+ mAddressCombo->add( mCurrentURL );
+ mAddressCombo->selectByValue( mCurrentURL );
+ }
+}
+
+void LLFloaterWebContent::onClickForward()
+{
+ mWebBrowser->navigateForward();
+}
+
+void LLFloaterWebContent::onClickBack()
+{
+ mWebBrowser->navigateBack();
+}
+
+void LLFloaterWebContent::onClickReload()
+{
+ mAddressCombo->remove(0);
+
+ if( mWebBrowser->getMediaPlugin() )
+ {
+ bool ignore_cache = true;
+ mWebBrowser->getMediaPlugin()->browse_reload( ignore_cache );
+ };
+}
+
+void LLFloaterWebContent::onClickStop()
+{
+ if( mWebBrowser->getMediaPlugin() )
+ mWebBrowser->getMediaPlugin()->stop();
+}
+
+void LLFloaterWebContent::onEnterAddress()
+{
+ mWebBrowser->navigateTo( mAddressCombo->getValue().asString() );
+}
+
+void LLFloaterWebContent::onClickGo()
+{
+ mWebBrowser->navigateTo( mAddressCombo->getValue().asString() );
+}
diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h index 71346aa80e..b41da57a6f 100644 --- a/indra/newview/llfloaterwebcontent.h +++ b/indra/newview/llfloaterwebcontent.h @@ -1,71 +1,77 @@ -/** - * @file llfloaterwebcontent.h - * @brief floater for displaying web content - e.g. profiles and search (eventually) - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLFLOATERWEBCONTENT_H -#define LL_LLFLOATERWEBCONTENT_H - -#include "llfloater.h" -#include "llmediactrl.h" - -class LLMediaCtrl; - -class LLFloaterWebContent : - public LLFloater, - public LLViewerMediaObserver -{ -public: - LOG_CLASS(LLFloaterWebContent); - LLFloaterWebContent(const LLSD& key); - - static void create(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null); - - static void closeRequest(const std::string &uuid); - static void geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height); - void geometryChanged(S32 x, S32 y, S32 width, S32 height); - - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ void draw(); - - // inherited from LLViewerMediaObserver - /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); - - void openMedia(const std::string& media_url, const std::string& target); - void setCurrentURL(const std::string& url); - - static void onClickRefresh(void* user_data); - static void onClickBack(void* user_data); - static void onClickForward(void* user_data); - static void onClickGo(void* user_data); - -private: - LLMediaCtrl* mWebBrowser; - std::string mCurrentURL; - std::string mUUID; -}; - -#endif // LL_LLFLOATERWEBCONTENT_H - +/**
+ * @file llfloaterwebcontent.h
+ * @brief floater for displaying web content - e.g. profiles and search (eventually)
+ *
+ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATERWEBCONTENT_H
+#define LL_LLFLOATERWEBCONTENT_H
+
+#include "llfloater.h"
+#include "llmediactrl.h"
+
+class LLMediaCtrl;
+class LLComboBox;
+class LLTextBox;
+class LLProgressBar;
+
+class LLFloaterWebContent :
+ public LLFloater,
+ public LLViewerMediaObserver
+{
+public:
+ LOG_CLASS(LLFloaterWebContent);
+ LLFloaterWebContent(const LLSD& key);
+
+ static void create(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null);
+
+ static void closeRequest(const std::string &uuid);
+ static void geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height);
+ void geometryChanged(S32 x, S32 y, S32 width, S32 height);
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onClose(bool app_quitting);
+
+ // inherited from LLViewerMediaObserver
+ /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
+
+ void onClickBack();
+ void onClickForward();
+ void onClickReload();
+ void onClickStop();
+ void onEnterAddress();
+ void onClickGo();
+
+private:
+ void open_media(const std::string& media_url, const std::string& target);
+ void set_current_url(const std::string& url);
+
+ LLMediaCtrl* mWebBrowser;
+ LLComboBox* mAddressCombo;
+ LLTextBox* mStatusBarText;
+ LLProgressBar* mStatusBarProgress;
+ std::string mCurrentURL;
+ std::string mUUID;
+};
+
+#endif // LL_LLFLOATERWEBCONTENT_H
diff --git a/indra/newview/skins/default/xui/en/floater_web_content.xml b/indra/newview/skins/default/xui/en/floater_web_content.xml index 777c67261a..62df206360 100644 --- a/indra/newview/skins/default/xui/en/floater_web_content.xml +++ b/indra/newview/skins/default/xui/en/floater_web_content.xml @@ -1,124 +1,151 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<floater - legacy_header_height="18" - can_resize="true" - height="440" - layout="topleft" - min_height="140" - min_width="467" - name="floater_web_content" - help_topic="floater_web_content" - save_rect="true" - auto_tile="true" - title="WEB CONTENT" - width="820"> - <floater.string - name="home_page_url"> - http://www.secondlife.com - </floater.string> - <layout_stack - bottom="440" - follows="left|right|top|bottom" - layout="topleft" - left="10" - name="stack1" - orientation="vertical" - top="20" - width="800"> - <layout_panel - auto_resize="false" - default_tab_group="1" - height="20" - layout="topleft" - left="0" - min_height="20" - name="nav_controls" - top="400" - user_resize="false" - width="800"> - <button - follows="left|top" - height="20" - label="Back" - layout="topleft" - left="0" - name="back" - top="0" - width="55"> - <button.commit_callback - function="MediaBrowser.Back" /> - </button> - <button - follows="left|top" - height="20" - label="Forward" - layout="topleft" - left_pad="3" - name="forward" - top_delta="0" - width="68"> - <button.commit_callback - function="MediaBrowser.Forward" /> - </button> - <button - enabled="false" - follows="left|top" - height="20" - label="Reload" - layout="topleft" - left_pad="2" - name="reload" - top_delta="0" - width="70"> - <button.commit_callback - function="MediaBrowser.Refresh" /> - </button> - <combo_box - allow_text_entry="true" - follows="left|top|right" - tab_group="1" - height="20" - layout="topleft" - left_pad="5" - max_chars="1024" - name="address" - combo_editor.select_on_focus="true" - top_delta="0" - width="540"> - <combo_box.commit_callback - function="MediaBrowser.EnterAddress" /> - </combo_box> - <button - enabled="false" - follows="right|top" - height="20" - label="Go" - layout="topleft" - left_pad="5" - name="go" - top_delta="0" - width="55"> - <button.commit_callback - function="MediaBrowser.Go" /> - </button> - </layout_panel> - - <layout_panel - height="40" - layout="topleft" - left_delta="0" - name="external_controls" - top_delta="0" - user_resize="false" - width="540"> - <web_browser - bottom="-30" - follows="all" - layout="topleft" - left="0" - name="webbrowser" - top="0" - width="540" /> - </layout_panel> - </layout_stack> -</floater> +<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ legacy_header_height="18"
+ can_resize="true"
+ height="440"
+ layout="topleft"
+ min_height="140"
+ min_width="467"
+ name="floater_web_content"
+ help_topic="floater_web_content"
+ save_rect="true"
+ auto_tile="true"
+ title="WEB CONTENT"
+ width="820">
+ <layout_stack
+ bottom="440"
+ follows="left|right|top|bottom"
+ layout="topleft"
+ left="5"
+ name="stack1"
+ orientation="vertical"
+ top="20"
+ width="810">
+ <layout_panel
+ auto_resize="false"
+ default_tab_group="1"
+ height="20"
+ layout="topleft"
+ left="0"
+ min_height="20"
+ name="nav_controls"
+ top="400"
+ user_resize="false"
+ width="800">
+ <button
+ follows="left|top"
+ height="20"
+ label="Back"
+ layout="topleft"
+ left="0"
+ name="back"
+ top="0"
+ width="35">
+ <button.commit_callback
+ function="WebContent.Back" />
+ </button>
+ <button
+ follows="left|top"
+ height="20"
+ label="Forward"
+ layout="topleft"
+ left_pad="3"
+ name="forward"
+ top_delta="0"
+ width="35">
+ <button.commit_callback
+ function="WebContent.Forward" />
+ </button>
+ <button
+ enabled="false"
+ follows="left|top"
+ height="20"
+ label="Reload"
+ layout="topleft"
+ left_pad="2"
+ name="reload"
+ top_delta="0"
+ width="35">
+ <button.commit_callback
+ function="WebContent.Reload" />
+ </button>
+ <button
+ enabled="false"
+ follows="left|top"
+ height="20"
+ label="Stop"
+ layout="topleft"
+ left_pad="2"
+ name="stop"
+ top_delta="0"
+ width="35">
+ <button.commit_callback
+ function="WebContent.Stop" />
+ </button>
+ <combo_box
+ allow_text_entry="true"
+ follows="left|top|right"
+ tab_group="1"
+ height="20"
+ layout="topleft"
+ left_pad="5"
+ max_chars="1024"
+ name="address"
+ combo_editor.select_on_focus="true"
+ top_delta="0"
+ width="610">
+ <combo_box.commit_callback
+ function="WebContent.EnterAddress" />
+ </combo_box>
+ <button
+ enabled="false"
+ follows="right|top"
+ height="20"
+ label="Go"
+ layout="topleft"
+ left_pad="0"
+ name="go"
+ top_delta="0"
+ width="35">
+ <button.commit_callback
+ function="WebContent.Go" />
+ </button>
+ </layout_panel>
+ <layout_panel
+ height="40"
+ layout="topleft"
+ left_delta="0"
+ name="external_controls"
+ top_delta="0"
+ user_resize="false"
+ width="540">
+ <web_browser
+ bottom="-22"
+ follows="all"
+ layout="topleft"
+ left="0"
+ name="webbrowser"
+ top="0"
+ width="540" />
+ <text
+ type="string"
+ length="100"
+ follows="bottom|left"
+ height="20"
+ layout="topleft"
+ left_delta="0"
+ name="statusbartext"
+ top_pad="5"
+ width="452"/>
+ <progress_bar
+ color_bar="0.3 1.0 0.3 1"
+ follows="bottom|right"
+ height="16"
+ top_delta="-1"
+ left_pad="24"
+ layout="topleft"
+ name="statusbarprogress"
+ width="64"/>
+ </layout_panel>
+ </layout_stack>
+</floater>
diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp index f8483225d9..4a2272032b 100644 --- a/indra/test_apps/llplugintest/llmediaplugintest.cpp +++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp @@ -2223,7 +2223,7 @@ void LLMediaPluginTest::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e case MEDIA_EVENT_AUTH_REQUEST: { - std::cerr << "Media event: MEDIA_EVENT_AUTH_REQUEST, url " << self->getAuthURL() ", realm " << self->getAuthRealm() << std::endl; + //std::cerr << "Media event: MEDIA_EVENT_AUTH_REQUEST, url " << self->getAuthURL() ", realm " << self->getAuthRealm() << std::endl; // TODO: display an auth dialog self->sendAuthResponse(false, "", ""); |