diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llpanelweb.cpp | 71 |
1 files changed, 20 insertions, 51 deletions
diff --git a/linden/indra/newview/llpanelweb.cpp b/linden/indra/newview/llpanelweb.cpp index 38bb2d7..14df239 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 |
49 | LLMediaBase *get_web_media() | 50 | viewer_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 | ||
70 | void 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 | |||
85 | LLPanelWeb::LLPanelWeb() | 58 | LLPanelWeb::LLPanelWeb() |
86 | { | 59 | { |
87 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_web.xml"); | 60 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_web.xml"); |
@@ -95,7 +68,7 @@ BOOL LLPanelWeb::postBuild() | |||
95 | std::string value = gSavedSettings.getBOOL("UseExternalBrowser") ? "external" : "internal"; | 68 | std::string value = gSavedSettings.getBOOL("UseExternalBrowser") ? "external" : "internal"; |
96 | childSetValue("use_external_browser", value); | 69 | childSetValue("use_external_browser", value); |
97 | 70 | ||
98 | childSetValue("cookies_enabled", gSavedSettings.getBOOL("CookiesEnabled")); | 71 | childSetValue("cookies_enabled", gSavedSettings.getBOOL("BrowserCookiesEnabled")); |
99 | 72 | ||
100 | childSetValue("web_proxy_enabled", gSavedSettings.getBOOL("BrowserProxyEnabled")); | 73 | childSetValue("web_proxy_enabled", gSavedSettings.getBOOL("BrowserProxyEnabled")); |
101 | childSetValue("web_proxy_editor", gSavedSettings.getString("BrowserProxyAddress")); | 74 | childSetValue("web_proxy_editor", gSavedSettings.getString("BrowserProxyAddress")); |
@@ -128,7 +101,7 @@ LLPanelWeb::~LLPanelWeb() | |||
128 | 101 | ||
129 | void LLPanelWeb::apply() | 102 | void LLPanelWeb::apply() |
130 | { | 103 | { |
131 | gSavedSettings.setBOOL("CookiesEnabled", childGetValue("cookies_enabled")); | 104 | gSavedSettings.setBOOL("BrowserCookiesEnabled", childGetValue("cookies_enabled")); |
132 | gSavedSettings.setBOOL("BrowserProxyEnabled", childGetValue("web_proxy_enabled")); | 105 | gSavedSettings.setBOOL("BrowserProxyEnabled", childGetValue("web_proxy_enabled")); |
133 | gSavedSettings.setString("BrowserProxyAddress", childGetValue("web_proxy_editor")); | 106 | gSavedSettings.setString("BrowserProxyAddress", childGetValue("web_proxy_editor")); |
134 | gSavedSettings.setS32("BrowserProxyPort", childGetValue("web_proxy_port")); | 107 | gSavedSettings.setS32("BrowserProxyPort", childGetValue("web_proxy_port")); |
@@ -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 | ||
160 | void LLPanelWeb::cancel() | 132 | void 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 |
218 | void LLPanelWeb::onCommitWebProxyEnabled(LLUICtrl* ctrl, void* data) | 187 | void LLPanelWeb::onCommitWebProxyEnabled(LLUICtrl* ctrl, void* data) |
@@ -255,4 +224,4 @@ void LLPanelWeb::onClickClear(void* user_data) | |||
255 | { | 224 | { |
256 | LLPanelWeb* self = (LLPanelWeb*)user_data; | 225 | LLPanelWeb* self = (LLPanelWeb*)user_data; |
257 | self->childSetValue("world_search_editor","") ; | 226 | self->childSetValue("world_search_editor","") ; |
258 | } \ No newline at end of file | 227 | } |