Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Side by Side Diff: Source/web/ChromeClientImpl.h

Issue 1152413003: General code cleanup of ChromeClient-related classes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 16 matching lines...) Expand all
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #ifndef ChromeClientImpl_h 32 #ifndef ChromeClientImpl_h
33 #define ChromeClientImpl_h 33 #define ChromeClientImpl_h
34 34
35 #include "core/page/ChromeClient.h" 35 #include "core/page/ChromeClient.h"
36 #include "core/page/WindowFeatures.h" 36 #include "core/page/WindowFeatures.h"
37 #include "modules/navigatorcontentutils/NavigatorContentUtilsClient.h"
38 #include "platform/PopupMenu.h"
39 #include "platform/weborigin/KURL.h"
40 #include "public/platform/WebColor.h"
41 #include "public/web/WebNavigationPolicy.h" 37 #include "public/web/WebNavigationPolicy.h"
42 #include "wtf/PassOwnPtr.h" 38 #include "wtf/PassOwnPtr.h"
43 39
44 namespace blink { 40 namespace blink {
45 class AXObject; 41
46 class ColorChooser;
47 class ColorChooserClient;
48 class Element;
49 class FileChooser;
50 class GraphicsLayerFactory;
51 class HTMLFormControlElement;
52 class HTMLInputElement;
53 class KeyboardEvent;
54 class PagePopup; 42 class PagePopup;
55 class PagePopupClient; 43 class PagePopupClient;
56 class PopupMenuClient;
57 class DateTimeChooser;
58 class DateTimeChooserClient;
59 class WebViewImpl; 44 class WebViewImpl;
60 struct WebCursorInfo; 45 struct WebCursorInfo;
61 struct WindowFeatures;
62 46
63 // Handles window-level notifications from WebCore on behalf of a WebView. 47 // Handles window-level notifications from core on behalf of a WebView.
64 class ChromeClientImpl final : public ChromeClient { 48 class ChromeClientImpl final : public ChromeClient {
65 public: 49 public:
66 explicit ChromeClientImpl(WebViewImpl* webView); 50 explicit ChromeClientImpl(WebViewImpl*);
67 virtual ~ChromeClientImpl(); 51 ~ChromeClientImpl() override;
68 52
69 virtual void* webView() const override; 53 void* webView() const override;
70 54
71 // ChromeClient methods: 55 // ChromeClient methods:
72 virtual void chromeDestroyed() override; 56 void chromeDestroyed() override;
73 virtual void setWindowRect(const IntRect&) override; 57 void setWindowRect(const IntRect&) override;
74 virtual IntRect windowRect() override; 58 IntRect windowRect() override;
75 virtual IntRect pageRect() override; 59 IntRect pageRect() override;
76 virtual void focus() override; 60 void focus() override;
77 virtual bool canTakeFocus(WebFocusType) override; 61 bool canTakeFocus(WebFocusType) override;
78 virtual void takeFocus(WebFocusType) override; 62 void takeFocus(WebFocusType) override;
79 virtual void focusedNodeChanged(Node* fromNode, Node* toNode) override; 63 void focusedNodeChanged(Node* fromNode, Node* toNode) override;
80 virtual void focusedFrameChanged(LocalFrame*) override; 64 void focusedFrameChanged(LocalFrame*) override;
81 virtual Page* createWindow( 65 Page* createWindow(
82 LocalFrame*, const FrameLoadRequest&, const WindowFeatures&, NavigationP olicy, ShouldSendReferrer) override; 66 LocalFrame*, const FrameLoadRequest&, const WindowFeatures&, NavigationP olicy, ShouldSendReferrer) override;
83 virtual void show(NavigationPolicy) override; 67 void show(NavigationPolicy) override;
84 virtual void setToolbarsVisible(bool) override; 68 void setToolbarsVisible(bool) override;
85 virtual bool toolbarsVisible() override; 69 bool toolbarsVisible() override;
86 virtual void setStatusbarVisible(bool) override; 70 void setStatusbarVisible(bool) override;
87 virtual bool statusbarVisible() override; 71 bool statusbarVisible() override;
88 virtual void setScrollbarsVisible(bool) override; 72 void setScrollbarsVisible(bool) override;
89 virtual bool scrollbarsVisible() override; 73 bool scrollbarsVisible() override;
90 virtual void setMenubarVisible(bool) override; 74 void setMenubarVisible(bool) override;
91 virtual bool menubarVisible() override; 75 bool menubarVisible() override;
92 virtual void setResizable(bool) override; 76 void setResizable(bool) override;
93 virtual bool shouldReportDetailedMessageForSource(LocalFrame&, const WTF::St ring&) override; 77 bool shouldReportDetailedMessageForSource(LocalFrame&, const String&) overri de;
94 virtual void addMessageToConsole( 78 void addMessageToConsole(
95 LocalFrame*, MessageSource, MessageLevel, 79 LocalFrame*, MessageSource, MessageLevel,
96 const WTF::String& message, unsigned lineNumber, 80 const String& message, unsigned lineNumber,
97 const WTF::String& sourceID, const WTF::String& stackTrace) override; 81 const String& sourceID, const String& stackTrace) override;
98 virtual bool canRunBeforeUnloadConfirmPanel() override; 82 bool canRunBeforeUnloadConfirmPanel() override;
99 virtual bool runBeforeUnloadConfirmPanelInternal(LocalFrame*, const String&) override; 83 bool runBeforeUnloadConfirmPanelInternal(LocalFrame*, const String&) overrid e;
100 virtual void closeWindowSoon() override; 84 void closeWindowSoon() override;
101 virtual void runJavaScriptAlertInternal(LocalFrame*, const String&) override ; 85 void runJavaScriptAlertInternal(LocalFrame*, const String&) override;
102 virtual bool runJavaScriptConfirmInternal(LocalFrame*, const String&) overri de; 86 bool runJavaScriptConfirmInternal(LocalFrame*, const String&) override;
103 virtual bool runJavaScriptPromptInternal( 87 bool runJavaScriptPromptInternal(
104 LocalFrame*, const WTF::String& message, 88 LocalFrame*, const String& message,
105 const WTF::String& defaultValue, WTF::String& result) override; 89 const String& defaultValue, String& result) override;
106 virtual void setStatusbarText(const WTF::String& message) override; 90 void setStatusbarText(const String& message) override;
107 virtual bool tabsToLinks() override; 91 bool tabsToLinks() override;
108 virtual IntRect windowResizerRect() const override; 92 IntRect windowResizerRect() const override;
109 virtual void invalidateRect(const IntRect&) override; 93 void invalidateRect(const IntRect&) override;
110 virtual void scheduleAnimation() override; 94 void scheduleAnimation() override;
111 virtual void scheduleAnimationForFrame(LocalFrame* localRoot) override; 95 void scheduleAnimationForFrame(LocalFrame* localRoot) override;
112 virtual IntRect viewportToScreen(const IntRect&) const override; 96 IntRect viewportToScreen(const IntRect&) const override;
113 virtual WebScreenInfo screenInfo() const override; 97 WebScreenInfo screenInfo() const override;
114 virtual void contentsSizeChanged(LocalFrame*, const IntSize&) const override ; 98 void contentsSizeChanged(LocalFrame*, const IntSize&) const override;
115 virtual void pageScaleFactorChanged() const override; 99 void pageScaleFactorChanged() const override;
116 virtual float clampPageScaleFactorToLimits(float scale) const override; 100 float clampPageScaleFactorToLimits(float scale) const override;
117 virtual void layoutUpdated(LocalFrame*) const override; 101 void layoutUpdated(LocalFrame*) const override;
118 virtual void showMouseOverURL(const HitTestResult&) override; 102 void showMouseOverURL(const HitTestResult&) override;
119 virtual void setToolTip(const WTF::String& tooltipText, TextDirection) overr ide; 103 void setToolTip(const String& tooltipText, TextDirection) override;
120 virtual void dispatchViewportPropertiesDidChange(const ViewportDescription&) const override; 104 void dispatchViewportPropertiesDidChange(const ViewportDescription&) const o verride;
121 virtual void printInternal(LocalFrame*) override; 105 void printInternal(LocalFrame*) override;
122 virtual void annotatedRegionsChanged() override; 106 void annotatedRegionsChanged() override;
123 virtual PassOwnPtrWillBeRawPtr<ColorChooser> createColorChooser(LocalFrame*, ColorChooserClient*, const Color&) override; 107 PassOwnPtrWillBeRawPtr<ColorChooser> createColorChooser(LocalFrame*, ColorCh ooserClient*, const Color&) override;
124 virtual PassRefPtr<DateTimeChooser> openDateTimeChooser(DateTimeChooserClien t*, const DateTimeChooserParameters&) override; 108 PassRefPtr<DateTimeChooser> openDateTimeChooser(DateTimeChooserClient*, cons t DateTimeChooserParameters&) override;
125 virtual void runOpenPanel(LocalFrame*, PassRefPtr<FileChooser>) override; 109 void runOpenPanel(LocalFrame*, PassRefPtr<FileChooser>) override;
126 virtual void enumerateChosenDirectory(FileChooser*) override; 110 void enumerateChosenDirectory(FileChooser*) override;
127 virtual void setCursorInternal(const Cursor&) override; 111 void setCursorInternal(const Cursor&) override;
128 virtual void needTouchEvents(bool needTouchEvents) override; 112 void needTouchEvents(bool needTouchEvents) override;
129 virtual void setTouchAction(TouchAction) override; 113 void setTouchAction(TouchAction) override;
130 114
131 virtual GraphicsLayerFactory* graphicsLayerFactory() const override; 115 GraphicsLayerFactory* graphicsLayerFactory() const override;
132 116
133 // Pass 0 as the GraphicsLayer to detatch the root layer. 117 // Pass 0 as the GraphicsLayer to detatch the root layer.
134 virtual void attachRootGraphicsLayer(GraphicsLayer*, LocalFrame* localRoot) override; 118 void attachRootGraphicsLayer(GraphicsLayer*, LocalFrame* localRoot) override ;
135 119
136 virtual void attachCompositorAnimationTimeline(WebCompositorAnimationTimelin e*, LocalFrame* localRoot) override; 120 void attachCompositorAnimationTimeline(WebCompositorAnimationTimeline*, Loca lFrame* localRoot) override;
137 virtual void detachCompositorAnimationTimeline(WebCompositorAnimationTimelin e*, LocalFrame* localRoot) override; 121 void detachCompositorAnimationTimeline(WebCompositorAnimationTimeline*, Loca lFrame* localRoot) override;
138 122
139 virtual void enterFullScreenForElement(Element*) override; 123 void enterFullScreenForElement(Element*) override;
140 virtual void exitFullScreenForElement(Element*) override; 124 void exitFullScreenForElement(Element*) override;
141 125
142 virtual void clearCompositedSelection() override; 126 void clearCompositedSelection() override;
143 virtual void updateCompositedSelection(const CompositedSelection&) override; 127 void updateCompositedSelection(const CompositedSelection&) override;
144 128
145 // ChromeClient methods: 129 // ChromeClient methods:
146 virtual void postAccessibilityNotification(AXObject*, AXObjectCache::AXNotif ication) override; 130 void postAccessibilityNotification(AXObject*, AXObjectCache::AXNotification) override;
147 virtual String acceptLanguages() override; 131 String acceptLanguages() override;
148 132
149 // ChromeClientImpl: 133 // ChromeClientImpl:
150 void setCursorForPlugin(const WebCursorInfo&); 134 void setCursorForPlugin(const WebCursorInfo&);
151 void setNewWindowNavigationPolicy(WebNavigationPolicy); 135 void setNewWindowNavigationPolicy(WebNavigationPolicy);
152 136
153 virtual bool hasOpenedPopup() const override; 137 bool hasOpenedPopup() const override;
154 virtual PassRefPtrWillBeRawPtr<PopupMenu> createPopupMenu(LocalFrame&, Popup MenuClient*) override; 138 PassRefPtrWillBeRawPtr<PopupMenu> createPopupMenu(LocalFrame&, PopupMenuClie nt*) override;
155 PagePopup* openPagePopup(PagePopupClient*); 139 PagePopup* openPagePopup(PagePopupClient*);
156 void closePagePopup(PagePopup*); 140 void closePagePopup(PagePopup*);
157 virtual DOMWindow* pagePopupWindowForTesting() const override; 141 DOMWindow* pagePopupWindowForTesting() const override;
158 142
159 virtual bool shouldRunModalDialogDuringPageDismissal(const DialogType&, cons t String& dialogMessage, Document::PageDismissalType) const override; 143 bool shouldRunModalDialogDuringPageDismissal(const DialogType&, const String & dialogMessage, Document::PageDismissalType) const override;
160 144
161 virtual bool requestPointerLock() override; 145 bool requestPointerLock() override;
162 virtual void requestPointerUnlock() override; 146 void requestPointerUnlock() override;
163 147
164 // AutofillClient pass throughs: 148 // AutofillClient pass throughs:
165 virtual void didAssociateFormControls(const WillBeHeapVector<RefPtrWillBeMem ber<Element>>&, LocalFrame*) override; 149 void didAssociateFormControls(const WillBeHeapVector<RefPtrWillBeMember<Elem ent>>&, LocalFrame*) override;
166 virtual void handleKeyboardEventOnTextField(HTMLInputElement&, KeyboardEvent &) override; 150 void handleKeyboardEventOnTextField(HTMLInputElement&, KeyboardEvent&) overr ide;
167 virtual void didChangeValueInTextField(HTMLFormControlElement&) override; 151 void didChangeValueInTextField(HTMLFormControlElement&) override;
168 virtual void didEndEditingOnTextField(HTMLInputElement&) override; 152 void didEndEditingOnTextField(HTMLInputElement&) override;
169 virtual void openTextDataListChooser(HTMLInputElement&) override; 153 void openTextDataListChooser(HTMLInputElement&) override;
170 virtual void textFieldDataListChanged(HTMLInputElement&) override; 154 void textFieldDataListChanged(HTMLInputElement&) override;
171 virtual void xhrSucceeded(LocalFrame*) override; 155 void xhrSucceeded(LocalFrame*) override;
172 156
173 virtual void didCancelCompositionOnSelectionChange() override; 157 void didCancelCompositionOnSelectionChange() override;
174 virtual void willSetInputMethodState() override; 158 void willSetInputMethodState() override;
175 virtual void didUpdateTextOfFocusedElementByNonUserInput() override; 159 void didUpdateTextOfFocusedElementByNonUserInput() override;
176 virtual void showImeIfNeeded() override; 160 void showImeIfNeeded() override;
177 161
178 virtual void registerViewportLayers() const override; 162 void registerViewportLayers() const override;
179 163
180 virtual void showUnhandledTapUIIfNeeded(IntPoint, Node*, bool) override; 164 void showUnhandledTapUIIfNeeded(IntPoint, Node*, bool) override;
181 virtual void didUpdateTopControls() const override; 165 void didUpdateTopControls() const override;
182 166
183 private: 167 private:
184 bool isChromeClientImpl() const override { return true; } 168 bool isChromeClientImpl() const override { return true; }
185 void registerPopupOpeningObserver(PopupOpeningObserver*) override; 169 void registerPopupOpeningObserver(PopupOpeningObserver*) override;
186 void unregisterPopupOpeningObserver(PopupOpeningObserver*) override; 170 void unregisterPopupOpeningObserver(PopupOpeningObserver*) override;
187 171
188 void notifyPopupOpeningObservers() const; 172 void notifyPopupOpeningObservers() const;
189 void setCursor(const WebCursorInfo&); 173 void setCursor(const WebCursorInfo&);
190 174
191 WebViewImpl* m_webView; // weak pointer 175 WebViewImpl* m_webView; // Weak pointer.
192 WindowFeatures m_windowFeatures; 176 WindowFeatures m_windowFeatures;
193 177
194 PagePopupDriver* m_pagePopupDriver; 178 PagePopupDriver* m_pagePopupDriver;
195 Vector<PopupOpeningObserver*> m_popupOpeningObservers; 179 Vector<PopupOpeningObserver*> m_popupOpeningObservers;
196 }; 180 };
197 181
198 DEFINE_TYPE_CASTS(ChromeClientImpl, ChromeClient, client, client->isChromeClient Impl(), client.isChromeClientImpl()); 182 DEFINE_TYPE_CASTS(ChromeClientImpl, ChromeClient, client, client->isChromeClient Impl(), client.isChromeClientImpl());
199 183
200 } // namespace blink 184 } // namespace blink
201 185
202 #endif 186 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698