Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef nsWebBrowserFindImpl_h__ |
michael@0 | 8 | #define nsWebBrowserFindImpl_h__ |
michael@0 | 9 | |
michael@0 | 10 | #include "nsIWebBrowserFind.h" |
michael@0 | 11 | |
michael@0 | 12 | #include "nsCOMPtr.h" |
michael@0 | 13 | #include "nsWeakReference.h" |
michael@0 | 14 | |
michael@0 | 15 | #include "nsIFind.h" |
michael@0 | 16 | |
michael@0 | 17 | #include "nsString.h" |
michael@0 | 18 | |
michael@0 | 19 | #define NS_WEB_BROWSER_FIND_CONTRACTID "@mozilla.org/embedcomp/find;1" |
michael@0 | 20 | |
michael@0 | 21 | #define NS_WEB_BROWSER_FIND_CID \ |
michael@0 | 22 | {0x57cf9383, 0x3405, 0x11d5, {0xbe, 0x5b, 0xaa, 0x20, 0xfa, 0x2c, 0xf3, 0x7c}} |
michael@0 | 23 | |
michael@0 | 24 | class nsISelection; |
michael@0 | 25 | class nsIDOMWindow; |
michael@0 | 26 | |
michael@0 | 27 | class nsIDocShell; |
michael@0 | 28 | |
michael@0 | 29 | //***************************************************************************** |
michael@0 | 30 | // class nsWebBrowserFind |
michael@0 | 31 | //***************************************************************************** |
michael@0 | 32 | |
michael@0 | 33 | class nsWebBrowserFind : public nsIWebBrowserFind, |
michael@0 | 34 | public nsIWebBrowserFindInFrames |
michael@0 | 35 | { |
michael@0 | 36 | public: |
michael@0 | 37 | nsWebBrowserFind(); |
michael@0 | 38 | virtual ~nsWebBrowserFind(); |
michael@0 | 39 | |
michael@0 | 40 | // nsISupports |
michael@0 | 41 | NS_DECL_ISUPPORTS |
michael@0 | 42 | |
michael@0 | 43 | // nsIWebBrowserFind |
michael@0 | 44 | NS_DECL_NSIWEBBROWSERFIND |
michael@0 | 45 | |
michael@0 | 46 | // nsIWebBrowserFindInFrames |
michael@0 | 47 | NS_DECL_NSIWEBBROWSERFINDINFRAMES |
michael@0 | 48 | |
michael@0 | 49 | |
michael@0 | 50 | protected: |
michael@0 | 51 | |
michael@0 | 52 | bool CanFindNext() |
michael@0 | 53 | { return mSearchString.Length() != 0; } |
michael@0 | 54 | |
michael@0 | 55 | nsresult SearchInFrame(nsIDOMWindow* aWindow, bool aWrapping, |
michael@0 | 56 | bool* didFind); |
michael@0 | 57 | |
michael@0 | 58 | nsresult OnStartSearchFrame(nsIDOMWindow *aWindow); |
michael@0 | 59 | nsresult OnEndSearchFrame(nsIDOMWindow *aWindow); |
michael@0 | 60 | |
michael@0 | 61 | void GetFrameSelection(nsIDOMWindow* aWindow, nsISelection** aSel); |
michael@0 | 62 | nsresult ClearFrameSelection(nsIDOMWindow *aWindow); |
michael@0 | 63 | |
michael@0 | 64 | nsresult OnFind(nsIDOMWindow *aFoundWindow); |
michael@0 | 65 | |
michael@0 | 66 | nsIDocShell *GetDocShellFromWindow(nsIDOMWindow *inWindow); |
michael@0 | 67 | |
michael@0 | 68 | void SetSelectionAndScroll(nsIDOMWindow* aWindow, |
michael@0 | 69 | nsIDOMRange* aRange); |
michael@0 | 70 | |
michael@0 | 71 | nsresult GetRootNode(nsIDOMDocument* aDomDoc, nsIDOMNode** aNode); |
michael@0 | 72 | nsresult GetSearchLimits(nsIDOMRange* aRange, |
michael@0 | 73 | nsIDOMRange* aStartPt, |
michael@0 | 74 | nsIDOMRange* aEndPt, |
michael@0 | 75 | nsIDOMDocument* aDoc, |
michael@0 | 76 | nsISelection* aSel, |
michael@0 | 77 | bool aWrap); |
michael@0 | 78 | nsresult SetRangeAroundDocument(nsIDOMRange* aSearchRange, |
michael@0 | 79 | nsIDOMRange* aStartPoint, |
michael@0 | 80 | nsIDOMRange* aEndPoint, |
michael@0 | 81 | nsIDOMDocument* aDoc); |
michael@0 | 82 | |
michael@0 | 83 | protected: |
michael@0 | 84 | |
michael@0 | 85 | nsString mSearchString; |
michael@0 | 86 | |
michael@0 | 87 | bool mFindBackwards; |
michael@0 | 88 | bool mWrapFind; |
michael@0 | 89 | bool mEntireWord; |
michael@0 | 90 | bool mMatchCase; |
michael@0 | 91 | |
michael@0 | 92 | bool mSearchSubFrames; |
michael@0 | 93 | bool mSearchParentFrames; |
michael@0 | 94 | |
michael@0 | 95 | nsWeakPtr mCurrentSearchFrame; // who knows if windows can go away during our lifetime, hence weak |
michael@0 | 96 | nsWeakPtr mRootSearchFrame; // who knows if windows can go away during our lifetime, hence weak |
michael@0 | 97 | nsWeakPtr mLastFocusedWindow; // who knows if windows can go away during our lifetime, hence weak |
michael@0 | 98 | }; |
michael@0 | 99 | |
michael@0 | 100 | #endif |