Home | History | Annotate | Download | only in WebCoreSupport
      1 /*
      2  * Copyright (C) 2007 Staikos Computing Services Inc. <info (at) staikos.net>
      3  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
      4  * Copyright (C) 2008 Collabora Ltd. All rights reserved.
      5  * Copyright (C) 2010 Apple Inc. All rights reserved.
      6  * Copyright (C) 2010 INdT - Instituto Nokia de Tecnologia
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  *
     17  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
     18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     19  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     20  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
     21  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     27  * THE POSSIBILITY OF SUCH DAMAGE.
     28  */
     29 
     30 #include "config.h"
     31 #include "WebPlatformStrategies.h"
     32 
     33 #include "Chrome.h"
     34 #include "ChromeClientQt.h"
     35 #include <IntSize.h>
     36 #include "NotImplemented.h"
     37 #include <Page.h>
     38 #include <PageGroup.h>
     39 #include <PluginDatabase.h>
     40 #include <QCoreApplication>
     41 #include <QLocale>
     42 #include <qwebpage.h>
     43 #include <qwebpluginfactory.h>
     44 #include <wtf/MathExtras.h>
     45 
     46 using namespace WebCore;
     47 
     48 void WebPlatformStrategies::initialize()
     49 {
     50     DEFINE_STATIC_LOCAL(WebPlatformStrategies, platformStrategies, ());
     51     Q_UNUSED(platformStrategies);
     52 }
     53 
     54 WebPlatformStrategies::WebPlatformStrategies()
     55 {
     56     setPlatformStrategies(this);
     57 }
     58 
     59 
     60 CookiesStrategy* WebPlatformStrategies::createCookiesStrategy()
     61 {
     62     return this;
     63 }
     64 
     65 PluginStrategy* WebPlatformStrategies::createPluginStrategy()
     66 {
     67     return this;
     68 }
     69 
     70 LocalizationStrategy* WebPlatformStrategies::createLocalizationStrategy()
     71 {
     72     return this;
     73 }
     74 
     75 VisitedLinkStrategy* WebPlatformStrategies::createVisitedLinkStrategy()
     76 {
     77     return this;
     78 }
     79 
     80 void WebPlatformStrategies::notifyCookiesChanged()
     81 {
     82 }
     83 
     84 void WebPlatformStrategies::refreshPlugins()
     85 {
     86     PluginDatabase::installedPlugins()->refresh();
     87 }
     88 
     89 void WebPlatformStrategies::getPluginInfo(const WebCore::Page* page, Vector<WebCore::PluginInfo>& outPlugins)
     90 {
     91     QWebPage* qPage = static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage;
     92     QWebPluginFactory* factory;
     93     if (qPage && (factory = qPage->pluginFactory())) {
     94 
     95         QList<QWebPluginFactory::Plugin> qplugins = factory->plugins();
     96         for (int i = 0; i < qplugins.count(); ++i) {
     97             const QWebPluginFactory::Plugin& qplugin = qplugins.at(i);
     98             PluginInfo info;
     99             info.name = qplugin.name;
    100             info.desc = qplugin.description;
    101 
    102             for (int j = 0; j < qplugin.mimeTypes.count(); ++j) {
    103                 const QWebPluginFactory::MimeType& mimeType = qplugin.mimeTypes.at(j);
    104 
    105                 MimeClassInfo mimeInfo;
    106                 mimeInfo.type = mimeType.name;
    107                 mimeInfo.desc = mimeType.description;
    108                 for (int k = 0; k < mimeType.fileExtensions.count(); ++k)
    109                   mimeInfo.extensions.append(mimeType.fileExtensions.at(k));
    110 
    111                 info.mimes.append(mimeInfo);
    112             }
    113             outPlugins.append(info);
    114         }
    115     }
    116 
    117     PluginDatabase* db = PluginDatabase::installedPlugins();
    118     const Vector<PluginPackage*> &plugins = db->plugins();
    119 
    120     outPlugins.resize(plugins.size());
    121 
    122     for (unsigned int i = 0; i < plugins.size(); ++i) {
    123         PluginInfo info;
    124         PluginPackage* package = plugins[i];
    125 
    126         info.name = package->name();
    127         info.file = package->fileName();
    128         info.desc = package->description();
    129 
    130         const MIMEToDescriptionsMap& mimeToDescriptions = package->mimeToDescriptions();
    131         MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end();
    132         for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) {
    133             MimeClassInfo mime;
    134 
    135             mime.type = it->first;
    136             mime.desc = it->second;
    137             mime.extensions = package->mimeToExtensions().get(mime.type);
    138 
    139             info.mimes.append(mime);
    140         }
    141 
    142         outPlugins.append(info);
    143     }
    144 
    145 }
    146 
    147 
    148 // LocalizationStrategy
    149 
    150 String WebPlatformStrategies::inputElementAltText()
    151 {
    152     return QCoreApplication::translate("QWebPage", "Submit", "Submit (input element) alt text for <input> elements with no alt, title, or value");
    153 }
    154 
    155 String WebPlatformStrategies::resetButtonDefaultLabel()
    156 {
    157     return QCoreApplication::translate("QWebPage", "Reset", "default label for Reset buttons in forms on web pages");
    158 }
    159 
    160 String WebPlatformStrategies::searchableIndexIntroduction()
    161 {
    162     return QCoreApplication::translate("QWebPage", "This is a searchable index. Enter search keywords: ", "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'");
    163 }
    164 
    165 String WebPlatformStrategies::submitButtonDefaultLabel()
    166 {
    167     return QCoreApplication::translate("QWebPage", "Submit", "default label for Submit buttons in forms on web pages");
    168 }
    169 
    170 String WebPlatformStrategies::fileButtonChooseFileLabel()
    171 {
    172     return QCoreApplication::translate("QWebPage", "Choose File", "title for file button used in HTML forms");
    173 }
    174 
    175 String WebPlatformStrategies::fileButtonNoFileSelectedLabel()
    176 {
    177     return QCoreApplication::translate("QWebPage", "No file selected", "text to display in file button used in HTML forms when no file is selected");
    178 }
    179 
    180 String WebPlatformStrategies::defaultDetailsSummaryText()
    181 {
    182     return QCoreApplication::translate("QWebPage", "Details", "text to display in <details> tag when it has no <summary> child");
    183 }
    184 
    185 String WebPlatformStrategies::contextMenuItemTagOpenLinkInNewWindow()
    186 {
    187     return QCoreApplication::translate("QWebPage", "Open in New Window", "Open in New Window context menu item");
    188 }
    189 
    190 String WebPlatformStrategies::contextMenuItemTagDownloadLinkToDisk()
    191 {
    192     return QCoreApplication::translate("QWebPage", "Save Link...", "Download Linked File context menu item");
    193 }
    194 
    195 String WebPlatformStrategies::contextMenuItemTagCopyLinkToClipboard()
    196 {
    197     return QCoreApplication::translate("QWebPage", "Copy Link", "Copy Link context menu item");
    198 }
    199 
    200 String WebPlatformStrategies::contextMenuItemTagOpenImageInNewWindow()
    201 {
    202     return QCoreApplication::translate("QWebPage", "Open Image", "Open Image in New Window context menu item");
    203 }
    204 
    205 String WebPlatformStrategies::contextMenuItemTagDownloadImageToDisk()
    206 {
    207     return QCoreApplication::translate("QWebPage", "Save Image", "Download Image context menu item");
    208 }
    209 
    210 String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard()
    211 {
    212     return QCoreApplication::translate("QWebPage", "Copy Image", "Copy Link context menu item");
    213 }
    214 
    215 String WebPlatformStrategies::contextMenuItemTagCopyImageUrlToClipboard()
    216 {
    217     return QCoreApplication::translate("QWebPage", "Copy Image Address", "Copy Image Address menu item");
    218 }
    219 
    220 String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow()
    221 {
    222     return QCoreApplication::translate("QWebPage", "Open Video", "Open Video in New Window");
    223 }
    224 
    225 String WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow()
    226 {
    227     return QCoreApplication::translate("QWebPage", "Open Audio", "Open Audio in New Window");
    228 }
    229 
    230 String WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard()
    231 {
    232     return QCoreApplication::translate("QWebPage", "Copy Video", "Copy Video Link Location");
    233 }
    234 
    235 String WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard()
    236 {
    237     return QCoreApplication::translate("QWebPage", "Copy Audio", "Copy Audio Link Location");
    238 }
    239 
    240 String WebPlatformStrategies::contextMenuItemTagToggleMediaControls()
    241 {
    242     return QCoreApplication::translate("QWebPage", "Toggle Controls", "Toggle Media Controls");
    243 }
    244 
    245 String WebPlatformStrategies::contextMenuItemTagToggleMediaLoop()
    246 {
    247     return QCoreApplication::translate("QWebPage", "Toggle Loop", "Toggle Media Loop Playback");
    248 }
    249 
    250 String WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen()
    251 {
    252     return QCoreApplication::translate("QWebPage", "Enter Fullscreen", "Switch Video to Fullscreen");
    253 }
    254 
    255 String WebPlatformStrategies::contextMenuItemTagMediaPlay()
    256 {
    257     return QCoreApplication::translate("QWebPage", "Play", "Play");
    258 }
    259 
    260 String WebPlatformStrategies::contextMenuItemTagMediaPause()
    261 {
    262     return QCoreApplication::translate("QWebPage", "Pause", "Pause");
    263 }
    264 
    265 String WebPlatformStrategies::contextMenuItemTagMediaMute()
    266 {
    267     return QCoreApplication::translate("QWebPage", "Mute", "Mute");
    268 }
    269 
    270 String WebPlatformStrategies::contextMenuItemTagOpenFrameInNewWindow()
    271 {
    272     return QCoreApplication::translate("QWebPage", "Open Frame", "Open Frame in New Window context menu item");
    273 }
    274 
    275 String WebPlatformStrategies::contextMenuItemTagCopy()
    276 {
    277     return QCoreApplication::translate("QWebPage", "Copy", "Copy context menu item");
    278 }
    279 
    280 String WebPlatformStrategies::contextMenuItemTagGoBack()
    281 {
    282     return QCoreApplication::translate("QWebPage", "Go Back", "Back context menu item");
    283 }
    284 
    285 String WebPlatformStrategies::contextMenuItemTagGoForward()
    286 {
    287     return QCoreApplication::translate("QWebPage", "Go Forward", "Forward context menu item");
    288 }
    289 
    290 String WebPlatformStrategies::contextMenuItemTagStop()
    291 {
    292     return QCoreApplication::translate("QWebPage", "Stop", "Stop context menu item");
    293 }
    294 
    295 String WebPlatformStrategies::contextMenuItemTagReload()
    296 {
    297     return QCoreApplication::translate("QWebPage", "Reload", "Reload context menu item");
    298 }
    299 
    300 String WebPlatformStrategies::contextMenuItemTagCut()
    301 {
    302     return QCoreApplication::translate("QWebPage", "Cut", "Cut context menu item");
    303 }
    304 
    305 String WebPlatformStrategies::contextMenuItemTagPaste()
    306 {
    307     return QCoreApplication::translate("QWebPage", "Paste", "Paste context menu item");
    308 }
    309 
    310 String WebPlatformStrategies::contextMenuItemTagSelectAll()
    311 {
    312     return QCoreApplication::translate("QWebPage", "Select All", "Select All context menu item");
    313 }
    314 
    315 String WebPlatformStrategies::contextMenuItemTagNoGuessesFound()
    316 {
    317     return QCoreApplication::translate("QWebPage", "No Guesses Found", "No Guesses Found context menu item");
    318 }
    319 
    320 String WebPlatformStrategies::contextMenuItemTagIgnoreSpelling()
    321 {
    322     return QCoreApplication::translate("QWebPage", "Ignore", "Ignore Spelling context menu item");
    323 }
    324 
    325 String WebPlatformStrategies::contextMenuItemTagLearnSpelling()
    326 {
    327     return QCoreApplication::translate("QWebPage", "Add To Dictionary", "Learn Spelling context menu item");
    328 }
    329 
    330 String WebPlatformStrategies::contextMenuItemTagSearchWeb()
    331 {
    332     return QCoreApplication::translate("QWebPage", "Search The Web", "Search The Web context menu item");
    333 }
    334 
    335 String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary(const String&)
    336 {
    337     return QCoreApplication::translate("QWebPage", "Look Up In Dictionary", "Look Up in Dictionary context menu item");
    338 }
    339 
    340 String WebPlatformStrategies::contextMenuItemTagOpenLink()
    341 {
    342     return QCoreApplication::translate("QWebPage", "Open Link", "Open Link context menu item");
    343 }
    344 
    345 String WebPlatformStrategies::contextMenuItemTagIgnoreGrammar()
    346 {
    347     return QCoreApplication::translate("QWebPage", "Ignore", "Ignore Grammar context menu item");
    348 }
    349 
    350 String WebPlatformStrategies::contextMenuItemTagSpellingMenu()
    351 {
    352     return QCoreApplication::translate("QWebPage", "Spelling", "Spelling and Grammar context sub-menu item");
    353 }
    354 
    355 String WebPlatformStrategies::contextMenuItemTagShowSpellingPanel(bool show)
    356 {
    357     return show ? QCoreApplication::translate("QWebPage", "Show Spelling and Grammar", "menu item title") :
    358                   QCoreApplication::translate("QWebPage", "Hide Spelling and Grammar", "menu item title");
    359 }
    360 
    361 String WebPlatformStrategies::contextMenuItemTagCheckSpelling()
    362 {
    363     return QCoreApplication::translate("QWebPage", "Check Spelling", "Check spelling context menu item");
    364 }
    365 
    366 String WebPlatformStrategies::contextMenuItemTagCheckSpellingWhileTyping()
    367 {
    368     return QCoreApplication::translate("QWebPage", "Check Spelling While Typing", "Check spelling while typing context menu item");
    369 }
    370 
    371 String WebPlatformStrategies::contextMenuItemTagCheckGrammarWithSpelling()
    372 {
    373     return QCoreApplication::translate("QWebPage", "Check Grammar With Spelling", "Check grammar with spelling context menu item");
    374 }
    375 
    376 String WebPlatformStrategies::contextMenuItemTagFontMenu()
    377 {
    378     return QCoreApplication::translate("QWebPage", "Fonts", "Font context sub-menu item");
    379 }
    380 
    381 String WebPlatformStrategies::contextMenuItemTagBold()
    382 {
    383     return QCoreApplication::translate("QWebPage", "Bold", "Bold context menu item");
    384 }
    385 
    386 String WebPlatformStrategies::contextMenuItemTagItalic()
    387 {
    388     return QCoreApplication::translate("QWebPage", "Italic", "Italic context menu item");
    389 }
    390 
    391 String WebPlatformStrategies::contextMenuItemTagUnderline()
    392 {
    393     return QCoreApplication::translate("QWebPage", "Underline", "Underline context menu item");
    394 }
    395 
    396 String WebPlatformStrategies::contextMenuItemTagOutline()
    397 {
    398     return QCoreApplication::translate("QWebPage", "Outline", "Outline context menu item");
    399 }
    400 
    401 String WebPlatformStrategies::contextMenuItemTagWritingDirectionMenu()
    402 {
    403     return QCoreApplication::translate("QWebPage", "Direction", "Writing direction context sub-menu item");
    404 }
    405 
    406 String WebPlatformStrategies::contextMenuItemTagTextDirectionMenu()
    407 {
    408     return QCoreApplication::translate("QWebPage", "Text Direction", "Text direction context sub-menu item");
    409 }
    410 
    411 String WebPlatformStrategies::contextMenuItemTagDefaultDirection()
    412 {
    413     return QCoreApplication::translate("QWebPage", "Default", "Default writing direction context menu item");
    414 }
    415 
    416 String WebPlatformStrategies::contextMenuItemTagLeftToRight()
    417 {
    418     return QCoreApplication::translate("QWebPage", "Left to Right", "Left to Right context menu item");
    419 }
    420 
    421 String WebPlatformStrategies::contextMenuItemTagRightToLeft()
    422 {
    423     return QCoreApplication::translate("QWebPage", "Right to Left", "Right to Left context menu item");
    424 }
    425 
    426 String WebPlatformStrategies::contextMenuItemTagInspectElement()
    427 {
    428     return QCoreApplication::translate("QWebPage", "Inspect", "Inspect Element context menu item");
    429 }
    430 
    431 String WebPlatformStrategies::searchMenuNoRecentSearchesText()
    432 {
    433     return QCoreApplication::translate("QWebPage", "No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed");
    434 }
    435 
    436 String WebPlatformStrategies::searchMenuRecentSearchesText()
    437 {
    438     return QCoreApplication::translate("QWebPage", "Recent searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title");
    439 }
    440 
    441 String WebPlatformStrategies::searchMenuClearRecentSearchesText()
    442 {
    443     return QCoreApplication::translate("QWebPage", "Clear recent searches", "menu item in Recent Searches menu that empties menu's contents");
    444 }
    445 
    446 String WebPlatformStrategies::AXWebAreaText()
    447 {
    448     notImplemented();
    449     return String();
    450 }
    451 
    452 String WebPlatformStrategies::AXLinkText()
    453 {
    454     notImplemented();
    455     return String();
    456 }
    457 
    458 String WebPlatformStrategies::AXListMarkerText()
    459 {
    460     notImplemented();
    461     return String();
    462 }
    463 
    464 String WebPlatformStrategies::AXImageMapText()
    465 {
    466     notImplemented();
    467     return String();
    468 }
    469 
    470 String WebPlatformStrategies::AXHeadingText()
    471 {
    472     notImplemented();
    473     return String();
    474 }
    475 
    476 String WebPlatformStrategies::AXDefinitionListTermText()
    477 {
    478     notImplemented();
    479     return String();
    480 }
    481 
    482 String WebPlatformStrategies::AXDefinitionListDefinitionText()
    483 {
    484     notImplemented();
    485     return String();
    486 }
    487 
    488 String WebPlatformStrategies::AXButtonActionVerb()
    489 {
    490     notImplemented();
    491     return String();
    492 }
    493 
    494 String WebPlatformStrategies::AXRadioButtonActionVerb()
    495 {
    496     notImplemented();
    497     return String();
    498 }
    499 
    500 String WebPlatformStrategies::AXTextFieldActionVerb()
    501 {
    502     notImplemented();
    503     return String();
    504 }
    505 
    506 String WebPlatformStrategies::AXCheckedCheckBoxActionVerb()
    507 {
    508     notImplemented();
    509     return String();
    510 }
    511 
    512 String WebPlatformStrategies::AXUncheckedCheckBoxActionVerb()
    513 {
    514     notImplemented();
    515     return String();
    516 }
    517 
    518 String WebPlatformStrategies::AXMenuListActionVerb()
    519 {
    520     notImplemented();
    521     return String();
    522 }
    523 
    524 String WebPlatformStrategies::AXMenuListPopupActionVerb()
    525 {
    526     notImplemented();
    527     return String();
    528 }
    529 
    530 String WebPlatformStrategies::AXLinkActionVerb()
    531 {
    532     notImplemented();
    533     return String();
    534 }
    535 
    536 String WebPlatformStrategies::missingPluginText()
    537 {
    538     return QCoreApplication::translate("QWebPage", "Missing Plug-in", "Label text to be used when a plug-in is missing");
    539 }
    540 
    541 String WebPlatformStrategies::crashedPluginText()
    542 {
    543     notImplemented();
    544     return String();
    545 }
    546 
    547 String WebPlatformStrategies::multipleFileUploadText(unsigned)
    548 {
    549     notImplemented();
    550     return String();
    551 }
    552 
    553 String WebPlatformStrategies::unknownFileSizeText()
    554 {
    555     return QCoreApplication::translate("QWebPage", "Unknown", "Unknown filesize FTP directory listing item");
    556 }
    557 
    558 String WebPlatformStrategies::imageTitle(const String& filename, const IntSize& size)
    559 {
    560     return QCoreApplication::translate("QWebPage", "%1 (%2x%3 pixels)", "Title string for images").arg(filename).arg(size.width()).arg(size.height());
    561 }
    562 
    563 String WebPlatformStrategies::mediaElementLoadingStateText()
    564 {
    565     return QCoreApplication::translate("QWebPage", "Loading...", "Media controller status message when the media is loading");
    566 }
    567 
    568 String WebPlatformStrategies::mediaElementLiveBroadcastStateText()
    569 {
    570     return QCoreApplication::translate("QWebPage", "Live Broadcast", "Media controller status message when watching a live broadcast");
    571 }
    572 
    573 #if ENABLE(VIDEO)
    574 
    575 String WebPlatformStrategies::localizedMediaControlElementString(const String& name)
    576 {
    577     if (name == "AudioElement")
    578         return QCoreApplication::translate("QWebPage", "Audio Element", "Media controller element");
    579     if (name == "VideoElement")
    580         return QCoreApplication::translate("QWebPage", "Video Element", "Media controller element");
    581     if (name == "MuteButton")
    582         return QCoreApplication::translate("QWebPage", "Mute Button", "Media controller element");
    583     if (name == "UnMuteButton")
    584         return QCoreApplication::translate("QWebPage", "Unmute Button", "Media controller element");
    585     if (name == "PlayButton")
    586         return QCoreApplication::translate("QWebPage", "Play Button", "Media controller element");
    587     if (name == "PauseButton")
    588         return QCoreApplication::translate("QWebPage", "Pause Button", "Media controller element");
    589     if (name == "Slider")
    590         return QCoreApplication::translate("QWebPage", "Slider", "Media controller element");
    591     if (name == "SliderThumb")
    592         return QCoreApplication::translate("QWebPage", "Slider Thumb", "Media controller element");
    593     if (name == "RewindButton")
    594         return QCoreApplication::translate("QWebPage", "Rewind Button", "Media controller element");
    595     if (name == "ReturnToRealtimeButton")
    596         return QCoreApplication::translate("QWebPage", "Return to Real-time Button", "Media controller element");
    597     if (name == "CurrentTimeDisplay")
    598         return QCoreApplication::translate("QWebPage", "Elapsed Time", "Media controller element");
    599     if (name == "TimeRemainingDisplay")
    600         return QCoreApplication::translate("QWebPage", "Remaining Time", "Media controller element");
    601     if (name == "StatusDisplay")
    602         return QCoreApplication::translate("QWebPage", "Status Display", "Media controller element");
    603     if (name == "FullscreenButton")
    604         return QCoreApplication::translate("QWebPage", "Fullscreen Button", "Media controller element");
    605     if (name == "SeekForwardButton")
    606         return QCoreApplication::translate("QWebPage", "Seek Forward Button", "Media controller element");
    607     if (name == "SeekBackButton")
    608         return QCoreApplication::translate("QWebPage", "Seek Back Button", "Media controller element");
    609 
    610     return String();
    611 }
    612 
    613 String WebPlatformStrategies::localizedMediaControlElementHelpText(const String& name)
    614 {
    615     if (name == "AudioElement")
    616         return QCoreApplication::translate("QWebPage", "Audio element playback controls and status display", "Media controller element");
    617     if (name == "VideoElement")
    618         return QCoreApplication::translate("QWebPage", "Video element playback controls and status display", "Media controller element");
    619     if (name == "MuteButton")
    620         return QCoreApplication::translate("QWebPage", "Mute audio tracks", "Media controller element");
    621     if (name == "UnMuteButton")
    622         return QCoreApplication::translate("QWebPage", "Unmute audio tracks", "Media controller element");
    623     if (name == "PlayButton")
    624         return QCoreApplication::translate("QWebPage", "Begin playback", "Media controller element");
    625     if (name == "PauseButton")
    626         return QCoreApplication::translate("QWebPage", "Pause playback", "Media controller element");
    627     if (name == "Slider")
    628         return QCoreApplication::translate("QWebPage", "Movie time scrubber", "Media controller element");
    629     if (name == "SliderThumb")
    630         return QCoreApplication::translate("QWebPage", "Movie time scrubber thumb", "Media controller element");
    631     if (name == "RewindButton")
    632         return QCoreApplication::translate("QWebPage", "Rewind movie", "Media controller element");
    633     if (name == "ReturnToRealtimeButton")
    634         return QCoreApplication::translate("QWebPage", "Return streaming movie to real-time", "Media controller element");
    635     if (name == "CurrentTimeDisplay")
    636         return QCoreApplication::translate("QWebPage", "Current movie time", "Media controller element");
    637     if (name == "TimeRemainingDisplay")
    638         return QCoreApplication::translate("QWebPage", "Remaining movie time", "Media controller element");
    639     if (name == "StatusDisplay")
    640         return QCoreApplication::translate("QWebPage", "Current movie status", "Media controller element");
    641     if (name == "FullscreenButton")
    642         return QCoreApplication::translate("QWebPage", "Play movie in full-screen mode", "Media controller element");
    643     if (name == "SeekForwardButton")
    644         return QCoreApplication::translate("QWebPage", "Seek quickly back", "Media controller element");
    645     if (name == "SeekBackButton")
    646         return QCoreApplication::translate("QWebPage", "Seek quickly forward", "Media controller element");
    647 
    648     ASSERT_NOT_REACHED();
    649     return String();
    650 }
    651 
    652 String WebPlatformStrategies::localizedMediaTimeDescription(float time)
    653 {
    654     if (!isfinite(time))
    655         return QCoreApplication::translate("QWebPage", "Indefinite time", "Media time description");
    656 
    657     int seconds = (int)fabsf(time);
    658     int days = seconds / (60 * 60 * 24);
    659     int hours = seconds / (60 * 60);
    660     int minutes = (seconds / 60) % 60;
    661     seconds %= 60;
    662 
    663     if (days)
    664         return QCoreApplication::translate("QWebPage", "%1 days %2 hours %3 minutes %4 seconds", "Media time description").arg(days).arg(hours).arg(minutes).arg(seconds);
    665 
    666     if (hours)
    667         return QCoreApplication::translate("QWebPage", "%1 hours %2 minutes %3 seconds", "Media time description").arg(hours).arg(minutes).arg(seconds);
    668 
    669     if (minutes)
    670         return QCoreApplication::translate("QWebPage", "%1 minutes %2 seconds", "Media time description").arg(minutes).arg(seconds);
    671 
    672     return QCoreApplication::translate("QWebPage", "%1 seconds", "Media time description").arg(seconds);
    673 }
    674 
    675 #else // ENABLE(VIDEO)
    676 // FIXME: #if ENABLE(VIDEO) should be in the base class
    677 
    678 String WebPlatformStrategies::localizedMediaControlElementString(const String& name)
    679 {
    680     return String();
    681 }
    682 
    683 String WebPlatformStrategies::localizedMediaControlElementHelpText(const String& name)
    684 {
    685     return String();
    686 }
    687 
    688 String WebPlatformStrategies::localizedMediaTimeDescription(float time)
    689 {
    690     return String();
    691 }
    692 
    693 #endif // ENABLE(VIDEO)
    694 
    695 
    696 String WebPlatformStrategies::validationMessageValueMissingText()
    697 {
    698     notImplemented();
    699     return String();
    700 }
    701 
    702 String WebPlatformStrategies::validationMessageTypeMismatchText()
    703 {
    704     notImplemented();
    705     return String();
    706 }
    707 
    708 String WebPlatformStrategies::validationMessagePatternMismatchText()
    709 {
    710     notImplemented();
    711     return String();
    712 }
    713 
    714 String WebPlatformStrategies::validationMessageTooLongText()
    715 {
    716     notImplemented();
    717     return String();
    718 }
    719 
    720 String WebPlatformStrategies::validationMessageRangeUnderflowText()
    721 {
    722     notImplemented();
    723     return String();
    724 }
    725 
    726 String WebPlatformStrategies::validationMessageRangeOverflowText()
    727 {
    728     notImplemented();
    729     return String();
    730 }
    731 
    732 String WebPlatformStrategies::validationMessageStepMismatchText()
    733 {
    734     notImplemented();
    735     return String();
    736 }
    737 
    738 
    739 // VisitedLinkStrategy
    740 
    741 bool WebPlatformStrategies::isLinkVisited(Page* page, LinkHash hash)
    742 {
    743     return page->group().isLinkVisited(hash);
    744 }
    745 
    746 void WebPlatformStrategies::addVisitedLink(Page* page, LinkHash hash)
    747 {
    748     page->group().addVisitedLinkHash(hash);
    749 }
    750