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 "wtf/Forward.h"
35 class ColorChooserClient;
36 class DateTimeChooser;
37 class DateTimeChooserClient;
41 class HTMLInputElement;
47 class PopupMenuClient;
48 class PopupOpeningObserver;
49 class SearchPopupMenu;
51 struct DateTimeChooserParameters;
52 struct ViewportDescription;
53 struct WindowFeatures;
55 class Chrome FINAL : public HostWindow {
59 static PassOwnPtr<Chrome> create(Page*, ChromeClient*);
61 ChromeClient& client() { return *m_client; }
63 // HostWindow methods.
64 virtual void invalidateContentsAndRootView(const IntRect&) OVERRIDE;
65 virtual void invalidateContentsForSlowScroll(const IntRect&) OVERRIDE;
66 virtual void scroll() OVERRIDE;
67 virtual IntRect rootViewToScreen(const IntRect&) const OVERRIDE;
68 virtual blink::WebScreenInfo screenInfo() const OVERRIDE;
70 virtual void scheduleAnimation() OVERRIDE;
72 void contentsSizeChanged(LocalFrame*, const IntSize&) const;
74 void setCursor(const Cursor&);
76 void setWindowRect(const FloatRect&) const;
77 FloatRect windowRect() const;
79 FloatRect pageRect() const;
83 bool canTakeFocus(FocusType) const;
84 void takeFocus(FocusType) const;
86 void focusedNodeChanged(Node*) const;
88 void show(NavigationPolicy = NavigationPolicyIgnore) const;
90 bool canRunModal() const;
91 bool canRunModalNow() const;
92 void runModal() const;
94 void setWindowFeatures(const WindowFeatures&) const;
96 bool toolbarsVisible() const;
97 bool statusbarVisible() const;
98 bool scrollbarsVisible() const;
99 bool menubarVisible() const;
101 bool canRunBeforeUnloadConfirmPanel();
102 bool runBeforeUnloadConfirmPanel(const String& message, LocalFrame*);
104 void closeWindowSoon();
106 void runJavaScriptAlert(LocalFrame*, const String&);
107 bool runJavaScriptConfirm(LocalFrame*, const String&);
108 bool runJavaScriptPrompt(LocalFrame*, const String& message, const String& defaultValue, String& result);
109 void setStatusbarText(LocalFrame*, const String&);
111 IntRect windowResizerRect() const;
113 void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
115 void setToolTip(const HitTestResult&);
117 void print(LocalFrame*);
119 PassOwnPtr<ColorChooser> createColorChooser(LocalFrame*, ColorChooserClient*, const Color& initialColor);
120 PassRefPtr<DateTimeChooser> openDateTimeChooser(DateTimeChooserClient*, const DateTimeChooserParameters&);
121 void openTextDataListChooser(HTMLInputElement&);
123 void runOpenPanel(LocalFrame*, PassRefPtr<FileChooser>);
124 void enumerateChosenDirectory(FileChooser*);
126 void dispatchViewportPropertiesDidChange(const ViewportDescription&) const;
128 bool hasOpenedPopup() const;
129 PassRefPtr<PopupMenu> createPopupMenu(LocalFrame&, PopupMenuClient*) const;
131 void registerPopupOpeningObserver(PopupOpeningObserver*);
132 void unregisterPopupOpeningObserver(PopupOpeningObserver*);
134 void willBeDestroyed();
137 Chrome(Page*, ChromeClient*);
138 void notifyPopupOpeningObservers() const;
141 ChromeClient* m_client;
142 Vector<PopupOpeningObserver*> m_popupOpeningObservers;