Home | History | Annotate | Download | only in android
      1 /*
      2  * Copyright 2009, The Android Open Source Project
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions
      6  * are met:
      7  *  * Redistributions of source code must retain the above copyright
      8  *    notice, this list of conditions and the following disclaimer.
      9  *  * Redistributions in binary form must reproduce the above copyright
     10  *    notice, this list of conditions and the following disclaimer in the
     11  *    documentation and/or other materials provided with the distribution.
     12  *
     13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
     14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
     17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
     21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     24  */
     25 #define LOG_TAG "WebCore"
     26 
     27 #include "config.h"
     28 
     29 #define ANDROID_COMPILE_HACK
     30 
     31 #include "AXObjectCache.h"
     32 #include "CString.h"
     33 #include "CachedPage.h"
     34 #include "CachedResource.h"
     35 #include "Clipboard.h"
     36 #include "Console.h"
     37 #include "ContextMenu.h"
     38 #include "ContextMenuItem.h"
     39 #include "CookieJar.h"
     40 #include "Cursor.h"
     41 #include "Database.h"
     42 #include "DocumentFragment.h"
     43 #include "DocumentLoader.h"
     44 #include "EditCommand.h"
     45 #include "Editor.h"
     46 #include "File.h"
     47 #include "Font.h"
     48 #include "Frame.h"
     49 #include "FrameLoadRequest.h"
     50 #include "FrameLoader.h"
     51 #include "FrameView.h"
     52 #include "GraphicsContext.h"
     53 #include "HTMLFrameOwnerElement.h"
     54 #include "HTMLKeygenElement.h"
     55 #include "History.h"
     56 #include "Icon.h"
     57 #include "IconDatabase.h"
     58 #include "IconLoader.h"
     59 #include "IntPoint.h"
     60 #include "KURL.h"
     61 #include "Language.h"
     62 #include "LocalizedStrings.h"
     63 #include "MainResourceLoader.h"
     64 #include "Node.h"
     65 #include "NotImplemented.h"
     66 #include "PageCache.h"
     67 #include "Pasteboard.h"
     68 #include "Path.h"
     69 #include "PluginInfoStore.h"
     70 #include "PluginWidget.h"
     71 #include "ResourceError.h"
     72 #include "ResourceHandle.h"
     73 #include "ResourceLoader.h"
     74 #include "Screen.h"
     75 #include "Scrollbar.h"
     76 #include "ScrollbarTheme.h"
     77 #include "SmartReplace.h"
     78 #include "Widget.h"
     79 #include "loader.h"
     80 #include <stdio.h>
     81 #include <stdlib.h>
     82 
     83 #if USE(JSC)
     84 #include "API/JSClassRef.h"
     85 #include "JNIUtilityPrivate.h"
     86 #include "JavaScriptCallFrame.h"
     87 #include "JavaScriptDebugServer.h"
     88 #include "JavaScriptProfile.h"
     89 #endif
     90 
     91 using namespace WebCore;
     92 
     93 /********************************************************/
     94 /* Completely empty stubs (mostly to allow DRT to run): */
     95 /********************************************************/
     96 
     97 // This function is used by Javascript to find out what the default language
     98 // the user has selected. It is used by the JS object Navigator.language
     99 // I guess this information should be mapped with the Accept-Language: HTTP header.
    100 String WebCore::defaultLanguage()
    101 {
    102     verifiedOk();
    103     return "en";
    104 }
    105 
    106 namespace WebCore {
    107 
    108 #if !defined(ANDROID_PLUGINS)
    109 // If plugins support is turned on, don't use these stubs.
    110 
    111 // Except for supportsMIMEType(), these Plugin functions are used by javascript's
    112 // navigator.plugins[] object to provide the list of available plugins. This is most
    113 // often used with to check to see if the browser supports Flash or which video
    114 // codec to use.
    115 // The supportsMIMEType() is used by the Frame to determine if a full screen instance
    116 // of a plugin can be used to render a mimetype that is not native to the browser.
    117 PluginInfo* PluginInfoStore::createPluginInfoForPluginAtIndex(unsigned)
    118 {
    119     ASSERT_NOT_REACHED();
    120     return 0;
    121 }
    122 
    123 unsigned PluginInfoStore::pluginCount() const
    124 {
    125     verifiedOk();
    126     return 0;
    127 }
    128 
    129 String PluginInfoStore::pluginNameForMIMEType(const String&)
    130 {
    131     notImplemented();
    132     return String();
    133 }
    134 
    135 bool PluginInfoStore::supportsMIMEType(const String&)
    136 {
    137     verifiedOk();
    138     return false;
    139 }
    140 
    141 void refreshPlugins(bool)
    142 {
    143     verifiedOk();
    144 }
    145 
    146 #endif // !defined(ANDROID_PLUGINS)
    147 
    148 // Needed to link with PluginWidget as a parent class of PluginToggleWidget. Mac
    149 // defines this in plugins/mac/PluginWidgetMac.mm
    150 void PluginWidget::invalidateRect(const IntRect&) {}
    151 
    152 // This function tells the bridge that a resource was loaded from the cache and thus
    153 // the app may update progress with the amount of data loaded.
    154 void CheckCacheObjectStatus(DocLoader*, CachedResource*)
    155 {
    156     ASSERT_NOT_REACHED();
    157     notImplemented();
    158 }
    159 
    160 // This class is used in conjunction with the File Upload form element, and
    161 // therefore relates to the above. When a file has been selected, an icon
    162 // representing the file type can be rendered next to the filename on the
    163 // web page. The icon for the file is encapsulated within this class.
    164 Icon::~Icon() { }
    165 void Icon::paint(GraphicsContext*, const IntRect&) { }
    166 
    167 }  // namespace WebCore
    168 
    169 // FIXME, no support for spelling yet.
    170 Pasteboard* Pasteboard::generalPasteboard()
    171 {
    172     return new Pasteboard();
    173 }
    174 
    175 void Pasteboard::writeSelection(Range*, bool, Frame*)
    176 {
    177     notImplemented();
    178 }
    179 
    180 void Pasteboard::writePlainText(const String&)
    181 {
    182     notImplemented();
    183 }
    184 
    185 void Pasteboard::writeURL(const KURL&, const String&, Frame*)
    186 {
    187     notImplemented();
    188 }
    189 
    190 void Pasteboard::clear()
    191 {
    192     notImplemented();
    193 }
    194 
    195 bool Pasteboard::canSmartReplace()
    196 {
    197     notImplemented();
    198     return false;
    199 }
    200 
    201 PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame*, PassRefPtr<Range>, bool, bool&)
    202 {
    203     notImplemented();
    204     return 0;
    205 }
    206 
    207 String Pasteboard::plainText(Frame*)
    208 {
    209     notImplemented();
    210     return String();
    211 }
    212 
    213 Pasteboard::Pasteboard()
    214 {
    215     notImplemented();
    216 }
    217 
    218 Pasteboard::~Pasteboard()
    219 {
    220     notImplemented();
    221 }
    222 
    223 
    224 ContextMenu::ContextMenu(const HitTestResult& result) : m_hitTestResult(result)
    225 {
    226     ASSERT_NOT_REACHED();
    227     notImplemented();
    228 }
    229 
    230 ContextMenu::~ContextMenu()
    231 {
    232     ASSERT_NOT_REACHED();
    233     notImplemented();
    234 }
    235 
    236 void ContextMenu::appendItem(ContextMenuItem&)
    237 {
    238     ASSERT_NOT_REACHED();
    239     notImplemented();
    240 }
    241 
    242 void ContextMenu::setPlatformDescription(PlatformMenuDescription menu)
    243 {
    244     ASSERT_NOT_REACHED();
    245     m_platformDescription = menu;
    246 }
    247 
    248 PlatformMenuDescription ContextMenu::platformDescription() const
    249 {
    250     ASSERT_NOT_REACHED();
    251     return m_platformDescription;
    252 }
    253 
    254 ContextMenuItem::ContextMenuItem(PlatformMenuItemDescription)
    255 {
    256     ASSERT_NOT_REACHED();
    257     notImplemented();
    258 }
    259 
    260 ContextMenuItem::ContextMenuItem(ContextMenu*)
    261 {
    262     ASSERT_NOT_REACHED();
    263     notImplemented();
    264 }
    265 
    266 ContextMenuItem::ContextMenuItem(ContextMenuItemType, ContextMenuAction, const String&, ContextMenu*)
    267 {
    268     ASSERT_NOT_REACHED();
    269     notImplemented();
    270 }
    271 
    272 ContextMenuItem::~ContextMenuItem()
    273 {
    274     ASSERT_NOT_REACHED();
    275     notImplemented();
    276 }
    277 
    278 PlatformMenuItemDescription ContextMenuItem::releasePlatformDescription()
    279 {
    280     ASSERT_NOT_REACHED();
    281     notImplemented();
    282     return m_platformDescription;
    283 }
    284 
    285 ContextMenuItemType ContextMenuItem::type() const
    286 {
    287     ASSERT_NOT_REACHED();
    288     notImplemented();
    289     return ActionType;
    290 }
    291 
    292 void ContextMenuItem::setType(ContextMenuItemType)
    293 {
    294     ASSERT_NOT_REACHED();
    295     notImplemented();
    296 }
    297 
    298 ContextMenuAction ContextMenuItem::action() const
    299 {
    300     ASSERT_NOT_REACHED();
    301     notImplemented();
    302     return ContextMenuItemTagNoAction;
    303 }
    304 
    305 void ContextMenuItem::setAction(ContextMenuAction)
    306 {
    307     ASSERT_NOT_REACHED();
    308     notImplemented();
    309 }
    310 
    311 String ContextMenuItem::title() const
    312 {
    313     ASSERT_NOT_REACHED();
    314     notImplemented();
    315     return String();
    316 }
    317 
    318 void ContextMenuItem::setTitle(const String&)
    319 {
    320     ASSERT_NOT_REACHED();
    321     notImplemented();
    322 }
    323 
    324 PlatformMenuDescription ContextMenuItem::platformSubMenu() const
    325 {
    326     ASSERT_NOT_REACHED();
    327     notImplemented();
    328     return 0;
    329 }
    330 
    331 void ContextMenuItem::setSubMenu(ContextMenu*)
    332 {
    333     ASSERT_NOT_REACHED();
    334     notImplemented();
    335 }
    336 
    337 void ContextMenuItem::setChecked(bool)
    338 {
    339     ASSERT_NOT_REACHED();
    340     notImplemented();
    341 }
    342 
    343 void ContextMenuItem::setEnabled(bool)
    344 {
    345     ASSERT_NOT_REACHED();
    346     notImplemented();
    347 }
    348 
    349 // systemBeep() is called by the Editor to indicate that there was nothing to copy, and may be called from
    350 // other places too.
    351 void systemBeep()
    352 {
    353     notImplemented();
    354 }
    355 
    356 void* WebCore::Frame::dragImageForSelection()
    357 {
    358     return 0;
    359 }
    360 
    361 void WebCore::Pasteboard::writeImage(WebCore::Node*, WebCore::KURL const&, WebCore::String const&) {}
    362 
    363 namespace WebCore {
    364 
    365 IntSize dragImageSize(void*)
    366 {
    367     return IntSize(0, 0);
    368 }
    369 
    370 void deleteDragImage(void*) {}
    371 void* createDragImageFromImage(Image*)
    372 {
    373     return 0;
    374 }
    375 
    376 void* dissolveDragImageToFraction(void*, float)
    377 {
    378     return 0;
    379 }
    380 
    381 void* createDragImageIconForCachedImage(CachedImage*)
    382 {
    383     return 0;
    384 }
    385 
    386 Cursor dummyCursor;
    387 const Cursor& zoomInCursor()
    388 {
    389     return dummyCursor;
    390 }
    391 
    392 const Cursor& zoomOutCursor()
    393 {
    394     return dummyCursor;
    395 }
    396 
    397 const Cursor& notAllowedCursor()
    398 {
    399     return dummyCursor;
    400 }
    401 
    402 void* scaleDragImage(void*, FloatSize)
    403 {
    404     return 0;
    405 }
    406 
    407 String searchMenuRecentSearchesText()
    408 {
    409     return String();
    410 }
    411 
    412 String searchMenuNoRecentSearchesText()
    413 {
    414     return String();
    415 }
    416 
    417 String searchMenuClearRecentSearchesText()
    418 {
    419     return String();
    420 }
    421 
    422 Vector<String> supportedKeySizes()
    423 {
    424     notImplemented();
    425     return Vector<String>();
    426 }
    427 
    428 } // namespace WebCore
    429 
    430 namespace WebCore {
    431 // isCharacterSmartReplaceExempt is defined in SmartReplaceICU.cpp; in theory, we could use that one
    432 //      but we don't support all of the required icu functions
    433 bool isCharacterSmartReplaceExempt(UChar32, bool)
    434 {
    435     notImplemented();
    436     return false;
    437 }
    438 
    439 }  // WebCore
    440 
    441 int MakeDataExecutable;
    442 
    443 String KURL::fileSystemPath() const
    444 {
    445     notImplemented();
    446     return String();
    447 }
    448 
    449 
    450 PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String&)
    451 {
    452     notImplemented();
    453     return 0;
    454 }
    455 
    456 
    457 #if USE(JSC)
    458 namespace JSC { namespace Bindings {
    459 bool dispatchJNICall(ExecState*, const void* targetAppletView, jobject obj, bool isStatic, JNIType returnType,
    460         jmethodID methodID, jvalue* args, jvalue& result, const char* callingURL, JSValue& exceptionDescription)
    461 {
    462     notImplemented();
    463     return false;
    464 }
    465 
    466 } }  // namespace Bindings
    467 #endif
    468 
    469 char* dirname(const char*)
    470 {
    471     notImplemented();
    472     return 0;
    473 }
    474 
    475     // new as of SVN change 38068, Nov 5, 2008
    476 namespace WebCore {
    477 void prefetchDNS(const String&)
    478 {
    479     notImplemented();
    480 }
    481 
    482 PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>&)
    483 {
    484     notImplemented();
    485     return 0;
    486 }
    487 
    488 // ScrollbarTheme::nativeTheme() is called by RenderTextControl::calcPrefWidths()
    489 // like this: scrollbarSize = ScrollbarTheme::nativeTheme()->scrollbarThickness();
    490 // with this comment:
    491 // // FIXME: We should get the size of the scrollbar from the RenderTheme instead.
    492 // since our text control doesn't have scrollbars, the default size of 0 width should be
    493 // ok. notImplemented() is commented out below so that we can find other unresolved
    494 // unimplemented functions.
    495 ScrollbarTheme* ScrollbarTheme::nativeTheme()
    496 {
    497     /* notImplemented(); */
    498     static ScrollbarTheme theme;
    499     return &theme;
    500 }
    501 
    502 }  // namespace WebCore
    503 
    504 AXObjectCache::~AXObjectCache()
    505 {
    506     notImplemented();
    507 }
    508 
    509 // This value turns on or off the Mac specific Accessibility support.
    510 bool AXObjectCache::gAccessibilityEnabled = false;
    511 bool AXObjectCache::gAccessibilityEnhancedUserInterfaceEnabled = false;
    512 
    513 void AXObjectCache::childrenChanged(RenderObject*)
    514 {
    515     notImplemented();
    516 }
    517 
    518 void AXObjectCache::remove(RenderObject*)
    519 {
    520     notImplemented();
    521 }
    522 
    523 #if USE(JSC)
    524 using namespace JSC;
    525 
    526 
    527 OpaqueJSClass::~OpaqueJSClass()
    528 {
    529     notImplemented();
    530 }
    531 
    532 OpaqueJSClassContextData::~OpaqueJSClassContextData()
    533 {
    534     notImplemented();
    535 }
    536 
    537 #endif
    538