fpbrowser: Prepares the possibility to have a module which changes the HTML

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1925 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-09-08 14:16:34 +00:00
parent 9f5841738c
commit b1df51512d
2 changed files with 18 additions and 4 deletions

View File

@ -16,7 +16,7 @@ type
ShortDescription: string;
Activated: Boolean;
constructor Create; virtual;
function HandleOnPageLoad(APage: TStream): string; virtual;
function HandleOnPageLoad(AInput: string; out AOutput: string): Boolean;
end;
procedure RegisterBrowserModule(AModule: TBrowserModule);
@ -52,9 +52,10 @@ begin
end;
function TBrowserModule.HandleOnPageLoad(APage: TStream): string;
function TBrowserModule.HandleOnPageLoad(AInput: string; out AOutput: string): Boolean;
begin
AOutput := '';
Result := False;
end;
initialization

View File

@ -5,7 +5,8 @@ unit pageloader;
interface
uses
Classes, SysUtils;
Classes, SysUtils,
browsermodules;
type
@ -54,8 +55,20 @@ begin
end;
procedure TPageLoaderThread.Execute;
var
lModule: TBrowserModule;
lNewContents: string;
i: Integer;
begin
PageLoader.LoadFromURL(URL);
// Run all modules which might want to change the HTML
for i := 0 to GetBrowserModuleCount() - 1 do
begin
lModule := GetBrowserModule(i);
if lModule.HandleOnPageLoad(PageLoader.Contents, lNewContents) then
PageLoader.Contents := lNewContents;
end;
end;
procedure TPageLoaderThread.CallPageLoadProgress;