| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WebLocalFrame_h | 5 #ifndef WebLocalFrame_h |
| 6 #define WebLocalFrame_h | 6 #define WebLocalFrame_h |
| 7 | 7 |
| 8 #include "WebFrame.h" | 8 #include "WebFrame.h" |
| 9 #include "WebFrameLoadType.h" | 9 #include "WebFrameLoadType.h" |
| 10 | 10 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 virtual WebSandboxFlags effectiveSandboxFlags() const = 0; | 220 virtual WebSandboxFlags effectiveSandboxFlags() const = 0; |
| 221 | 221 |
| 222 // Set sandbox flags that will always be forced on this frame. This is | 222 // Set sandbox flags that will always be forced on this frame. This is |
| 223 // used to inherit sandbox flags from cross-process opener frames in popups. | 223 // used to inherit sandbox flags from cross-process opener frames in popups. |
| 224 // | 224 // |
| 225 // TODO(dcheng): Remove this once we have WebLocalFrame::createMainFrame. | 225 // TODO(dcheng): Remove this once we have WebLocalFrame::createMainFrame. |
| 226 virtual void forceSandboxFlags(WebSandboxFlags) = 0; | 226 virtual void forceSandboxFlags(WebSandboxFlags) = 0; |
| 227 | 227 |
| 228 // Find-in-page ----------------------------------------------------------- | 228 // Find-in-page ----------------------------------------------------------- |
| 229 | 229 |
| 230 // Specifies the action to be taken at the end of a find-in-page session. |
| 231 enum StopFindAction { |
| 232 // No selection will be left. |
| 233 StopFindActionClearSelection, |
| 234 |
| 235 // The active match will remain selected. |
| 236 StopFindActionKeepSelection, |
| 237 |
| 238 // The active match selection will be activated. |
| 239 StopFindActionActivateSelection |
| 240 }; |
| 241 |
| 230 // Searches a frame for a given string. | 242 // Searches a frame for a given string. |
| 231 // | 243 // |
| 232 // If a match is found, this function will select it (scrolling down to | 244 // If a match is found, this function will select it (scrolling down to |
| 233 // make it visible if needed) and fill in selectionRect with the | 245 // make it visible if needed) and fill in selectionRect with the |
| 234 // location of where the match was found (in window coordinates). | 246 // location of where the match was found (in window coordinates). |
| 235 // | 247 // |
| 236 // If no match is found, this function clears all tickmarks and | 248 // If no match is found, this function clears all tickmarks and |
| 237 // highlighting. | 249 // highlighting. |
| 238 // | 250 // |
| 239 // Returns true if the search string was found, false otherwise. | 251 // Returns true if the search string was found, false otherwise. |
| 240 virtual bool find(int identifier, | 252 virtual bool find(int identifier, |
| 241 const WebString& searchText, | 253 const WebString& searchText, |
| 242 const WebFindOptions&, | 254 const WebFindOptions&, |
| 243 bool wrapWithinFrame, | 255 bool wrapWithinFrame, |
| 244 WebRect* selectionRect, | 256 WebRect* selectionRect, |
| 245 bool* activeNow = nullptr) = 0; | 257 bool* activeNow = nullptr) = 0; |
| 246 | 258 |
| 247 // Notifies the frame that we are no longer interested in searching. | 259 // Notifies the frame that we are no longer interested in searching. |
| 248 // This will abort any asynchronous scoping effort already under way | 260 // This will abort any asynchronous scoping effort already under way |
| 249 // (see the function scopeStringMatches for details) and erase all | 261 // (see the function scopeStringMatches for details) and erase all |
| 250 // tick-marks and highlighting from the previous search. If | 262 // tick-marks and highlighting from the previous search. It will also |
| 251 // clearSelection is true, it will also make sure the end state for the | 263 // follow the specified StopFindAction. |
| 252 // find operation does not leave a selection. This can occur when the | 264 virtual void stopFinding(StopFindAction) = 0; |
| 253 // user clears the search string but does not close the find box. | |
| 254 virtual void stopFinding(bool clearSelection) = 0; | |
| 255 | 265 |
| 256 // Counts how many times a particular string occurs within the frame. | 266 // Counts how many times a particular string occurs within the frame. |
| 257 // It also retrieves the location of the string and updates a vector in | 267 // It also retrieves the location of the string and updates a vector in |
| 258 // the frame so that tick-marks and highlighting can be drawn. This | 268 // the frame so that tick-marks and highlighting can be drawn. This |
| 259 // function does its work asynchronously, by running for a certain | 269 // function does its work asynchronously, by running for a certain |
| 260 // time-slice and then scheduling itself (co-operative multitasking) to | 270 // time-slice and then scheduling itself (co-operative multitasking) to |
| 261 // be invoked later (repeating the process until all matches have been | 271 // be invoked later (repeating the process until all matches have been |
| 262 // found). This allows multiple frames to be searched at the same time | 272 // found). This allows multiple frames to be searched at the same time |
| 263 // and provides a way to cancel at any time (see | 273 // and provides a way to cancel at any time (see |
| 264 // cancelPendingScopingEffort). The parameter searchText specifies | 274 // cancelPendingScopingEffort). The parameter searchText specifies |
| (...skipping 22 matching lines...) Expand all Loading... |
| 287 // current version. Should be called only on the main frame. | 297 // current version. Should be called only on the main frame. |
| 288 virtual int findMatchMarkersVersion() const = 0; | 298 virtual int findMatchMarkersVersion() const = 0; |
| 289 | 299 |
| 290 // Returns the bounding box of the active find-in-page match marker or an | 300 // Returns the bounding box of the active find-in-page match marker or an |
| 291 // empty rect if no such marker exists. The rect is returned in find-in-page | 301 // empty rect if no such marker exists. The rect is returned in find-in-page |
| 292 // coordinates whatever frame the active marker is. | 302 // coordinates whatever frame the active marker is. |
| 293 // Should be called only on the main frame. | 303 // Should be called only on the main frame. |
| 294 virtual WebFloatRect activeFindMatchRect() = 0; | 304 virtual WebFloatRect activeFindMatchRect() = 0; |
| 295 | 305 |
| 296 // Swaps the contents of the provided vector with the bounding boxes of the | 306 // Swaps the contents of the provided vector with the bounding boxes of the |
| 297 // find-in-page match markers from all frames. The bounding boxes are return
ed | 307 // find-in-page match markers from all frames. The bounding boxes are |
| 298 // in find-in-page coordinates. This method should be called only on the mai
n frame. | 308 // returned in find-in-page coordinates. This method should be called only |
| 309 // on the main frame. |
| 299 virtual void findMatchRects(WebVector<WebFloatRect>&) = 0; | 310 virtual void findMatchRects(WebVector<WebFloatRect>&) = 0; |
| 300 | 311 |
| 301 // Selects the find-in-page match in the appropriate frame closest to the | 312 // Selects the find-in-page match closest to the provided point in |
| 302 // provided point in find-in-page coordinates. Returns the ordinal of such | 313 // find-in-page coordinates. Returns the ordinal of such match or -1 if none |
| 303 // match or -1 if none could be found. If not null, selectionRect is set to | 314 // could be found. If not null, selectionRect is set to the bounding box of |
| 304 // the bounding box of the selected match in window coordinates. | 315 // the selected match in window coordinates. This method should be called |
| 305 // This method should be called only on the main frame. | 316 // only on the main frame. |
| 306 virtual int selectNearestFindMatch(const WebFloatPoint&, | 317 virtual int selectNearestFindMatch(const WebFloatPoint&, |
| 307 WebRect* selectionRect) | 318 WebRect* selectionRect) |
| 308 = 0; | 319 = 0; |
| 309 | 320 |
| 321 // Returns the distance (squared) to the closest find-in-page match from the |
| 322 // provided point, in find-in-page coordinates. |
| 323 virtual float distanceToNearestFindMatch(const WebFloatPoint&) = 0; |
| 324 |
| 310 // Set the tickmarks for the frame. This will override the default tickmarks | 325 // Set the tickmarks for the frame. This will override the default tickmarks |
| 311 // generated by find results. If this is called with an empty array, the | 326 // generated by find results. If this is called with an empty array, the |
| 312 // default behavior will be restored. | 327 // default behavior will be restored. |
| 313 virtual void setTickmarks(const WebVector<WebRect>&) = 0; | 328 virtual void setTickmarks(const WebVector<WebRect>&) = 0; |
| 314 | 329 |
| 330 // Clears the active find match in the frame, if one exists. |
| 331 virtual void clearActiveFindMatch() = 0; |
| 332 |
| 315 // Context menu ----------------------------------------------------------- | 333 // Context menu ----------------------------------------------------------- |
| 316 | 334 |
| 317 // Returns the node that the context menu opened over. | 335 // Returns the node that the context menu opened over. |
| 318 virtual WebNode contextMenuNode() const = 0; | 336 virtual WebNode contextMenuNode() const = 0; |
| 319 | 337 |
| 320 // Returns the WebFrameWidget associated with this frame if there is one or | 338 // Returns the WebFrameWidget associated with this frame if there is one or |
| 321 // nullptr otherwise. | 339 // nullptr otherwise. |
| 322 virtual WebWidget* frameWidget() const = 0; | 340 virtual WebWidget* frameWidget() const = 0; |
| 323 | 341 |
| 324 protected: | 342 protected: |
| 325 explicit WebLocalFrame(WebTreeScopeType scope) : WebFrame(scope) { } | 343 explicit WebLocalFrame(WebTreeScopeType scope) : WebFrame(scope) { } |
| 326 | 344 |
| 327 // Inherited from WebFrame, but intentionally hidden: it never makes sense | 345 // Inherited from WebFrame, but intentionally hidden: it never makes sense |
| 328 // to call these on a WebLocalFrame. | 346 // to call these on a WebLocalFrame. |
| 329 bool isWebLocalFrame() const override = 0; | 347 bool isWebLocalFrame() const override = 0; |
| 330 WebLocalFrame* toWebLocalFrame() override = 0; | 348 WebLocalFrame* toWebLocalFrame() override = 0; |
| 331 bool isWebRemoteFrame() const override = 0; | 349 bool isWebRemoteFrame() const override = 0; |
| 332 WebRemoteFrame* toWebRemoteFrame() override = 0; | 350 WebRemoteFrame* toWebRemoteFrame() override = 0; |
| 333 }; | 351 }; |
| 334 | 352 |
| 335 } // namespace blink | 353 } // namespace blink |
| 336 | 354 |
| 337 #endif // WebLocalFrame_h | 355 #endif // WebLocalFrame_h |
| OLD | NEW |