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