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