1/*
2 * Copyright (C) 2006 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
4 * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> All rights reserved.
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 *
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 COMPUTER, INC. ``AS IS'' AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29#include "config.h"
30#include "ChromeClientHaiku.h"
31
32#include "Frame.h"
33#include "FrameLoadRequest.h"
34#include "FrameView.h"
35#include "HitTestResult.h"
36#include "Icon.h"
37#include "NavigationAction.h"
38#include "NotImplemented.h"
39#include "PlatformString.h"
40#include "SecurityOrigin.h"
41#include "PopupMenuHaiku.h"
42#include "SearchPopupMenuHaiku.h"
43
44#include <Alert.h>
45#include <String.h>
46
47
48namespace WebCore {
49
50ChromeClientHaiku::ChromeClientHaiku()
51{
52}
53
54ChromeClientHaiku::~ChromeClientHaiku()
55{
56}
57
58void ChromeClientHaiku::chromeDestroyed()
59{
60    notImplemented();
61}
62
63void ChromeClientHaiku::setWindowRect(const FloatRect&)
64{
65    notImplemented();
66}
67
68FloatRect ChromeClientHaiku::windowRect()
69{
70    notImplemented();
71    return FloatRect(0, 0, 200, 200);
72}
73
74FloatRect ChromeClientHaiku::pageRect()
75{
76    notImplemented();
77    return FloatRect(0, 0, 200, 200);
78}
79
80float ChromeClientHaiku::scaleFactor()
81{
82    notImplemented();
83    return 1.0;
84}
85
86void ChromeClientHaiku::focus()
87{
88    notImplemented();
89}
90
91void ChromeClientHaiku::unfocus()
92{
93    notImplemented();
94}
95
96bool ChromeClientHaiku::canTakeFocus(FocusDirection)
97{
98    notImplemented();
99    return true;
100}
101
102void ChromeClientHaiku::takeFocus(FocusDirection)
103{
104    notImplemented();
105}
106
107void ChromeClientHaiku::focusedNodeChanged(Node*)
108{
109}
110
111void ChromeClientHaiku::focusedFrameChanged(Frame*)
112{
113}
114
115Page* ChromeClientHaiku::createWindow(Frame*, const FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&)
116{
117    notImplemented();
118    return 0;
119}
120
121Page* ChromeClientHaiku::createModalDialog(Frame*, const FrameLoadRequest&)
122{
123    notImplemented();
124    return 0;
125}
126
127void ChromeClientHaiku::show()
128{
129    notImplemented();
130}
131
132bool ChromeClientHaiku::canRunModal()
133{
134    notImplemented();
135    return false;
136}
137
138void ChromeClientHaiku::runModal()
139{
140    notImplemented();
141}
142
143void ChromeClientHaiku::setToolbarsVisible(bool)
144{
145    notImplemented();
146}
147
148bool ChromeClientHaiku::toolbarsVisible()
149{
150    notImplemented();
151    return false;
152}
153
154void ChromeClientHaiku::setStatusbarVisible(bool)
155{
156    notImplemented();
157}
158
159bool ChromeClientHaiku::statusbarVisible()
160{
161    notImplemented();
162    return false;
163}
164
165void ChromeClientHaiku::setScrollbarsVisible(bool)
166{
167    notImplemented();
168}
169
170bool ChromeClientHaiku::scrollbarsVisible()
171{
172    notImplemented();
173    return true;
174}
175
176void ChromeClientHaiku::setMenubarVisible(bool)
177{
178    notImplemented();
179}
180
181bool ChromeClientHaiku::menubarVisible()
182{
183    notImplemented();
184    return false;
185}
186
187void ChromeClientHaiku::setResizable(bool)
188{
189    notImplemented();
190}
191
192void ChromeClientHaiku::addMessageToConsole(const String& message, unsigned int lineNumber,
193                                            const String& sourceID)
194{
195    printf("MESSAGE %s:%i %s\n", BString(sourceID).String(), lineNumber, BString(message).String());
196}
197
198void ChromeClientHaiku::addMessageToConsole(MessageSource, MessageLevel, const String& message,
199                                            unsigned int lineNumber, const String& sourceID)
200{
201    printf("MESSAGE %s:%i %s\n", BString(sourceID).String(), lineNumber, BString(message).String());
202}
203
204void ChromeClientHaiku::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message,
205                                            unsigned int lineNumber, const String& sourceID)
206{
207    printf("MESSAGE %s:%i %s\n", BString(sourceID).String(), lineNumber, BString(message).String());
208}
209
210bool ChromeClientHaiku::canRunBeforeUnloadConfirmPanel()
211{
212    notImplemented();
213    return false;
214}
215
216bool ChromeClientHaiku::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
217{
218    notImplemented();
219    return false;
220}
221
222void ChromeClientHaiku::closeWindowSoon()
223{
224    notImplemented();
225}
226
227void ChromeClientHaiku::runJavaScriptAlert(Frame*, const String& msg)
228{
229    BAlert* alert = new BAlert("JavaScript", BString(msg).String(), "OK");
230    alert->Go();
231}
232
233bool ChromeClientHaiku::runJavaScriptConfirm(Frame*, const String& msg)
234{
235    BAlert* alert = new BAlert("JavaScript", BString(msg).String(), "Yes", "No");
236    return !alert->Go();
237}
238
239bool ChromeClientHaiku::runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result)
240{
241    notImplemented();
242    return false;
243}
244
245void ChromeClientHaiku::setStatusbarText(const String&)
246{
247    notImplemented();
248}
249
250bool ChromeClientHaiku::shouldInterruptJavaScript()
251{
252    notImplemented();
253    return false;
254}
255
256KeyboardUIMode ChromeClientHaiku::keyboardUIMode()
257{
258    return KeyboardAccessDefault;
259}
260
261IntRect ChromeClientHaiku::windowResizerRect() const
262{
263    return IntRect();
264}
265
266void ChromeClientHaiku::invalidateWindow(const IntRect&, bool)
267{
268    notImplemented();
269}
270
271void ChromeClientHaiku::invalidateContentsAndWindow(const IntRect&, bool)
272{
273    notImplemented();
274}
275
276void ChromeClientHaiku::invalidateContentsForSlowScroll(const IntRect&, bool)
277{
278    notImplemented();
279}
280
281void ChromeClientHaiku::scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
282{
283    notImplemented();
284}
285
286IntPoint ChromeClientHaiku::screenToWindow(const IntPoint&) const
287{
288    notImplemented();
289    return IntPoint();
290}
291
292IntRect ChromeClientHaiku::windowToScreen(const IntRect&) const
293{
294    notImplemented();
295    return IntRect();
296}
297
298PlatformPageClient ChromeClientHaiku::platformPageClient() const
299{
300    notImplemented();
301    return PlatformWidget();
302}
303
304void ChromeClientHaiku::contentsSizeChanged(Frame*, const IntSize&) const
305{
306    notImplemented();
307}
308
309void ChromeClientHaiku::scrollRectIntoView(const IntRect&, const ScrollView*) const
310{
311    notImplemented();
312}
313
314void ChromeClientHaiku::addToDirtyRegion(const IntRect&)
315{
316}
317
318void ChromeClientHaiku::scrollBackingStore(int, int, const IntRect&, const IntRect&)
319{
320}
321
322void ChromeClientHaiku::updateBackingStore()
323{
324}
325
326void ChromeClientHaiku::mouseDidMoveOverElement(const HitTestResult& hit, unsigned /*modifierFlags*/)
327{
328    // Some extra info
329    notImplemented();
330}
331
332void ChromeClientHaiku::setToolTip(const String& tip)
333{
334    notImplemented();
335}
336
337void ChromeClientHaiku::setToolTip(const String& tip, TextDirection)
338{
339    notImplemented();
340}
341
342void ChromeClientHaiku::print(Frame*)
343{
344    notImplemented();
345}
346
347void ChromeClientHaiku::exceededDatabaseQuota(Frame*, const String& databaseName)
348{
349    notImplemented();
350}
351
352#if ENABLE(OFFLINE_WEB_APPLICATIONS)
353void ChromeClientWx::reachedMaxAppCacheSize(int64_t spaceNeeded)
354{
355    notImplemented();
356}
357
358void ChromeClientWx::reachedApplicationCacheOriginQuota(SecurityOrigin*)
359{
360    notImplemented();
361}
362#endif
363
364void ChromeClientHaiku::requestGeolocationPermissionForFrame(Frame*, Geolocation*)
365{
366    notImplemented();
367}
368
369void ChromeClientHaiku::runOpenPanel(Frame*, PassRefPtr<FileChooser>)
370{
371    notImplemented();
372}
373
374void ChromeClientHaiku::chooseIconForFiles(const Vector<String>& filenames, FileChooser* chooser)
375{
376    chooser->iconLoaded(Icon::createIconForFiles(filenames));
377}
378
379void ChromeClientHaiku::setCursor(const Cursor&)
380{
381    notImplemented();
382}
383
384// Notification that the given form element has changed. This function
385// will be called frequently, so handling should be very fast.
386void ChromeClientHaiku::formStateDidChange(const Node*)
387{
388    notImplemented();
389}
390
391bool ChromeClientHaiku::selectItemWritingDirectionIsNatural()
392{
393    return false;
394}
395
396bool ChromeClientHaiku::selectItemAlignmentFollowsMenuWritingDirection()
397{
398    return false;
399}
400
401PassRefPtr<PopupMenu> ChromeClientHaiku::createPopupMenu(PopupMenuClient* client) const
402{
403    return adoptRef(new PopupMenuHaiku(client));
404}
405
406PassRefPtr<SearchPopupMenu> ChromeClientHaiku::createSearchPopupMenu(PopupMenuClient* client) const
407{
408    return adoptRef(new SearchPopupMenuHaiku(client));
409}
410
411} // namespace WebCore
412
413