mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 132813 - PPEmbed doesn't send notification for security changes. r=pink/sr=beard/a=asa
This commit is contained in:
parent
71ab3ad793
commit
b4f58d10a5
Binary file not shown.
@ -96,6 +96,13 @@ enum {
|
||||
str_SearchPlugInsDirName
|
||||
};
|
||||
|
||||
// Icons
|
||||
enum {
|
||||
icon_LockInsecure = 1320,
|
||||
icon_LockSecure,
|
||||
icon_LockBroken
|
||||
};
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//*** Message IDs
|
||||
|
@ -53,8 +53,9 @@ enum {
|
||||
msg_OnProgressChange = EMBED_MSG_BASE_ID + 2,
|
||||
msg_OnLocationChange = EMBED_MSG_BASE_ID + 3,
|
||||
msg_OnStatusChange = EMBED_MSG_BASE_ID + 4,
|
||||
msg_OnSecurityChange = EMBED_MSG_BASE_ID + 5,
|
||||
|
||||
msg_OnChromeStatusChange = EMBED_MSG_BASE_ID + 5
|
||||
msg_OnChromeStatusChange = EMBED_MSG_BASE_ID + 6
|
||||
};
|
||||
|
||||
|
||||
@ -120,6 +121,19 @@ struct MsgStatusChangeInfo
|
||||
const PRUnichar *mMessage;
|
||||
};
|
||||
|
||||
// msg_OnSecurityChange
|
||||
struct MsgSecurityChangeInfo
|
||||
{
|
||||
MsgSecurityChangeInfo(CBrowserShell* broadcaster,
|
||||
PRInt32 state) :
|
||||
mBroadcaster(broadcaster),
|
||||
mState(state)
|
||||
{ }
|
||||
|
||||
CBrowserShell *mBroadcaster;
|
||||
PRInt32 mState;
|
||||
};
|
||||
|
||||
// msg_OnChromeStatusChange
|
||||
// See nsIWebBrowserChrome::SetStatus
|
||||
struct MsgChromeStatusChangeInfo
|
||||
@ -134,6 +148,6 @@ struct MsgChromeStatusChangeInfo
|
||||
CBrowserShell *mBroadcaster;
|
||||
PRUint32 mStatusType;
|
||||
const PRUnichar *mStatus;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // __CBrowserShellMsgDefs__
|
||||
|
@ -229,7 +229,12 @@ NS_IMETHODIMP CBrowserShellProgressListener::OnStatusChange(nsIWebProgress *aWeb
|
||||
|
||||
NS_IMETHODIMP CBrowserShellProgressListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 state)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
NS_ENSURE_TRUE(mpOwner, NS_ERROR_NULL_POINTER);
|
||||
|
||||
MsgSecurityChangeInfo info(mpOwner, state);
|
||||
mpOwner->BroadcastMessage(msg_OnSecurityChange, &info);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,11 +35,11 @@
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
|
||||
#include "CBrowserWindow.h"
|
||||
#include "CBrowserShell.h"
|
||||
#include "CBrowserMsgDefs.h"
|
||||
#include "CWebBrowserChrome.h"
|
||||
#include "CThrobber.h"
|
||||
#include "ApplIDs.h"
|
||||
#include "UMacUnicode.h"
|
||||
@ -49,6 +49,7 @@
|
||||
#include <LWindowHeader.h>
|
||||
#include <LBevelButton.h>
|
||||
#include <LProgressBar.h>
|
||||
#include <LIconControl.h>
|
||||
|
||||
#if PP_Target_Carbon
|
||||
#include <UEventMgr.h>
|
||||
@ -70,10 +71,11 @@ enum
|
||||
paneID_ForwardButton = 'Forw',
|
||||
paneID_ReloadButton = 'RLoa',
|
||||
paneID_StopButton = 'Stop',
|
||||
paneID_URLField = 'gUrl',
|
||||
paneID_URLField = 'gUrl',
|
||||
paneID_StatusBar = 'Stat',
|
||||
paneID_Throbber = 'THRB',
|
||||
paneID_ProgressBar = 'Prog'
|
||||
paneID_Throbber = 'THRB',
|
||||
paneID_ProgressBar = 'Prog',
|
||||
paneID_LockIcon = 'Lock'
|
||||
};
|
||||
|
||||
|
||||
@ -84,7 +86,7 @@ enum
|
||||
CBrowserWindow::CBrowserWindow() :
|
||||
mURLField(NULL), mStatusBar(NULL), mThrobber(NULL),
|
||||
mBackButton(NULL), mForwardButton(NULL), mStopButton(NULL),
|
||||
mProgressBar(NULL)
|
||||
mProgressBar(NULL), mLockIcon(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -102,7 +104,7 @@ CBrowserWindow::CBrowserWindow(LCommander* inSuperCommander,
|
||||
LWindow(inSuperCommander, inGlobalBounds, inTitle, inProcID, inAttributes, inBehind),
|
||||
mURLField(NULL), mStatusBar(NULL), mThrobber(NULL),
|
||||
mBackButton(NULL), mForwardButton(NULL), mStopButton(NULL),
|
||||
mProgressBar(NULL)
|
||||
mProgressBar(NULL), mLockIcon(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -115,7 +117,7 @@ CBrowserWindow::CBrowserWindow(LStream* inStream) :
|
||||
LWindow(inStream),
|
||||
mURLField(NULL), mStatusBar(NULL), mThrobber(NULL),
|
||||
mBackButton(NULL), mForwardButton(NULL), mStopButton(NULL),
|
||||
mProgressBar(NULL)
|
||||
mProgressBar(NULL), mLockIcon(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -147,6 +149,7 @@ void CBrowserWindow::FinishCreateSelf()
|
||||
mURLField = dynamic_cast<LEditText*>(FindPaneByID(paneID_URLField));
|
||||
mStatusBar = dynamic_cast<LStaticText*>(FindPaneByID(paneID_StatusBar));
|
||||
mThrobber = dynamic_cast<CThrobber*>(FindPaneByID(paneID_Throbber));
|
||||
mLockIcon = dynamic_cast<LIconControl*>(FindPaneByID(paneID_LockIcon));
|
||||
mProgressBar = dynamic_cast<LProgressBar*>(FindPaneByID(paneID_ProgressBar));
|
||||
if (mProgressBar)
|
||||
mProgressBar->Hide();
|
||||
@ -280,6 +283,35 @@ void CBrowserWindow::ListenToMessage(MessageT inMessage,
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case msg_OnSecurityChange:
|
||||
{
|
||||
const MsgSecurityChangeInfo *info = reinterpret_cast<MsgSecurityChangeInfo*>(ioParam);
|
||||
|
||||
if (mLockIcon) {
|
||||
SInt16 iconID;
|
||||
switch (info->mState & 0x0000FFFF)
|
||||
{
|
||||
case nsIWebProgressListener::STATE_IS_SECURE:
|
||||
iconID = icon_LockSecure;
|
||||
break;
|
||||
case nsIWebProgressListener::STATE_IS_BROKEN:
|
||||
iconID = icon_LockBroken;
|
||||
break;
|
||||
case nsIWebProgressListener::STATE_IS_INSECURE:
|
||||
iconID = icon_LockInsecure;
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("Unknown security state!");
|
||||
iconID = icon_LockInsecure;
|
||||
break;
|
||||
}
|
||||
// The kControlIconResourceIDTag requires Appearance 1.1
|
||||
// That's present on 8.5 and up and mozilla requires 8.6.
|
||||
mLockIcon->SetDataTag(0, kControlIconResourceIDTag, sizeof(iconID), &iconID);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case msg_OnChromeStatusChange:
|
||||
{
|
||||
|
@ -29,6 +29,7 @@ class LEditText;
|
||||
class LStaticText;
|
||||
class CThrobber;
|
||||
class LProgressBar;
|
||||
class LIconControl;
|
||||
|
||||
|
||||
// CBrowserWindow:
|
||||
@ -75,6 +76,7 @@ protected:
|
||||
CThrobber* mThrobber;
|
||||
LControl *mBackButton, *mForwardButton, *mReloadButton, *mStopButton;
|
||||
LProgressBar* mProgressBar;
|
||||
LIconControl* mLockIcon;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user