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

Side by Side Diff: third_party/WebKit/public/web/WebViewClient.h

Issue 2762553002: Add canUpdateLayout & canHandleGestureEvent to WebViewClient. (Closed)
Patch Set: Fix merge issues. Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/web/tests/FrameTestHelpers.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 struct WebPoint; 55 struct WebPoint;
56 struct WebRect; 56 struct WebRect;
57 struct WebSize; 57 struct WebSize;
58 struct WebWindowFeatures; 58 struct WebWindowFeatures;
59 59
60 // Since a WebView is a WebWidget, a WebViewClient is a WebWidgetClient. 60 // Since a WebView is a WebWidget, a WebViewClient is a WebWidgetClient.
61 // Virtual inheritance allows an implementation of WebWidgetClient to be 61 // Virtual inheritance allows an implementation of WebWidgetClient to be
62 // easily reused as part of an implementation of WebViewClient. 62 // easily reused as part of an implementation of WebViewClient.
63 class WebViewClient : protected WebWidgetClient { 63 class WebViewClient : protected WebWidgetClient {
64 public: 64 public:
65 ~WebViewClient() override {}
65 // Factory methods ----------------------------------------------------- 66 // Factory methods -----------------------------------------------------
66 67
67 // Create a new related WebView. This method must clone its session storage 68 // Create a new related WebView. This method must clone its session storage
68 // so any subsequent calls to createSessionStorageNamespace conform to the 69 // so any subsequent calls to createSessionStorageNamespace conform to the
69 // WebStorage specification. 70 // WebStorage specification.
70 // The request parameter is only for the client to check if the request 71 // The request parameter is only for the client to check if the request
71 // could be fulfilled. The client should not load the request. 72 // could be fulfilled. The client should not load the request.
72 // The policy parameter indicates how the new view will be displayed in 73 // The policy parameter indicates how the new view will be displayed in
73 // WebWidgetClient::show. 74 // WebWidgetClient::show.
74 virtual WebView* createView(WebLocalFrame* creator, 75 virtual WebView* createView(WebLocalFrame* creator,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Take focus away from the WebView by focusing an adjacent UI element 162 // Take focus away from the WebView by focusing an adjacent UI element
162 // in the containing window. 163 // in the containing window.
163 virtual void focusNext() {} 164 virtual void focusNext() {}
164 virtual void focusPrevious() {} 165 virtual void focusPrevious() {}
165 166
166 // Called when a new node gets focused. |fromNode| is the previously focused 167 // Called when a new node gets focused. |fromNode| is the previously focused
167 // node, |toNode| is the newly focused node. Either can be null. 168 // node, |toNode| is the newly focused node. Either can be null.
168 virtual void focusedNodeChanged(const WebNode& fromNode, 169 virtual void focusedNodeChanged(const WebNode& fromNode,
169 const WebNode& toNode) {} 170 const WebNode& toNode) {}
170 171
172 // Called to check if layout update should be processed.
173 virtual bool canUpdateLayout() { return false; }
174
171 // Indicates two things: 175 // Indicates two things:
172 // 1) This view may have a new layout now. 176 // 1) This view may have a new layout now.
173 // 2) Calling layout() is a no-op. 177 // 2) Calling layout() is a no-op.
174 // After calling WebWidget::layout(), expect to get this notification 178 // After calling WebWidget::layout(), expect to get this notification
175 // unless the view did not need a layout. 179 // unless the view did not need a layout.
176 virtual void didUpdateLayout() {} 180 virtual void didUpdateLayout() {}
177 181
178 // Return true to swallow the input event if the embedder will start a 182 // Return true to swallow the input event if the embedder will start a
179 // disambiguation popup 183 // disambiguation popup
180 virtual bool didTapMultipleTargets(const WebSize& visualViewportOffset, 184 virtual bool didTapMultipleTargets(const WebSize& visualViewportOffset,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 255
252 // Cancels any previously scheduled content intents that have not yet 256 // Cancels any previously scheduled content intents that have not yet
253 // launched. 257 // launched.
254 virtual void cancelScheduledContentIntents() {} 258 virtual void cancelScheduledContentIntents() {}
255 259
256 // Draggable regions ---------------------------------------------------- 260 // Draggable regions ----------------------------------------------------
257 261
258 // Informs the browser that the draggable regions have been updated. 262 // Informs the browser that the draggable regions have been updated.
259 virtual void draggableRegionsChanged() {} 263 virtual void draggableRegionsChanged() {}
260 264
265 virtual bool canHandleGestureEvent() { return false; }
266
261 // TODO(lfg): These methods are only exposed through WebViewClient while we 267 // TODO(lfg): These methods are only exposed through WebViewClient while we
262 // refactor WebView to not inherit from WebWidget. 268 // refactor WebView to not inherit from WebWidget.
263 // WebWidgetClient overrides. 269 // WebWidgetClient overrides.
264 void closeWidgetSoon() override {} 270 void closeWidgetSoon() override {}
265 void convertViewportToWindow(WebRect* rect) override {} 271 void convertViewportToWindow(WebRect* rect) override {}
266 void convertWindowToViewport(WebFloatRect* rect) override {} 272 void convertWindowToViewport(WebFloatRect* rect) override {}
267 void didHandleGestureEvent(const WebGestureEvent& event, 273 void didHandleGestureEvent(const WebGestureEvent& event,
268 bool eventCancelled) override {} 274 bool eventCancelled) override {}
269 void didOverscroll(const WebFloatSize& overscrollDelta, 275 void didOverscroll(const WebFloatSize& overscrollDelta,
270 const WebFloatSize& accumulatedOverscroll, 276 const WebFloatSize& accumulatedOverscroll,
271 const WebFloatPoint& positionInViewport, 277 const WebFloatPoint& positionInViewport,
272 const WebFloatSize& velocityInViewport) override {} 278 const WebFloatSize& velocityInViewport) override {}
273 void hasTouchEventHandlers(bool) override {} 279 void hasTouchEventHandlers(bool) override {}
274 WebLayerTreeView* initializeLayerTreeView() override { return nullptr; } 280 WebLayerTreeView* initializeLayerTreeView() override { return nullptr; }
275 WebScreenInfo screenInfo() override { return WebScreenInfo(); } 281 WebScreenInfo screenInfo() override { return WebScreenInfo(); }
276 void setTouchAction(WebTouchAction touchAction) override {} 282 void setTouchAction(WebTouchAction touchAction) override {}
277 void showUnhandledTapUIIfNeeded(const WebPoint& tappedPosition, 283 void showUnhandledTapUIIfNeeded(const WebPoint& tappedPosition,
278 const WebNode& tappedNode, 284 const WebNode& tappedNode,
279 bool pageChanged) override {} 285 bool pageChanged) override {}
280 void show(WebNavigationPolicy) override {} 286 void show(WebNavigationPolicy) override {}
281 virtual WebWidgetClient* widgetClient() { return this; } 287 virtual WebWidgetClient* widgetClient() { return this; }
282 288
283 protected: 289 protected:
284 ~WebViewClient() override {}
285 }; 290 };
286 291
287 } // namespace blink 292 } // namespace blink
288 293
289 #endif 294 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/FrameTestHelpers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698