diff options
Diffstat (limited to 'linden/indra/llmedia/llmediaimplllmozlib.cpp')
-rw-r--r-- | linden/indra/llmedia/llmediaimplllmozlib.cpp | 624 |
1 files changed, 0 insertions, 624 deletions
diff --git a/linden/indra/llmedia/llmediaimplllmozlib.cpp b/linden/indra/llmedia/llmediaimplllmozlib.cpp deleted file mode 100644 index 5b4b02e..0000000 --- a/linden/indra/llmedia/llmediaimplllmozlib.cpp +++ /dev/null | |||
@@ -1,624 +0,0 @@ | |||
1 | /** | ||
2 | * @file llmediaimplllmozlib.cpp | ||
3 | * @brief Example 2 of a media impl concrete class | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2007&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2007-2009, Linden Research, Inc. | ||
8 | * | ||
9 | * Second Life Viewer Source Code | ||
10 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
11 | * to you under the terms of the GNU General Public License, version 2.0 | ||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
16 | * | ||
17 | * There are special exceptions to the terms and conditions of the GPL as | ||
18 | * it is applied to this Source Code. View the full text of the exception | ||
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
20 | * online at | ||
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
22 | * | ||
23 | * By copying, modifying or distributing this software, you acknowledge | ||
24 | * that you have read and understood your obligations described above, | ||
25 | * and agree to abide by those obligations. | ||
26 | * | ||
27 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
29 | * COMPLETENESS OR PERFORMANCE. | ||
30 | * $/LicenseInfo$ | ||
31 | */ | ||
32 | |||
33 | #include "llmediaimplllmozlib.h" | ||
34 | |||
35 | #if LL_LLMOZLIB_ENABLED | ||
36 | |||
37 | #include "llmediaimplregister.h" | ||
38 | #include "llmediamanager.h" | ||
39 | |||
40 | #ifdef WIN32 | ||
41 | // platform specific includes needed before OpenGL header | ||
42 | #include <windows.h> | ||
43 | #include <GL/gl.h> | ||
44 | #elif defined(__APPLE__) | ||
45 | // framework-style include path when building on the Mac. | ||
46 | #include <OpenGL/gl.h> | ||
47 | #else // Assume this is linux | ||
48 | // Linux, MESA headers, but not necessarily assuming MESA runtime. | ||
49 | // quotes so we get libraries/.../GL/ version | ||
50 | #include "GL/gl.h" | ||
51 | #endif | ||
52 | |||
53 | |||
54 | #include <locale.h> | ||
55 | |||
56 | |||
57 | #include <iostream> | ||
58 | |||
59 | // register this impl with media manager factory | ||
60 | static LLMediaImplRegister sLLMediaImplLLMozLibReg( "LLMediaImplLLMozLib", new LLMediaImplLLMozLibMaker() ); | ||
61 | |||
62 | /////////////////////////////////////////////////////////////////////////////// | ||
63 | // | ||
64 | LLMediaImplLLMozLibMaker::LLMediaImplLLMozLibMaker() | ||
65 | { | ||
66 | // Register to handle the mime category | ||
67 | mMimeTypes.push_back( "image/svg+xml" ); | ||
68 | mMimeTypeCategories.push_back( "text" ); | ||
69 | #if !LL_QUICKTIME_ENABLED | ||
70 | mMimeTypeCategories.push_back( "image" ); | ||
71 | #endif | ||
72 | } | ||
73 | |||
74 | /////////////////////////////////////////////////////////////////////////////// | ||
75 | // | ||
76 | LLMediaImplLLMozLib::LLMediaImplLLMozLib() : | ||
77 | mBrowserWindowWidth( 800 ), | ||
78 | mBrowserWindowHeight( 600 ), | ||
79 | mMediaDataWidth( 0 ), | ||
80 | mMediaDataHeight( 0 ), | ||
81 | mWindowId( 0 ), | ||
82 | mNeedsUpdate( false ) | ||
83 | { | ||
84 | setRequestedMediaSize( mBrowserWindowWidth, mBrowserWindowHeight ); | ||
85 | |||
86 | setMediaDepth( 4 ); | ||
87 | } | ||
88 | |||
89 | //////////////////////////////////////////////////////////////////////////////// | ||
90 | // (static) super-initialization - called once at application startup | ||
91 | bool LLMediaImplLLMozLib::startup( LLMediaManagerData* init_data ) | ||
92 | { | ||
93 | |||
94 | // Yuck, Mozilla's GTK callbacks play with the locale - push/pop | ||
95 | // the locale to protect it, as exotic/non-C locales | ||
96 | // causes our code lots of general critical weirdness | ||
97 | // and crashness. (SL-35450) | ||
98 | static std::string saved_locale; | ||
99 | saved_locale = setlocale(LC_ALL, NULL); | ||
100 | |||
101 | |||
102 | bool result = LLMozLib::getInstance()->init( init_data->getBrowserApplicationDir(), | ||
103 | init_data->getBrowserComponentDir(), | ||
104 | init_data->getBrowserProfileDir(), | ||
105 | init_data->getBrowserParentWindow() ); | ||
106 | |||
107 | |||
108 | setlocale(LC_ALL, saved_locale.c_str() ); | ||
109 | |||
110 | |||
111 | return result; | ||
112 | } | ||
113 | |||
114 | //////////////////////////////////////////////////////////////////////////////// | ||
115 | // (static) super-uninitialization - called once at application closedown | ||
116 | bool LLMediaImplLLMozLib::closedown() | ||
117 | { | ||
118 | // name discrepancy - this reset actually shuts down LLMozLib | ||
119 | LLMozLib::getInstance()->reset(); | ||
120 | |||
121 | return true; | ||
122 | } | ||
123 | |||
124 | //////////////////////////////////////////////////////////////////////////////// | ||
125 | // (static) | ||
126 | bool LLMediaImplLLMozLib::setBrowserUserAgent(std::string user_agent) | ||
127 | { | ||
128 | // append special string to the embedded browser user agent string | ||
129 | LLMozLib::getInstance()->setBrowserAgentId(user_agent); | ||
130 | return true; | ||
131 | } | ||
132 | |||
133 | //////////////////////////////////////////////////////////////////////////////// | ||
134 | // virtual | ||
135 | bool LLMediaImplLLMozLib::init() | ||
136 | { | ||
137 | // if mWindowId is non-0, it's we already called init() and shouldn't call it again | ||
138 | // (::reset() will zero this value) | ||
139 | if ( mWindowId ) | ||
140 | return false; | ||
141 | |||
142 | #if defined(LL_LINUX) || defined(WIN32) | ||
143 | static std::string saved_locale; | ||
144 | saved_locale = setlocale(LC_ALL, NULL); | ||
145 | #endif // defined(LL_LINUX) || defined(WIN32) | ||
146 | |||
147 | mWindowId = LLMozLib::getInstance()->createBrowserWindow( mBrowserWindowWidth, mBrowserWindowHeight ); | ||
148 | |||
149 | LLMozLib::getInstance()->setSize( mWindowId, mBrowserWindowWidth, mBrowserWindowHeight ); | ||
150 | |||
151 | LLMozLib::getInstance()->setBackgroundColor( mWindowId, 0x00, 0x00, 0x00 ); | ||
152 | |||
153 | LLMozLib::getInstance()->addObserver( mWindowId, this ); | ||
154 | |||
155 | // plugins only work with some client-side hackery and they cause | ||
156 | // exception handling issues (DEV-10020) so we turn them off | ||
157 | LLMozLib::getInstance()->enablePlugins( false ); | ||
158 | |||
159 | // second life client needs the bitmap flipped | ||
160 | LLMozLib::getInstance()->flipWindow( mWindowId, true ); | ||
161 | |||
162 | // set media depth now we have created a browser window and know what it is | ||
163 | setMediaDepth( LLMozLib::getInstance()->getBrowserDepth( mWindowId ) ); | ||
164 | |||
165 | #if defined(LL_LINUX) || defined(WIN32) | ||
166 | setlocale(LC_ALL, saved_locale.c_str() ); | ||
167 | #endif // defined(LL_LINUX) || defined(WIN32) | ||
168 | |||
169 | return true; | ||
170 | } | ||
171 | |||
172 | //////////////////////////////////////////////////////////////////////////////// | ||
173 | // virtual | ||
174 | std::string LLMediaImplLLMozLib::getVersion() | ||
175 | { | ||
176 | std::string version_string = "[" + sLLMediaImplLLMozLibReg.getImplName() + "] - " + LLMozLib::getInstance()->getVersion(); | ||
177 | |||
178 | return version_string; | ||
179 | } | ||
180 | |||
181 | //////////////////////////////////////////////////////////////////////////////// | ||
182 | // virtual | ||
183 | bool LLMediaImplLLMozLib::set404RedirectUrl( std::string redirect_url ) | ||
184 | { | ||
185 | return LLMozLib::getInstance()->set404RedirectUrl( mWindowId, redirect_url ); | ||
186 | } | ||
187 | |||
188 | //////////////////////////////////////////////////////////////////////////////// | ||
189 | // virtual | ||
190 | |||
191 | bool LLMediaImplLLMozLib::clr404RedirectUrl() | ||
192 | { | ||
193 | return LLMozLib::getInstance()->clr404RedirectUrl( mWindowId ); | ||
194 | } | ||
195 | |||
196 | //////////////////////////////////////////////////////////////////////////////// | ||
197 | // virtual | ||
198 | bool LLMediaImplLLMozLib::setBackgroundColor( unsigned int red, unsigned int green, unsigned int blue ) const | ||
199 | { | ||
200 | return LLMozLib::getInstance()->setBackgroundColor( mWindowId, red, green, blue ); | ||
201 | } | ||
202 | |||
203 | //////////////////////////////////////////////////////////////////////////////// | ||
204 | // virtual | ||
205 | bool LLMediaImplLLMozLib::setCaretColor( unsigned int red, unsigned int green, unsigned int blue ) const | ||
206 | { | ||
207 | return LLMozLib::getInstance()->setCaretColor( mWindowId, red, green, blue ); | ||
208 | } | ||
209 | |||
210 | //////////////////////////////////////////////////////////////////////////////// | ||
211 | // virtual | ||
212 | bool LLMediaImplLLMozLib::navigateTo( const std::string url ) | ||
213 | { | ||
214 | // pass url to llmozlib | ||
215 | LLMozLib::getInstance()->navigateTo( mWindowId, url ); | ||
216 | |||
217 | // emit event with size change to kick things off | ||
218 | LLMediaEvent event( this ); | ||
219 | mEventEmitter.update( &LLMediaObserver::onMediaSizeChange, event ); | ||
220 | |||
221 | // not that useful right now but maybe later | ||
222 | return true; | ||
223 | } | ||
224 | |||
225 | //////////////////////////////////////////////////////////////////////////////// | ||
226 | // virtual | ||
227 | bool LLMediaImplLLMozLib::updateMedia() | ||
228 | { | ||
229 | if ( getStatus() == LLMediaBase::STATUS_STARTED ) | ||
230 | { | ||
231 | // if flag set, the page changed and we need to update | ||
232 | if ( mNeedsUpdate ) | ||
233 | { | ||
234 | // snap browser pixels | ||
235 | LLMozLib::getInstance()->grabBrowserWindow( mWindowId ); | ||
236 | |||
237 | // update media width - rendering the page can change it | ||
238 | mMediaDataWidth = LLMozLib::getInstance()->getBrowserRowSpan( mWindowId ) / getMediaDepth(); | ||
239 | mMediaDataHeight = LLMozLib::getInstance()->getBrowserHeight( mWindowId ); | ||
240 | |||
241 | // emit an event to say that something in the media stream changed | ||
242 | LLMediaEvent event( this ); | ||
243 | mEventEmitter.update( &LLMediaObserver::onMediaContentsChange, event ); | ||
244 | |||
245 | // flag that we've done the update and one isn't needed next frame | ||
246 | mNeedsUpdate = false; | ||
247 | }; | ||
248 | }; | ||
249 | |||
250 | // update the state (e.g. transport controls) state | ||
251 | updateState(); | ||
252 | |||
253 | return false; | ||
254 | } | ||
255 | |||
256 | //////////////////////////////////////////////////////////////////////////////// | ||
257 | // | ||
258 | bool LLMediaImplLLMozLib::updateState() | ||
259 | { | ||
260 | if ( nextCommand() == LLMediaBase::COMMAND_START ) | ||
261 | { | ||
262 | setStatus( LLMediaBase::STATUS_STARTED ); | ||
263 | clearCommand(); | ||
264 | }; | ||
265 | |||
266 | if ( nextCommand() == LLMediaBase::COMMAND_STOP ) | ||
267 | { | ||
268 | setStatus( LLMediaBase::STATUS_STOPPED ); | ||
269 | clearCommand(); | ||
270 | }; | ||
271 | |||
272 | if ( nextCommand() == LLMediaBase::COMMAND_BACK ) | ||
273 | { | ||
274 | setStatus( LLMediaBase::STATUS_STARTED ); | ||
275 | LLMozLib::getInstance()->navigateBack( mWindowId ); | ||
276 | clearCommand(); | ||
277 | }; | ||
278 | |||
279 | if ( nextCommand() == LLMediaBase::COMMAND_FORWARD ) | ||
280 | { | ||
281 | setStatus( LLMediaBase::STATUS_STARTED ); | ||
282 | LLMozLib::getInstance()->navigateForward( mWindowId ); | ||
283 | clearCommand(); | ||
284 | }; | ||
285 | |||
286 | return true; | ||
287 | } | ||
288 | |||
289 | //////////////////////////////////////////////////////////////////////////////// | ||
290 | // virtual | ||
291 | void LLMediaImplLLMozLib::onPageChanged( const EventType& eventIn ) | ||
292 | { | ||
293 | // force an update when the contents of the page changes | ||
294 | mNeedsUpdate = true; | ||
295 | } | ||
296 | |||
297 | //////////////////////////////////////////////////////////////////////////////// | ||
298 | // virtual | ||
299 | void LLMediaImplLLMozLib::onClickLinkHref( const EventType& eventIn ) | ||
300 | { | ||
301 | LLMediaEvent event( this, eventIn.getStringValue(), eventIn.getStringValue2() ); | ||
302 | mEventEmitter.update( &LLMediaObserver::onClickLinkHref, event ); | ||
303 | } | ||
304 | |||
305 | //////////////////////////////////////////////////////////////////////////////// | ||
306 | // virtual | ||
307 | void LLMediaImplLLMozLib::onClickLinkNoFollow( const EventType& eventIn ) | ||
308 | { | ||
309 | LLMediaEvent event( this, eventIn.getStringValue() ); | ||
310 | mEventEmitter.update( &LLMediaObserver::onClickLinkNoFollow, event ); | ||
311 | } | ||
312 | |||
313 | //////////////////////////////////////////////////////////////////////////////// | ||
314 | // virtual | ||
315 | void LLMediaImplLLMozLib::onUpdateProgress( const EventType& eventIn ) | ||
316 | { | ||
317 | LLMediaEvent event( this, eventIn.getIntValue() ); | ||
318 | mEventEmitter.update( &LLMediaObserver::onUpdateProgress, event ); | ||
319 | } | ||
320 | |||
321 | //////////////////////////////////////////////////////////////////////////////// | ||
322 | // virtual | ||
323 | void LLMediaImplLLMozLib::onStatusTextChange( const EventType& eventIn ) | ||
324 | { | ||
325 | LLMediaEvent event( this, eventIn.getStringValue() ); | ||
326 | mEventEmitter.update( &LLMediaObserver::onStatusTextChange, event ); | ||
327 | } | ||
328 | |||
329 | //////////////////////////////////////////////////////////////////////////////// | ||
330 | // virtual | ||
331 | void LLMediaImplLLMozLib::onLocationChange( const EventType& eventIn ) | ||
332 | { | ||
333 | LLMediaEvent event( this, eventIn.getEventUri() ); | ||
334 | mEventEmitter.update( &LLMediaObserver::onLocationChange, event ); | ||
335 | } | ||
336 | |||
337 | //////////////////////////////////////////////////////////////////////////////// | ||
338 | // virtual | ||
339 | void LLMediaImplLLMozLib::onNavigateBegin( const EventType& eventIn ) | ||
340 | { | ||
341 | LLMediaEvent event( this, eventIn.getEventUri() ); | ||
342 | mEventEmitter.update( &LLMediaObserver::onNavigateBegin, event ); | ||
343 | } | ||
344 | |||
345 | //////////////////////////////////////////////////////////////////////////////// | ||
346 | // virtual | ||
347 | void LLMediaImplLLMozLib::onNavigateComplete( const EventType& eventIn ) | ||
348 | { | ||
349 | // force an update when the page is finished | ||
350 | mNeedsUpdate = true; | ||
351 | |||
352 | // pass in url and HTML response code (200/404 etc.) | ||
353 | LLMediaEvent event( this, eventIn.getEventUri(), eventIn.getIntValue() ); | ||
354 | mEventEmitter.update( &LLMediaObserver::onNavigateComplete, event ); | ||
355 | } | ||
356 | |||
357 | //////////////////////////////////////////////////////////////////////////////// | ||
358 | // virtual | ||
359 | unsigned char* LLMediaImplLLMozLib::getMediaData() | ||
360 | { | ||
361 | return (unsigned char*)LLMozLib::getInstance()->getBrowserWindowPixels( mWindowId ); | ||
362 | } | ||
363 | |||
364 | // helper func to compute size of media data | ||
365 | bool LLMediaImplLLMozLib::recomputeSizes() | ||
366 | { | ||
367 | int new_width = mMediaRequestedWidth; | ||
368 | int new_height = mMediaRequestedHeight; | ||
369 | |||
370 | if (new_width < 0) | ||
371 | new_width = 512; | ||
372 | |||
373 | if (new_height < 0) | ||
374 | new_height = 512; | ||
375 | |||
376 | if (mAutoScaled) | ||
377 | { | ||
378 | new_width = LLMediaManager::textureWidthFromMediaWidth( new_width ); | ||
379 | new_height = LLMediaManager::textureHeightFromMediaHeight( new_height ); | ||
380 | } | ||
381 | |||
382 | bool status = LLMozLib::getInstance()->setSize( mWindowId, new_width, new_height ); | ||
383 | |||
384 | if (status) | ||
385 | setMediaSize(new_width, new_height); | ||
386 | |||
387 | return status; | ||
388 | } | ||
389 | |||
390 | |||
391 | //////////////////////////////////////////////////////////////////////////////// | ||
392 | // virtual | ||
393 | int LLMediaImplLLMozLib::getMediaDataWidth() const | ||
394 | { | ||
395 | return mMediaDataWidth; | ||
396 | } | ||
397 | |||
398 | //////////////////////////////////////////////////////////////////////////////// | ||
399 | // virtual | ||
400 | int LLMediaImplLLMozLib::getMediaDataHeight() const | ||
401 | { | ||
402 | return mMediaDataHeight; | ||
403 | } | ||
404 | |||
405 | //////////////////////////////////////////////////////////////////////////////// | ||
406 | // virtual | ||
407 | bool LLMediaImplLLMozLib::setRequestedMediaSize(int width, int height) | ||
408 | { | ||
409 | LLMediaImplCommon::setRequestedMediaSize(width, height); | ||
410 | |||
411 | return recomputeSizes(); | ||
412 | } | ||
413 | |||
414 | //////////////////////////////////////////////////////////////////////////////// | ||
415 | // virtual | ||
416 | bool LLMediaImplLLMozLib::setAutoScaled( bool auto_scaled ) | ||
417 | { | ||
418 | LLMediaImplCommon::setAutoScaled(auto_scaled); | ||
419 | |||
420 | return recomputeSizes(); | ||
421 | } | ||
422 | |||
423 | |||
424 | //////////////////////////////////////////////////////////////////////////////// | ||
425 | // virtual | ||
426 | int LLMediaImplLLMozLib::getTextureFormatPrimary() const | ||
427 | { | ||
428 | #if defined(__APPLE__) || defined(MACOSX) | ||
429 | return GL_BGRA_EXT; | ||
430 | #else | ||
431 | return LLMozLib::getInstance()->getBrowserDepth( mWindowId ) == 3 ? GL_BGR_EXT : GL_BGRA_EXT; | ||
432 | #endif | ||
433 | } | ||
434 | |||
435 | //////////////////////////////////////////////////////////////////////////////// | ||
436 | // virtual | ||
437 | int LLMediaImplLLMozLib::getTextureFormatType() const | ||
438 | { | ||
439 | #if defined(__APPLE__) || defined(MACOSX) | ||
440 | #ifdef __BIG_ENDIAN__ | ||
441 | return GL_UNSIGNED_INT_8_8_8_8_REV; | ||
442 | #else | ||
443 | return GL_UNSIGNED_INT_8_8_8_8; | ||
444 | #endif | ||
445 | #else | ||
446 | return GL_UNSIGNED_BYTE; | ||
447 | #endif | ||
448 | } | ||
449 | |||
450 | //////////////////////////////////////////////////////////////////////////////// | ||
451 | // virtual | ||
452 | bool LLMediaImplLLMozLib::mouseDown( int x_pos, int y_pos ) | ||
453 | { | ||
454 | return LLMozLib::getInstance()->mouseDown( mWindowId, x_pos, y_pos ); | ||
455 | } | ||
456 | |||
457 | //////////////////////////////////////////////////////////////////////////////// | ||
458 | // virtual | ||
459 | bool LLMediaImplLLMozLib::mouseUp( int x_pos, int y_pos ) | ||
460 | { | ||
461 | LLMozLib::getInstance()->mouseUp( mWindowId, x_pos, y_pos ); | ||
462 | |||
463 | // this seems better than sending focus on mouse down (still need to improve this) | ||
464 | LLMozLib::getInstance()->focusBrowser( mWindowId, true ); | ||
465 | |||
466 | return true; | ||
467 | } | ||
468 | |||
469 | //////////////////////////////////////////////////////////////////////////////// | ||
470 | // virtual | ||
471 | bool LLMediaImplLLMozLib::mouseMove( int x_pos, int y_pos ) | ||
472 | { | ||
473 | return LLMozLib::getInstance()->mouseMove( mWindowId, x_pos, y_pos ); | ||
474 | } | ||
475 | |||
476 | //////////////////////////////////////////////////////////////////////////////// | ||
477 | // virtual | ||
478 | bool LLMediaImplLLMozLib::keyPress( int key_code ) | ||
479 | { | ||
480 | // We don't have to deal with printable characters here - they should | ||
481 | // go through handleUnicodeChar(). This table could be more complete | ||
482 | // than it is, but I think this covers all of the important | ||
483 | // non-printables. | ||
484 | |||
485 | unsigned long moz_key; | ||
486 | |||
487 | switch(key_code) | ||
488 | { | ||
489 | case LL_MEDIA_KEY_BACKSPACE: | ||
490 | moz_key = LL_DOM_VK_BACK_SPACE; break; | ||
491 | case LL_MEDIA_KEY_TAB: | ||
492 | moz_key = LL_DOM_VK_TAB; break; | ||
493 | case LL_MEDIA_KEY_RETURN: | ||
494 | moz_key = LL_DOM_VK_RETURN; break; | ||
495 | case LL_MEDIA_KEY_PAD_RETURN: | ||
496 | moz_key = LL_DOM_VK_ENTER; break; | ||
497 | case LL_MEDIA_KEY_ESCAPE: | ||
498 | moz_key = LL_DOM_VK_ESCAPE; break; | ||
499 | case LL_MEDIA_KEY_PAGE_UP: | ||
500 | moz_key = LL_DOM_VK_PAGE_UP; break; | ||
501 | case LL_MEDIA_KEY_PAGE_DOWN: | ||
502 | moz_key = LL_DOM_VK_PAGE_DOWN; break; | ||
503 | case LL_MEDIA_KEY_END: | ||
504 | moz_key = LL_DOM_VK_END; break; | ||
505 | case LL_MEDIA_KEY_HOME: | ||
506 | moz_key = LL_DOM_VK_HOME; break; | ||
507 | case LL_MEDIA_KEY_LEFT: | ||
508 | moz_key = LL_DOM_VK_LEFT; break; | ||
509 | case LL_MEDIA_KEY_UP: | ||
510 | moz_key = LL_DOM_VK_UP; break; | ||
511 | case LL_MEDIA_KEY_RIGHT: | ||
512 | moz_key = LL_DOM_VK_RIGHT; break; | ||
513 | case LL_MEDIA_KEY_DOWN: | ||
514 | moz_key = LL_DOM_VK_DOWN; break; | ||
515 | case LL_MEDIA_KEY_INSERT: | ||
516 | moz_key = LL_DOM_VK_INSERT; break; | ||
517 | case LL_MEDIA_KEY_DELETE: | ||
518 | moz_key = LL_DOM_VK_DELETE; break; | ||
519 | |||
520 | default: | ||
521 | return false; // don't know how to map this key. | ||
522 | } | ||
523 | |||
524 | return LLMozLib::getInstance()->keyPress( mWindowId, moz_key ); | ||
525 | } | ||
526 | |||
527 | //////////////////////////////////////////////////////////////////////////////// | ||
528 | // virtual | ||
529 | bool LLMediaImplLLMozLib::scrollByLines( int lines ) | ||
530 | { | ||
531 | return LLMozLib::getInstance()->scrollByLines(mWindowId, lines); | ||
532 | } | ||
533 | |||
534 | //////////////////////////////////////////////////////////////////////////////// | ||
535 | // virtual | ||
536 | bool LLMediaImplLLMozLib::focus( bool focus ) | ||
537 | { | ||
538 | return LLMozLib::getInstance()->focusBrowser(mWindowId, focus); | ||
539 | } | ||
540 | |||
541 | //////////////////////////////////////////////////////////////////////////////// | ||
542 | // virtual | ||
543 | bool LLMediaImplLLMozLib::unicodeInput( unsigned long uni_char ) | ||
544 | { | ||
545 | return LLMozLib::getInstance()->unicodeInput(mWindowId, uni_char); | ||
546 | } | ||
547 | |||
548 | //////////////////////////////////////////////////////////////////////////////// | ||
549 | // virtual | ||
550 | bool LLMediaImplLLMozLib::mouseLeftDoubleClick( int x_pos, int y_pos ) | ||
551 | { | ||
552 | return LLMozLib::getInstance()->mouseLeftDoubleClick( mWindowId, x_pos, y_pos ); | ||
553 | } | ||
554 | |||
555 | //////////////////////////////////////////////////////////////////////////////// | ||
556 | // virtual | ||
557 | bool LLMediaImplLLMozLib::navigateForward() | ||
558 | { | ||
559 | return LLMozLib::getInstance()->navigateForward(mWindowId); | ||
560 | } | ||
561 | |||
562 | //////////////////////////////////////////////////////////////////////////////// | ||
563 | // virtual | ||
564 | bool LLMediaImplLLMozLib::navigateBack() | ||
565 | { | ||
566 | return LLMozLib::getInstance()->navigateBack(mWindowId); | ||
567 | } | ||
568 | |||
569 | //////////////////////////////////////////////////////////////////////////////// | ||
570 | // virtual | ||
571 | bool LLMediaImplLLMozLib::canNavigateForward() | ||
572 | { | ||
573 | return LLMozLib::getInstance()->canNavigateForward(mWindowId); | ||
574 | } | ||
575 | |||
576 | //////////////////////////////////////////////////////////////////////////////// | ||
577 | // virtual | ||
578 | bool LLMediaImplLLMozLib::canNavigateBack() | ||
579 | { | ||
580 | return LLMozLib::getInstance()->canNavigateBack(mWindowId); | ||
581 | } | ||
582 | |||
583 | //////////////////////////////////////////////////////////////////////////////// | ||
584 | // virtual | ||
585 | bool LLMediaImplLLMozLib::enableCookies(bool enable) | ||
586 | { | ||
587 | return LLMozLib::getInstance()->enableCookies(enable); | ||
588 | } | ||
589 | |||
590 | //////////////////////////////////////////////////////////////////////////////// | ||
591 | // virtual | ||
592 | bool LLMediaImplLLMozLib::enableProxy(bool enable, std::string proxy_host_name, int proxy_port) | ||
593 | { | ||
594 | return LLMozLib::getInstance()->enableProxy(enable, proxy_host_name, proxy_port); | ||
595 | } | ||
596 | |||
597 | //////////////////////////////////////////////////////////////////////////////// | ||
598 | // virtual | ||
599 | bool LLMediaImplLLMozLib::clearCache() | ||
600 | { | ||
601 | return LLMozLib::getInstance()->clearCache(); | ||
602 | } | ||
603 | |||
604 | //////////////////////////////////////////////////////////////////////////////// | ||
605 | // virtual | ||
606 | bool LLMediaImplLLMozLib::clearCookies() | ||
607 | { | ||
608 | return LLMozLib::getInstance()->clearAllCookies(); | ||
609 | } | ||
610 | |||
611 | //////////////////////////////////////////////////////////////////////////////// | ||
612 | // virtual | ||
613 | bool LLMediaImplLLMozLib::reset() | ||
614 | { | ||
615 | LLMozLib::getInstance()->remObserver( mWindowId, this ); | ||
616 | |||
617 | LLMozLib::getInstance()->destroyBrowserWindow( mWindowId ); | ||
618 | |||
619 | mWindowId = 0; | ||
620 | |||
621 | return true; | ||
622 | } | ||
623 | |||
624 | #endif // LL_LLMOZLIB_ENABLED | ||