2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 * Copyright (C) 2012, Samsung Electronics. All rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
25 #include "core/loader/NavigationPolicy.h"
26 #include "core/page/FocusType.h"
27 #include "platform/Cursor.h"
28 #include "platform/HostWindow.h"
29 #include "platform/heap/Handle.h"
30 #include "wtf/Forward.h"
36 class ColorChooserClient;
37 class DateTimeChooser;
38 class DateTimeChooserClient;
42 class HTMLInputElement;
48 class PopupMenuClient;
49 class PopupOpeningObserver;
50 class SearchPopupMenu;
52 struct DateTimeChooserParameters;
53 struct ViewportDescription;
54 struct WindowFeatures;
56 class Chrome FINAL : public HostWindow {
60 static PassOwnPtr<Chrome> create(Page*, ChromeClient*);
62 ChromeClient& client() { return *m_client; }
64 // HostWindow methods.
65 virtual void invalidateContentsAndRootView(const IntRect&) OVERRIDE;
66 virtual void invalidateContentsForSlowScroll(const IntRect&) OVERRIDE;
67 virtual void scroll() OVERRIDE;
68 virtual IntRect rootViewToScreen(const IntRect&) const OVERRIDE;
69 virtual blink::WebScreenInfo screenInfo() const OVERRIDE;
71 virtual void scheduleAnimation() OVERRIDE;
73 void contentsSizeChanged(LocalFrame*, const IntSize&) const;
75 void setCursor(const Cursor&);
77 void setWindowRect(const FloatRect&) const;
78 FloatRect windowRect() const;
80 FloatRect pageRect() const;
84 bool canTakeFocus(FocusType) const;
85 void takeFocus(FocusType) const;
87 void focusedNodeChanged(Node*) const;
89 void show(NavigationPolicy = NavigationPolicyIgnore) const;
91 bool canRunModal() const;
92 bool canRunModalNow() const;
93 void runModal() const;
95 void setWindowFeatures(const WindowFeatures&) const;
97 bool toolbarsVisible() const;
98 bool statusbarVisible() const;
99 bool scrollbarsVisible() const;
100 bool menubarVisible() const;
102 bool canRunBeforeUnloadConfirmPanel();
103 bool runBeforeUnloadConfirmPanel(const String& message, LocalFrame*);
105 void closeWindowSoon();
107 void runJavaScriptAlert(LocalFrame*, const String&);
108 bool runJavaScriptConfirm(LocalFrame*, const String&);
109 bool runJavaScriptPrompt(LocalFrame*, const String& message, const String& defaultValue, String& result);
110 void setStatusbarText(LocalFrame*, const String&);
112 IntRect windowResizerRect() const;
114 void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
116 void setToolTip(const HitTestResult&);
118 void print(LocalFrame*);
120 PassOwnPtr<ColorChooser> createColorChooser(LocalFrame*, ColorChooserClient*, const Color& initialColor);
121 PassRefPtrWillBeRawPtr<DateTimeChooser> openDateTimeChooser(DateTimeChooserClient*, const DateTimeChooserParameters&);
122 void openTextDataListChooser(HTMLInputElement&);
124 void runOpenPanel(LocalFrame*, PassRefPtr<FileChooser>);
125 void enumerateChosenDirectory(FileChooser*);
127 void dispatchViewportPropertiesDidChange(const ViewportDescription&) const;
129 bool hasOpenedPopup() const;
130 PassRefPtr<PopupMenu> createPopupMenu(LocalFrame&, PopupMenuClient*) const;
132 void registerPopupOpeningObserver(PopupOpeningObserver*);
133 void unregisterPopupOpeningObserver(PopupOpeningObserver*);
135 void willBeDestroyed();
138 Chrome(Page*, ChromeClient*);
139 void notifyPopupOpeningObservers() const;
142 ChromeClient* m_client;
143 Vector<PopupOpeningObserver*> m_popupOpeningObservers;