Chromium Code Reviews| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 bool wrapWithinFrame, | 243 bool wrapWithinFrame, |
| 244 WebRect* selectionRect, | 244 WebRect* selectionRect, |
| 245 bool* activeNow = nullptr) = 0; | 245 bool* activeNow = nullptr) = 0; |
| 246 | 246 |
| 247 // Notifies the frame that we are no longer interested in searching. | 247 // Notifies the frame that we are no longer interested in searching. |
| 248 // This will abort any asynchronous scoping effort already under way | 248 // This will abort any asynchronous scoping effort already under way |
| 249 // (see the function scopeStringMatches for details) and erase all | 249 // (see the function scopeStringMatches for details) and erase all |
| 250 // tick-marks and highlighting from the previous search. If | 250 // tick-marks and highlighting from the previous search. If |
| 251 // clearSelection is true, it will also make sure the end state for the | 251 // clearSelection is true, it will also make sure the end state for the |
| 252 // find operation does not leave a selection. This can occur when the | 252 // find operation does not leave a selection. This can occur when the |
| 253 // user clears the search string but does not close the find box. | 253 // user clears the search string but does not close the find box. If |
| 254 virtual void stopFinding(bool clearSelection) = 0; | 254 // activateSelection is true, the find-in-page selection will be |
| 255 // activated, if one exists. | |
| 256 virtual void stopFinding(bool clearSelection, bool activateSelection) = 0; | |
|
dcheng
2016/05/18 21:29:21
enum instead of two bools (since the bools are mut
paulmeyer
2016/05/19 20:08:36
Done.
| |
| 255 | 257 |
| 256 // Counts how many times a particular string occurs within the frame. | 258 // 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 | 259 // 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 | 260 // the frame so that tick-marks and highlighting can be drawn. This |
| 259 // function does its work asynchronously, by running for a certain | 261 // function does its work asynchronously, by running for a certain |
| 260 // time-slice and then scheduling itself (co-operative multitasking) to | 262 // time-slice and then scheduling itself (co-operative multitasking) to |
| 261 // be invoked later (repeating the process until all matches have been | 263 // be invoked later (repeating the process until all matches have been |
| 262 // found). This allows multiple frames to be searched at the same time | 264 // found). This allows multiple frames to be searched at the same time |
| 263 // and provides a way to cancel at any time (see | 265 // and provides a way to cancel at any time (see |
| 264 // cancelPendingScopingEffort). The parameter searchText specifies | 266 // cancelPendingScopingEffort). The parameter searchText specifies |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 287 // current version. Should be called only on the main frame. | 289 // current version. Should be called only on the main frame. |
| 288 virtual int findMatchMarkersVersion() const = 0; | 290 virtual int findMatchMarkersVersion() const = 0; |
| 289 | 291 |
| 290 // Returns the bounding box of the active find-in-page match marker or an | 292 // 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 | 293 // empty rect if no such marker exists. The rect is returned in find-in-page |
| 292 // coordinates whatever frame the active marker is. | 294 // coordinates whatever frame the active marker is. |
| 293 // Should be called only on the main frame. | 295 // Should be called only on the main frame. |
| 294 virtual WebFloatRect activeFindMatchRect() = 0; | 296 virtual WebFloatRect activeFindMatchRect() = 0; |
| 295 | 297 |
| 296 // Swaps the contents of the provided vector with the bounding boxes of the | 298 // 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 | 299 // 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. | 300 // returned in find-in-page coordinates. This method should be called only |
| 301 // on the main frame. | |
| 299 virtual void findMatchRects(WebVector<WebFloatRect>&) = 0; | 302 virtual void findMatchRects(WebVector<WebFloatRect>&) = 0; |
| 300 | 303 |
| 301 // Selects the find-in-page match in the appropriate frame closest to the | 304 // 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 | 305 // 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 | 306 // 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. | 307 // the selected match in window coordinates. This method should be called |
| 305 // This method should be called only on the main frame. | 308 // only on the main frame. |
| 306 virtual int selectNearestFindMatch(const WebFloatPoint&, | 309 virtual int selectNearestFindMatch(const WebFloatPoint&, |
| 307 WebRect* selectionRect) | 310 WebRect* selectionRect) |
| 308 = 0; | 311 = 0; |
| 309 | 312 |
| 313 // Returns the distance (squared) to the closest find-in-page match from the | |
|
dcheng
2016/05/18 21:29:21
Maybe name this distanceToNearestFindMatch() to ma
paulmeyer
2016/05/19 20:08:36
Done. I didn't add "squared" because I agree that
| |
| 314 // provided point, in find-in-page coordinates. | |
| 315 virtual float nearestFindMatch(const WebFloatPoint&) = 0; | |
| 316 | |
| 310 // Set the tickmarks for the frame. This will override the default tickmarks | 317 // 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 | 318 // generated by find results. If this is called with an empty array, the |
| 312 // default behavior will be restored. | 319 // default behavior will be restored. |
| 313 virtual void setTickmarks(const WebVector<WebRect>&) = 0; | 320 virtual void setTickmarks(const WebVector<WebRect>&) = 0; |
| 314 | 321 |
| 322 // Clears the active find match in the frame, if one exists. | |
| 323 virtual void clearActiveFindMatch() = 0; | |
| 324 | |
| 315 // Context menu ----------------------------------------------------------- | 325 // Context menu ----------------------------------------------------------- |
| 316 | 326 |
| 317 // Returns the node that the context menu opened over. | 327 // Returns the node that the context menu opened over. |
| 318 virtual WebNode contextMenuNode() const = 0; | 328 virtual WebNode contextMenuNode() const = 0; |
| 319 | 329 |
| 320 // Returns the WebFrameWidget associated with this frame if there is one or | 330 // Returns the WebFrameWidget associated with this frame if there is one or |
| 321 // nullptr otherwise. | 331 // nullptr otherwise. |
| 322 virtual WebWidget* frameWidget() const = 0; | 332 virtual WebWidget* frameWidget() const = 0; |
| 323 | 333 |
| 324 protected: | 334 protected: |
| 325 explicit WebLocalFrame(WebTreeScopeType scope) : WebFrame(scope) { } | 335 explicit WebLocalFrame(WebTreeScopeType scope) : WebFrame(scope) { } |
| 326 | 336 |
| 327 // Inherited from WebFrame, but intentionally hidden: it never makes sense | 337 // Inherited from WebFrame, but intentionally hidden: it never makes sense |
| 328 // to call these on a WebLocalFrame. | 338 // to call these on a WebLocalFrame. |
| 329 bool isWebLocalFrame() const override = 0; | 339 bool isWebLocalFrame() const override = 0; |
| 330 WebLocalFrame* toWebLocalFrame() override = 0; | 340 WebLocalFrame* toWebLocalFrame() override = 0; |
| 331 bool isWebRemoteFrame() const override = 0; | 341 bool isWebRemoteFrame() const override = 0; |
| 332 WebRemoteFrame* toWebRemoteFrame() override = 0; | 342 WebRemoteFrame* toWebRemoteFrame() override = 0; |
| 333 }; | 343 }; |
| 334 | 344 |
| 335 } // namespace blink | 345 } // namespace blink |
| 336 | 346 |
| 337 #endif // WebLocalFrame_h | 347 #endif // WebLocalFrame_h |
| OLD | NEW |