aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelweb.cpp
diff options
context:
space:
mode:
authorArmin Weatherwax2010-06-14 12:04:49 +0200
committerArmin Weatherwax2010-09-23 15:38:25 +0200
commit35df5441d3e2789663532c948731aff3a1e04728 (patch)
treeac7674289784a5f96106ea507637055a8dada78a /linden/indra/newview/llpanelweb.cpp
parentChanged version to Experimental 2010.09.18 (diff)
downloadmeta-impy-35df5441d3e2789663532c948731aff3a1e04728.zip
meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.gz
meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.bz2
meta-impy-35df5441d3e2789663532c948731aff3a1e04728.tar.xz
llmediaplugins first step
Diffstat (limited to 'linden/indra/newview/llpanelweb.cpp')
-rw-r--r--linden/indra/newview/llpanelweb.cpp65
1 files changed, 17 insertions, 48 deletions
diff --git a/linden/indra/newview/llpanelweb.cpp b/linden/indra/newview/llpanelweb.cpp
index 38bb2d7..e2933f0 100644
--- a/linden/indra/newview/llpanelweb.cpp
+++ b/linden/indra/newview/llpanelweb.cpp
@@ -38,50 +38,23 @@
38// project includes 38// project includes
39#include "llcheckboxctrl.h" 39#include "llcheckboxctrl.h"
40#include "hippoGridManager.h" 40#include "hippoGridManager.h"
41#include "llmediamanager.h"
42#include "lluictrlfactory.h" 41#include "lluictrlfactory.h"
43#include "llviewercontrol.h" 42#include "llviewercontrol.h"
43#include "llviewermedia.h"
44#include "llviewerwindow.h" 44#include "llviewerwindow.h"
45#include "llpluginclassmedia.h"
45 46
46// helper functions for getting/freeing the web browser media 47// helper functions for getting/freeing the web browser media
47// if creating/destroying these is too slow, we'll need to create 48// if creating/destroying these is too slow, we'll need to create
48// a static member and update all our static callbacks 49// a static member and update all our static callbacks
49LLMediaBase *get_web_media() 50viewer_media_t get_web_media()
50{ 51{
51 LLMediaBase *media_source;
52 LLMediaManager *mgr = LLMediaManager::getInstance();
53
54 if (!mgr)
55 {
56 llwarns << "cannot get media manager" << llendl;
57 return NULL;
58 }
59 52
60 media_source = mgr->createSourceFromMimeType("http", "text/html" ); 53 viewer_media_t media_source = LLViewerMedia::newMediaImpl("", LLUUID::null, 0, 0, 0, 0, "text/html");
61 if ( !media_source )
62 {
63 llwarns << "media source create failed " << llendl;
64 return NULL;
65 }
66 54
67 return media_source; 55 return media_source;
68} 56}
69 57
70void free_web_media(LLMediaBase *media_source)
71{
72 if (!media_source)
73 return;
74
75 LLMediaManager *mgr = LLMediaManager::getInstance();
76 if (!mgr)
77 {
78 llwarns << "cannot get media manager" << llendl;
79 return;
80 }
81
82 mgr->destroySource(media_source);
83}
84
85LLPanelWeb::LLPanelWeb() 58LLPanelWeb::LLPanelWeb()
86{ 59{
87 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_web.xml"); 60 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_web.xml");
@@ -144,17 +117,16 @@ void LLPanelWeb::apply()
144 bool value = childGetValue("use_external_browser").asString() == "external" ? true : false; 117 bool value = childGetValue("use_external_browser").asString() == "external" ? true : false;
145 gSavedSettings.setBOOL("UseExternalBrowser", value); 118 gSavedSettings.setBOOL("UseExternalBrowser", value);
146 119
147 LLMediaBase *media_source = get_web_media(); 120 viewer_media_t media_source = get_web_media();
148 if (media_source) 121 if (media_source && media_source->hasMedia())
149 { 122 {
150 media_source->enableCookies(childGetValue("cookies_enabled")); 123 media_source->getMediaPlugin()->enable_cookies(childGetValue("cookies_enabled"));
151 124
152 bool proxy_enable = childGetValue("web_proxy_enabled"); 125 bool proxy_enable = childGetValue("web_proxy_enabled");
153 std::string proxy_address = childGetValue("web_proxy_editor"); 126 std::string proxy_address = childGetValue("web_proxy_editor");
154 int proxy_port = childGetValue("web_proxy_port"); 127 int proxy_port = childGetValue("web_proxy_port");
155 media_source->enableProxy(proxy_enable, proxy_address, proxy_port); 128 media_source->getMediaPlugin()->proxy_setup(proxy_enable, proxy_address, proxy_port);
156 } 129 }
157 free_web_media(media_source);
158} 130}
159 131
160void LLPanelWeb::cancel() 132void LLPanelWeb::cancel()
@@ -173,10 +145,9 @@ bool LLPanelWeb::callback_clear_browser_cache(const LLSD& notification, const LL
173 S32 option = LLNotification::getSelectedOption(notification, response); 145 S32 option = LLNotification::getSelectedOption(notification, response);
174 if ( option == 0 ) // YES 146 if ( option == 0 ) // YES
175 { 147 {
176 LLMediaBase *media_source = get_web_media(); 148 viewer_media_t media_source = get_web_media();
177 if (media_source) 149 if (media_source && media_source->hasMedia())
178 media_source->clearCache(); 150 media_source->getMediaPlugin()->clear_cache();
179 free_web_media(media_source);
180 } 151 }
181 return false; 152 return false;
182} 153}
@@ -193,10 +164,9 @@ bool LLPanelWeb::callback_clear_cookies(const LLSD& notification, const LLSD& re
193 S32 option = LLNotification::getSelectedOption(notification, response); 164 S32 option = LLNotification::getSelectedOption(notification, response);
194 if ( option == 0 ) // YES 165 if ( option == 0 ) // YES
195 { 166 {
196 LLMediaBase *media_source = get_web_media(); 167 viewer_media_t media_source = get_web_media();
197 if (media_source) 168 if (media_source && media_source->hasMedia())
198 media_source->clearCookies(); 169 media_source->getMediaPlugin()->clear_cookies();
199 free_web_media(media_source);
200 } 170 }
201 return false; 171 return false;
202} 172}
@@ -209,10 +179,9 @@ void LLPanelWeb::onCommitCookies(LLUICtrl* ctrl, void* data)
209 179
210 if (!self || !check) return; 180 if (!self || !check) return;
211 181
212 LLMediaBase *media_source = get_web_media(); 182 viewer_media_t media_source = get_web_media();
213 if (media_source) 183 if (media_source && media_source->hasMedia())
214 media_source->enableCookies(check->get()); 184 media_source->getMediaPlugin()->enable_cookies(check->get());
215 free_web_media(media_source);
216} 185}
217// static 186// static
218void LLPanelWeb::onCommitWebProxyEnabled(LLUICtrl* ctrl, void* data) 187void LLPanelWeb::onCommitWebProxyEnabled(LLUICtrl* ctrl, void* data)