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