InPageSearchManager.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef InPageSearchManager_h
  19. #define InPageSearchManager_h
  20. #include "FindOptions.h"
  21. #include <wtf/text/WTFString.h>
  22. namespace WebCore {
  23. class Frame;
  24. class Range;
  25. class VisibleSelection;
  26. }
  27. namespace BlackBerry {
  28. namespace WebKit {
  29. class WebPagePrivate;
  30. class InPageSearchManager {
  31. public:
  32. InPageSearchManager(WebPagePrivate*);
  33. ~InPageSearchManager();
  34. bool findNextString(const String&, WebCore::FindOptions, bool wrap, bool highlightAllMatches, bool selectActiveMatchOnClear);
  35. void frameUnloaded(const WebCore::Frame*);
  36. private:
  37. class DeferredScopeStringMatches;
  38. friend class DeferredScopeStringMatches;
  39. void clearTextMatches(bool selectActiveMatchOnClear = false);
  40. void setActiveMatchAndMarker(PassRefPtr<WebCore::Range>);
  41. bool findAndMarkText(const String&, WebCore::Range*, WebCore::Frame*, const WebCore::FindOptions&, bool /* isNewSearch */, bool /* startFromSelection */);
  42. bool shouldSearchForText(const String&);
  43. void scopeStringMatches(const String& text, bool reset, bool locateActiveMatchOnly, WebCore::Frame* scopingFrame = 0);
  44. void scopeStringMatchesSoon(WebCore::Frame* scopingFrame, const String& text, bool reset, bool locateActiveMatchOnly);
  45. void callScopeStringMatches(DeferredScopeStringMatches* caller, WebCore::Frame* scopingFrame, const String& text, bool reset, bool locateActiveMatchOnly);
  46. void cancelPendingScopingEffort();
  47. Vector<DeferredScopeStringMatches*> m_deferredScopingWork;
  48. WebPagePrivate* m_webPage;
  49. RefPtr<WebCore::Range> m_activeMatch;
  50. RefPtr<WebCore::Range> m_resumeScopingFromRange;
  51. String m_activeSearchString;
  52. int m_activeMatchCount;
  53. bool m_scopingComplete;
  54. bool m_scopingCaseInsensitive;
  55. bool m_locatingActiveMatch;
  56. bool m_highlightAllMatches;
  57. int m_activeMatchIndex;
  58. };
  59. }
  60. }
  61. #endif // InPageSearchManager_h