зеркало из https://github.com/mozilla/pjs.git
infastructure for bug 41966 - getting key bindings working for the gtk embedding widget r=valeski, a=waterson
This commit is contained in:
Родитель
5f510ec57d
Коммит
99c9657eb1
|
@ -60,12 +60,12 @@ GtkMozEmbedChrome::GtkMozEmbedChrome()
|
||||||
mVisibility = PR_FALSE;
|
mVisibility = PR_FALSE;
|
||||||
mLinkMessage = NULL;
|
mLinkMessage = NULL;
|
||||||
mJSStatus = NULL;
|
mJSStatus = NULL;
|
||||||
mLocation = NULL;
|
|
||||||
mTitle = NULL;
|
mTitle = NULL;
|
||||||
mChromeMask = 0;
|
mChromeMask = 0;
|
||||||
mOffset = 0;
|
mOffset = 0;
|
||||||
mDoingStream = PR_FALSE;
|
mDoingStream = PR_FALSE;
|
||||||
mChromeListener = 0;
|
mChromeListener = 0;
|
||||||
|
mContentShell = 0;
|
||||||
if (!mozEmbedLm)
|
if (!mozEmbedLm)
|
||||||
mozEmbedLm = PR_NewLogModule("GtkMozEmbedChrome");
|
mozEmbedLm = PR_NewLogModule("GtkMozEmbedChrome");
|
||||||
if (!sBrowsers)
|
if (!sBrowsers)
|
||||||
|
@ -91,7 +91,7 @@ NS_INTERFACE_MAP_BEGIN(GtkMozEmbedChrome)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
|
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIURIContentListener)
|
NS_INTERFACE_MAP_ENTRY(nsIURIContentListener)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
|
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
|
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
@ -133,16 +133,6 @@ NS_IMETHODIMP GtkMozEmbedChrome::GetJSStatus (char **retval)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP GtkMozEmbedChrome::GetLocation (char **retval)
|
|
||||||
{
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetLocation\n"));
|
|
||||||
NS_ENSURE_ARG_POINTER(retval);
|
|
||||||
*retval = NULL;
|
|
||||||
if (mLocation)
|
|
||||||
*retval = nsCRT::strdup(mLocation);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP GtkMozEmbedChrome::GetTitleChar (char **retval)
|
NS_IMETHODIMP GtkMozEmbedChrome::GetTitleChar (char **retval)
|
||||||
{
|
{
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetTitleChar\n"));
|
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetTitleChar\n"));
|
||||||
|
@ -189,8 +179,18 @@ NS_IMETHODIMP GtkMozEmbedChrome::OpenStream (const char *aBaseURI, const char *a
|
||||||
// release our second reference to it.
|
// release our second reference to it.
|
||||||
NS_RELEASE(newStream);
|
NS_RELEASE(newStream);
|
||||||
|
|
||||||
// get our hands on the docShell
|
// get our hands on the primary content area of that docshell
|
||||||
mWebBrowser->GetDocShell(getter_AddRefs(docShell));
|
// get the browser as an item
|
||||||
|
nsCOMPtr<nsIDocShellTreeItem> browserAsItem;
|
||||||
|
browserAsItem = do_QueryInterface(mWebBrowser);
|
||||||
|
// get the tree owner for that item
|
||||||
|
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||||
|
browserAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
|
||||||
|
// get the primary content shell as an item
|
||||||
|
nsCOMPtr<nsIDocShellTreeItem> contentItem;
|
||||||
|
treeOwner->GetPrimaryContentShell(getter_AddRefs(contentItem));
|
||||||
|
// QI that back to a docshell
|
||||||
|
docShell = do_QueryInterface(contentItem);
|
||||||
if (!docShell)
|
if (!docShell)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
@ -269,7 +269,9 @@ NS_IMETHODIMP GtkMozEmbedChrome::OpenStream (const char *aBaseURI, const char *a
|
||||||
|
|
||||||
NS_IMETHODIMP GtkMozEmbedChrome::AppendToStream (const char *aData, gint32 aLen)
|
NS_IMETHODIMP GtkMozEmbedChrome::AppendToStream (const char *aData, gint32 aLen)
|
||||||
{
|
{
|
||||||
GtkMozEmbedStream *embedStream = (GtkMozEmbedStream *)mStream.get();
|
nsIInputStream *inputStream;
|
||||||
|
inputStream = mStream.get();
|
||||||
|
GtkMozEmbedStream *embedStream = (GtkMozEmbedStream *)inputStream;
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_ENSURE_STATE(mDoingStream);
|
NS_ENSURE_STATE(mDoingStream);
|
||||||
rv = embedStream->Append(aData, aLen);
|
rv = embedStream->Append(aData, aLen);
|
||||||
|
@ -387,9 +389,6 @@ NS_IMETHODIMP GtkMozEmbedChrome::GetNewBrowser(PRUint32 chromeMask,
|
||||||
nsIWebBrowser **_retval)
|
nsIWebBrowser **_retval)
|
||||||
{
|
{
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetNewBrowser\n"));
|
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetNewBrowser\n"));
|
||||||
if (mChromeListener)
|
|
||||||
return mChromeListener->NewBrowser(chromeMask, _retval);
|
|
||||||
else
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,92 +538,84 @@ NS_IMETHODIMP GtkMozEmbedChrome::SetParentContentListener(nsIURIContentListener
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nsIWebProgressListener
|
// nsIDocShellTreeOwner interface
|
||||||
|
|
||||||
NS_IMETHODIMP GtkMozEmbedChrome::OnProgressChange(nsIWebProgress *aProgress,
|
NS_IMETHODIMP GtkMozEmbedChrome::FindItemWithName(const PRUnichar *aName,
|
||||||
nsIRequest *aRequest,
|
nsIDocShellTreeItem *aRequestor,
|
||||||
PRInt32 curSelfProgress,
|
nsIDocShellTreeItem **_retval)
|
||||||
PRInt32 maxSelfProgress,
|
|
||||||
PRInt32 curTotalProgress,
|
|
||||||
PRInt32 maxTotalProgress)
|
|
||||||
{
|
{
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::OnProgressChange\n"));
|
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::FindItemWithName\n"));
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("curTotalProgress is %d and maxTotalProgress is %d\n",
|
NS_ENSURE_ARG_POINTER(_retval);
|
||||||
curTotalProgress, maxTotalProgress));
|
*_retval = nsnull;
|
||||||
// avoid those pesky divide by zero errors
|
|
||||||
if (maxTotalProgress > 0)
|
PRInt32 i = 0;
|
||||||
|
PRInt32 numBrowsers = sBrowsers->Count();
|
||||||
|
|
||||||
|
for (i = 0; i < numBrowsers; i++)
|
||||||
{
|
{
|
||||||
PRUint32 percentage = (curTotalProgress * 100) / maxTotalProgress;
|
GtkMozEmbedChrome *chrome = (GtkMozEmbedChrome *)sBrowsers->ElementAt(i);
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("%d%% percent\n", percentage));
|
nsCOMPtr<nsIWebBrowser> webBrowser;
|
||||||
|
NS_ENSURE_SUCCESS(chrome->GetWebBrowser(getter_AddRefs(webBrowser)),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(webBrowser));
|
||||||
|
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
docShellAsItem->FindItemWithName(aName, NS_STATIC_CAST(nsIWebBrowserChrome *, this), _retval);
|
||||||
|
if (*_retval)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP GtkMozEmbedChrome::ContentShellAdded(nsIDocShellTreeItem *aContentShell,
|
||||||
|
PRBool aPrimary,
|
||||||
|
const PRUnichar *aID)
|
||||||
|
{
|
||||||
|
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::ContentShellAdded\n"));
|
||||||
|
if (aPrimary)
|
||||||
|
mContentShell = aContentShell;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP GtkMozEmbedChrome::GetPrimaryContentShell(nsIDocShellTreeItem **aPrimaryContentShell)
|
||||||
|
{
|
||||||
|
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetPrimaryContentShell\n"));
|
||||||
|
NS_IF_ADDREF(mContentShell);
|
||||||
|
*aPrimaryContentShell = mContentShell;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP GtkMozEmbedChrome::SizeShellTo(nsIDocShellTreeItem *shell,
|
||||||
|
PRInt32 cx, PRInt32 cy)
|
||||||
|
{
|
||||||
|
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SizeShellTo\n"));
|
||||||
|
if (mChromeListener)
|
||||||
|
mChromeListener->SizeTo(cx, cy);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP GtkMozEmbedChrome::ShowModal(void)
|
||||||
|
{
|
||||||
|
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::ShowModal\n"));
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP GtkMozEmbedChrome::ExitModalLoop(nsresult aStatus)
|
||||||
|
{
|
||||||
|
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::ExitModalLoop\n"));
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP GtkMozEmbedChrome::GetNewWindow(PRInt32 aChromeFlags,
|
||||||
|
nsIDocShellTreeItem **_retval)
|
||||||
|
{
|
||||||
|
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetNewWindow\n"));
|
||||||
|
if (mChromeListener)
|
||||||
|
return mChromeListener->NewBrowser(aChromeFlags, _retval);
|
||||||
else
|
else
|
||||||
{
|
return NS_ERROR_FAILURE;
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("Unknown percent\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mChromeListener) {
|
|
||||||
mChromeListener->ProgressChange(aProgress, aRequest,
|
|
||||||
curSelfProgress,
|
|
||||||
maxSelfProgress,
|
|
||||||
curTotalProgress,
|
|
||||||
maxTotalProgress);
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP GtkMozEmbedChrome::OnStateChange(nsIWebProgress *aProgress,
|
|
||||||
nsIRequest *aRequest,
|
|
||||||
PRInt32 aStateFlags, nsresult aStatus)
|
|
||||||
{
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::OnStateChange\n"));
|
|
||||||
if (aStateFlags & nsIWebProgressListener::flag_start)
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_start\n"));
|
|
||||||
if (aStateFlags & nsIWebProgressListener::flag_redirecting)
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_redirecting\n"));
|
|
||||||
if (aStateFlags & nsIWebProgressListener::flag_negotiating)
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_negotiating\n"));
|
|
||||||
if (aStateFlags & nsIWebProgressListener::flag_transferring)
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_transferring\n"));
|
|
||||||
if (aStateFlags & nsIWebProgressListener::flag_stop)
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_stop\n"));
|
|
||||||
if (aStateFlags & nsIWebProgressListener::flag_is_request)
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_is_request\n"));
|
|
||||||
if (aStateFlags & nsIWebProgressListener::flag_is_document)
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_is_document\n"));
|
|
||||||
if (aStateFlags & nsIWebProgressListener::flag_is_network)
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_is_network\n"));
|
|
||||||
if (aStateFlags & nsIWebProgressListener::flag_is_window)
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_is_window\n"));
|
|
||||||
|
|
||||||
// let the listener know that a network event has happened
|
|
||||||
if (mChromeListener)
|
|
||||||
mChromeListener->Net(aProgress, aRequest, aStateFlags, aStatus);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP GtkMozEmbedChrome::OnLocationChange(nsIWebProgress* aWebProgress,
|
|
||||||
nsIRequest* aRequest,
|
|
||||||
nsIURI *aLocation)
|
|
||||||
{
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::OnLocationChange\n"));
|
|
||||||
char *newURIString = NULL;
|
|
||||||
NS_ENSURE_ARG_POINTER(aLocation);
|
|
||||||
aLocation->GetSpec(&newURIString);
|
|
||||||
mLocation = newURIString;
|
|
||||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("new location is %s\n", (const char *)mLocation));
|
|
||||||
// let the chrome listener know that the location has changed
|
|
||||||
if (mChromeListener)
|
|
||||||
mChromeListener->Message(GtkEmbedListener::MessageLocation, mLocation);
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
GtkMozEmbedChrome::OnStatusChange(nsIWebProgress* aWebProgress,
|
|
||||||
nsIRequest* aRequest,
|
|
||||||
nsresult aStatus,
|
|
||||||
const PRUnichar* aMessage)
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// nsIBaseWindow interface
|
// nsIBaseWindow interface
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#include "nsIChannel.h"
|
#include "nsIChannel.h"
|
||||||
#include "nsIContentViewer.h"
|
#include "nsIContentViewer.h"
|
||||||
#include "nsIStreamListener.h"
|
#include "nsIStreamListener.h"
|
||||||
|
#include "nsIDocShellTreeOwner.h"
|
||||||
|
#include "nsIDocShellTreeItem.h"
|
||||||
|
|
||||||
// utility classes
|
// utility classes
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
|
@ -51,7 +53,7 @@ class GtkMozEmbedChrome : public nsIGtkEmbed,
|
||||||
public nsIWebBrowserChrome,
|
public nsIWebBrowserChrome,
|
||||||
public nsIBaseWindow,
|
public nsIBaseWindow,
|
||||||
public nsIURIContentListener,
|
public nsIURIContentListener,
|
||||||
public nsIWebProgressListener,
|
public nsIDocShellTreeOwner,
|
||||||
public nsIInterfaceRequestor
|
public nsIInterfaceRequestor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -65,7 +67,6 @@ public:
|
||||||
NS_IMETHOD SetEmbedListener (GtkEmbedListener *aListener);
|
NS_IMETHOD SetEmbedListener (GtkEmbedListener *aListener);
|
||||||
NS_IMETHOD GetLinkMessage (char **retval);
|
NS_IMETHOD GetLinkMessage (char **retval);
|
||||||
NS_IMETHOD GetJSStatus (char **retval);
|
NS_IMETHOD GetJSStatus (char **retval);
|
||||||
NS_IMETHOD GetLocation (char **retval);
|
|
||||||
NS_IMETHOD GetTitleChar (char **retval);
|
NS_IMETHOD GetTitleChar (char **retval);
|
||||||
NS_IMETHOD OpenStream (const char *aBaseURI, const char *aContentType);
|
NS_IMETHOD OpenStream (const char *aBaseURI, const char *aContentType);
|
||||||
NS_IMETHOD AppendToStream (const char *aData, gint32 aLen);
|
NS_IMETHOD AppendToStream (const char *aData, gint32 aLen);
|
||||||
|
@ -79,7 +80,7 @@ public:
|
||||||
|
|
||||||
NS_DECL_NSIURICONTENTLISTENER
|
NS_DECL_NSIURICONTENTLISTENER
|
||||||
|
|
||||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
NS_DECL_NSIDOCSHELLTREEOWNER
|
||||||
|
|
||||||
NS_DECL_NSIBASEWINDOW
|
NS_DECL_NSIBASEWINDOW
|
||||||
|
|
||||||
|
@ -90,7 +91,6 @@ private:
|
||||||
PRBool mVisibility;
|
PRBool mVisibility;
|
||||||
nsXPIDLCString mLinkMessage;
|
nsXPIDLCString mLinkMessage;
|
||||||
nsXPIDLCString mJSStatus;
|
nsXPIDLCString mJSStatus;
|
||||||
nsXPIDLCString mLocation;
|
|
||||||
nsXPIDLCString mTitle;
|
nsXPIDLCString mTitle;
|
||||||
nsString mTitleUnicode;
|
nsString mTitleUnicode;
|
||||||
PRUint32 mChromeMask;
|
PRUint32 mChromeMask;
|
||||||
|
@ -103,6 +103,7 @@ private:
|
||||||
PRUint32 mOffset;
|
PRUint32 mOffset;
|
||||||
PRBool mDoingStream;
|
PRBool mDoingStream;
|
||||||
GtkEmbedListener *mChromeListener;
|
GtkEmbedListener *mChromeListener;
|
||||||
|
nsIDocShellTreeItem *mContentShell;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __GtkMozEmbedChrome_h */
|
#endif /* __GtkMozEmbedChrome_h */
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,82 +0,0 @@
|
||||||
/*
|
|
||||||
* The contents of this file are subject to the Mozilla Public
|
|
||||||
* License Version 1.1 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS
|
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
||||||
* implied. See the License for the specific language governing
|
|
||||||
* rights and limitations under the License.
|
|
||||||
*
|
|
||||||
* The Original Code is mozilla.org code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is Christopher Blizzard.
|
|
||||||
* Portions created by Christopher Blizzard are Copyright (C)
|
|
||||||
* Christopher Blizzard. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Christopher Blizzard <blizzard@mozilla.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __nsIGtkEmbed_h__
|
|
||||||
#define __nsIGtkEmbed_h__
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
#include "nsIWebBrowser.h"
|
|
||||||
#include "nsIWebProgress.h"
|
|
||||||
#include "nsIRequest.h"
|
|
||||||
|
|
||||||
#define NS_IGTKEMBED_IID_STR "ebe19ea4-1dd1-11b2-bc20-8e8105516b2f"
|
|
||||||
|
|
||||||
#define NS_IGTKEMBED_IID \
|
|
||||||
{0xebe19ea4, 0x1dd1, 0x11b2, \
|
|
||||||
{ 0xbc, 0x20, 0x8e, 0x81, 0x05, 0x51, 0x6b, 0x2f }}
|
|
||||||
|
|
||||||
class GtkEmbedListener
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum GtkEmbedListenerMessageType
|
|
||||||
{
|
|
||||||
MessageLink = 0,
|
|
||||||
MessageJSStatus,
|
|
||||||
MessageLocation,
|
|
||||||
MessageTitle
|
|
||||||
};
|
|
||||||
virtual nsresult NewBrowser(PRUint32 chromeMask,
|
|
||||||
nsIWebBrowser **_retval) = 0;
|
|
||||||
virtual void Destroy(void) = 0;
|
|
||||||
virtual void Visibility(PRBool aVisibility) = 0;
|
|
||||||
virtual void Message(GtkEmbedListenerMessageType aType,
|
|
||||||
const char *aMessage) = 0;
|
|
||||||
virtual void ProgressChange(nsIWebProgress *aProgress,
|
|
||||||
nsIRequest *aRequest,
|
|
||||||
PRInt32 curSelfProgress,
|
|
||||||
PRInt32 maxSelfProgress,
|
|
||||||
PRInt32 curTotalProgress,
|
|
||||||
PRInt32 maxTotalProgress) = 0;
|
|
||||||
virtual void Net(nsIWebProgress *aProgress,
|
|
||||||
nsIRequest *aRequest,
|
|
||||||
PRInt32 aFlags, nsresult aStatus) = 0;
|
|
||||||
virtual PRBool StartOpen(const char *aURI) = 0;
|
|
||||||
virtual void SizeTo(PRInt32 width, PRInt32 height) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class nsIGtkEmbed : public nsISupports
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IGTKEMBED_IID)
|
|
||||||
|
|
||||||
NS_IMETHOD Init (GtkWidget *aOwningWidget) = 0;
|
|
||||||
NS_IMETHOD SetEmbedListener (GtkEmbedListener *aListener) = 0;
|
|
||||||
NS_IMETHOD GetLinkMessage (char **retval) = 0;
|
|
||||||
NS_IMETHOD GetJSStatus (char **retval) = 0;
|
|
||||||
NS_IMETHOD GetLocation (char **retval) = 0;
|
|
||||||
NS_IMETHOD GetTitleChar (char **retval) = 0;
|
|
||||||
NS_IMETHOD OpenStream (const char *aBaseURI, const char *aContentType) = 0;
|
|
||||||
NS_IMETHOD AppendToStream (const char *aData, gint32 aLen) = 0;
|
|
||||||
NS_IMETHOD CloseStream (void) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* __nsIGtkEmbed_h__ */
|
|
|
@ -684,6 +684,9 @@ void progress_change_cb (GtkMozEmbed *embed, gint cur, gint max,
|
||||||
{
|
{
|
||||||
browser->bytesLoaded = cur;
|
browser->bytesLoaded = cur;
|
||||||
browser->maxBytesLoaded = max;
|
browser->maxBytesLoaded = max;
|
||||||
|
if (cur > max)
|
||||||
|
browser->loadPercent = 100;
|
||||||
|
else
|
||||||
browser->loadPercent = (cur * 100) / max;
|
browser->loadPercent = (cur * 100) / max;
|
||||||
update_status_bar_text(browser);
|
update_status_bar_text(browser);
|
||||||
gtk_progress_set_percentage(GTK_PROGRESS(browser->progressBar), browser->loadPercent / 100.0);
|
gtk_progress_set_percentage(GTK_PROGRESS(browser->progressBar), browser->loadPercent / 100.0);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче