2000-01-22 06:15:41 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2000-01-22 06:15:41 +03:00
|
|
|
|
2000-01-26 01:00:59 +03:00
|
|
|
// Local Includes
|
2000-01-22 06:15:41 +03:00
|
|
|
#include "nsChromeTreeOwner.h"
|
|
|
|
#include "nsXULWindow.h"
|
|
|
|
|
2000-01-26 01:00:59 +03:00
|
|
|
// Helper Classes
|
|
|
|
#include "nsString.h"
|
2002-01-16 03:11:06 +03:00
|
|
|
#include "nsIEmbeddingSiteWindow.h"
|
2000-01-26 01:00:59 +03:00
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsIDocShellTreeItem.h"
|
|
|
|
|
|
|
|
// Interfaces needed to include
|
2000-02-08 19:11:10 +03:00
|
|
|
#include "nsIPrompt.h"
|
2001-04-10 22:30:25 +04:00
|
|
|
#include "nsIAuthPrompt.h"
|
2013-05-09 01:16:46 +04:00
|
|
|
#include "nsIBrowserDOMWindow.h"
|
2001-05-30 06:07:48 +04:00
|
|
|
#include "nsIWebProgress.h"
|
2013-10-22 17:27:34 +04:00
|
|
|
#include "nsIWidget.h"
|
2000-01-26 01:00:59 +03:00
|
|
|
#include "nsIWindowMediator.h"
|
2013-05-09 01:16:46 +04:00
|
|
|
#include "nsIDOMChromeWindow.h"
|
2002-08-07 05:59:22 +04:00
|
|
|
#include "nsIXULBrowserWindow.h"
|
2013-07-18 10:54:08 +04:00
|
|
|
#include "mozilla/dom/Element.h"
|
|
|
|
|
|
|
|
using namespace mozilla;
|
2000-01-26 01:00:59 +03:00
|
|
|
|
2004-02-25 05:08:34 +03:00
|
|
|
//*****************************************************************************
|
|
|
|
// nsChromeTreeOwner string literals
|
|
|
|
//*****************************************************************************
|
|
|
|
|
2017-03-14 05:26:37 +03:00
|
|
|
const nsLiteralString kPersist(u"persist");
|
|
|
|
const nsLiteralString kScreenX(u"screenX");
|
|
|
|
const nsLiteralString kScreenY(u"screenY");
|
|
|
|
const nsLiteralString kWidth(u"width");
|
|
|
|
const nsLiteralString kHeight(u"height");
|
|
|
|
const nsLiteralString kSizemode(u"sizemode");
|
|
|
|
const nsLiteralString kSpace(u" ");
|
2004-02-25 05:08:34 +03:00
|
|
|
|
2000-01-22 06:15:41 +03:00
|
|
|
//*****************************************************************************
|
|
|
|
//*** nsChromeTreeOwner: Object Management
|
|
|
|
//*****************************************************************************
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
nsChromeTreeOwner::nsChromeTreeOwner() : mXULWindow(nullptr) {}
|
2000-01-22 06:15:41 +03:00
|
|
|
|
|
|
|
nsChromeTreeOwner::~nsChromeTreeOwner() {}
|
|
|
|
|
|
|
|
//*****************************************************************************
|
|
|
|
// nsChromeTreeOwner::nsISupports
|
2017-07-06 15:00:35 +03:00
|
|
|
//*****************************************************************************
|
2000-01-22 06:15:41 +03:00
|
|
|
|
|
|
|
NS_IMPL_ADDREF(nsChromeTreeOwner)
|
|
|
|
NS_IMPL_RELEASE(nsChromeTreeOwner)
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN(nsChromeTreeOwner)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocShellTreeOwner)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
|
2000-04-12 03:50:14 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
|
2000-02-08 16:40:10 +03:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
2001-02-01 00:01:51 +03:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
2000-01-22 06:15:41 +03:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2000-02-08 16:40:10 +03:00
|
|
|
//*****************************************************************************
|
|
|
|
// nsChromeTreeOwner::nsIInterfaceRequestor
|
2017-07-06 15:00:35 +03:00
|
|
|
//*****************************************************************************
|
2000-02-08 16:40:10 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetInterface(const nsIID& aIID, void** aSink) {
|
2001-03-13 02:08:29 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aSink);
|
2000-02-08 16:40:10 +03:00
|
|
|
|
2007-02-19 18:26:48 +03:00
|
|
|
if (aIID.Equals(NS_GET_IID(nsIPrompt))) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2001-03-13 02:08:29 +03:00
|
|
|
return mXULWindow->GetInterface(aIID, aSink);
|
2007-02-19 18:26:48 +03:00
|
|
|
}
|
|
|
|
if (aIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2001-04-10 22:30:25 +04:00
|
|
|
return mXULWindow->GetInterface(aIID, aSink);
|
2007-02-19 18:26:48 +03:00
|
|
|
}
|
|
|
|
if (aIID.Equals(NS_GET_IID(nsIWebBrowserChrome))) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2001-03-13 02:08:29 +03:00
|
|
|
return mXULWindow->GetInterface(aIID, aSink);
|
2007-02-19 18:26:48 +03:00
|
|
|
}
|
|
|
|
if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow))) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2002-01-16 03:11:06 +03:00
|
|
|
return mXULWindow->GetInterface(aIID, aSink);
|
2007-02-19 18:26:48 +03:00
|
|
|
}
|
|
|
|
if (aIID.Equals(NS_GET_IID(nsIXULWindow))) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2001-11-06 04:19:39 +03:00
|
|
|
return mXULWindow->QueryInterface(aIID, aSink);
|
2007-02-19 18:26:48 +03:00
|
|
|
}
|
2001-03-13 02:08:29 +03:00
|
|
|
|
|
|
|
return QueryInterface(aIID, aSink);
|
2000-02-08 16:40:10 +03:00
|
|
|
}
|
|
|
|
|
2000-01-22 06:15:41 +03:00
|
|
|
//*****************************************************************************
|
|
|
|
// nsChromeTreeOwner::nsIDocShellTreeOwner
|
2017-07-06 15:00:35 +03:00
|
|
|
//*****************************************************************************
|
2000-01-22 06:15:41 +03:00
|
|
|
|
2007-10-06 03:37:25 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
|
2016-12-09 00:12:36 +03:00
|
|
|
bool aPrimary) {
|
2007-10-06 03:37:25 +04:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2016-12-09 00:12:36 +03:00
|
|
|
return mXULWindow->ContentShellAdded(aContentShell, aPrimary);
|
2007-10-06 03:37:25 +04:00
|
|
|
}
|
2006-02-22 06:58:48 +03:00
|
|
|
|
2007-10-06 03:37:25 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::ContentShellRemoved(nsIDocShellTreeItem* aContentShell) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->ContentShellRemoved(aContentShell);
|
2000-01-22 06:15:41 +03:00
|
|
|
}
|
|
|
|
|
2000-02-02 05:28:32 +03:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetPrimaryContentShell(
|
|
|
|
nsIDocShellTreeItem** aShell) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-02-02 05:28:32 +03:00
|
|
|
return mXULWindow->GetPrimaryContentShell(aShell);
|
|
|
|
}
|
|
|
|
|
2015-10-01 20:06:51 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::TabParentAdded(nsITabParent* aTab, bool aPrimary) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->TabParentAdded(aTab, aPrimary);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::TabParentRemoved(nsITabParent* aTab) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->TabParentRemoved(aTab);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::GetPrimaryTabParent(nsITabParent** aTab) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->GetPrimaryTabParent(aTab);
|
|
|
|
}
|
|
|
|
|
2016-07-14 23:31:41 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::GetPrimaryContentSize(int32_t* aWidth, int32_t* aHeight) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->GetPrimaryContentSize(aWidth, aHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::SetPrimaryContentSize(int32_t aWidth, int32_t aHeight) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->SetPrimaryContentSize(aWidth, aHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::GetRootShellSize(int32_t* aWidth, int32_t* aHeight) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->GetRootShellSize(aWidth, aHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::SetRootShellSize(int32_t aWidth, int32_t aHeight) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->SetRootShellSize(aWidth, aHeight);
|
|
|
|
}
|
|
|
|
|
2000-02-05 06:25:45 +03:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aCX, int32_t aCY) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-02-05 06:25:45 +03:00
|
|
|
return mXULWindow->SizeShellTo(aShellItem, aCX, aCY);
|
|
|
|
}
|
2000-07-13 03:56:14 +04:00
|
|
|
|
2001-03-09 05:04:06 +03:00
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
nsChromeTreeOwner::SetPersistence(bool aPersistPosition, bool aPersistSize,
|
|
|
|
bool aPersistSizeMode) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2013-07-18 10:54:08 +04:00
|
|
|
nsCOMPtr<dom::Element> docShellElement = mXULWindow->GetWindowDOMElement();
|
2002-08-07 05:59:22 +04:00
|
|
|
if (!docShellElement) return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsAutoString persistString;
|
2017-03-14 05:26:37 +03:00
|
|
|
docShellElement->GetAttribute(kPersist, persistString);
|
2002-08-07 05:59:22 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool saveString = false;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t index;
|
2002-08-07 05:59:22 +04:00
|
|
|
|
2004-02-25 05:08:34 +03:00
|
|
|
#define FIND_PERSIST_STRING(aString, aCond) \
|
|
|
|
index = persistString.Find(aString); \
|
|
|
|
if (!aCond && index > kNotFound) { \
|
|
|
|
persistString.Cut(index, aString.Length()); \
|
2011-10-17 18:59:28 +04:00
|
|
|
saveString = true; \
|
2004-02-25 05:08:34 +03:00
|
|
|
} else if (aCond && index == kNotFound) { \
|
2017-03-14 05:26:37 +03:00
|
|
|
persistString.Append(kSpace + aString); \
|
2011-10-17 18:59:28 +04:00
|
|
|
saveString = true; \
|
2002-08-07 05:59:22 +04:00
|
|
|
}
|
2017-03-14 05:26:37 +03:00
|
|
|
FIND_PERSIST_STRING(kScreenX, aPersistPosition);
|
|
|
|
FIND_PERSIST_STRING(kScreenY, aPersistPosition);
|
|
|
|
FIND_PERSIST_STRING(kWidth, aPersistSize);
|
|
|
|
FIND_PERSIST_STRING(kHeight, aPersistSize);
|
|
|
|
FIND_PERSIST_STRING(kSizemode, aPersistSizeMode);
|
2002-08-07 05:59:22 +04:00
|
|
|
|
2013-07-18 10:54:08 +04:00
|
|
|
ErrorResult rv;
|
|
|
|
if (saveString) {
|
2017-03-14 05:26:37 +03:00
|
|
|
docShellElement->SetAttribute(kPersist, persistString, rv);
|
2013-07-18 10:54:08 +04:00
|
|
|
}
|
2002-08-07 05:59:22 +04:00
|
|
|
|
|
|
|
return NS_OK;
|
2001-03-09 05:04:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-29 10:19:26 +04:00
|
|
|
nsChromeTreeOwner::GetPersistence(bool* aPersistPosition, bool* aPersistSize,
|
|
|
|
bool* aPersistSizeMode) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2013-07-18 10:54:08 +04:00
|
|
|
nsCOMPtr<dom::Element> docShellElement = mXULWindow->GetWindowDOMElement();
|
2002-08-07 05:59:22 +04:00
|
|
|
if (!docShellElement) return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsAutoString persistString;
|
2017-03-14 05:26:37 +03:00
|
|
|
docShellElement->GetAttribute(kPersist, persistString);
|
2002-08-07 05:59:22 +04:00
|
|
|
|
|
|
|
// data structure doesn't quite match the question, but it's close enough
|
|
|
|
// for what we want (since this method is never actually called...)
|
|
|
|
if (aPersistPosition)
|
2017-03-14 05:26:37 +03:00
|
|
|
*aPersistPosition = persistString.Find(kScreenX) > kNotFound ||
|
|
|
|
persistString.Find(kScreenY) > kNotFound;
|
2002-08-07 05:59:22 +04:00
|
|
|
if (aPersistSize)
|
2017-03-14 05:26:37 +03:00
|
|
|
*aPersistSize = persistString.Find(kWidth) > kNotFound ||
|
|
|
|
persistString.Find(kHeight) > kNotFound;
|
2002-08-07 05:59:22 +04:00
|
|
|
if (aPersistSizeMode)
|
2017-03-14 05:26:37 +03:00
|
|
|
*aPersistSizeMode = persistString.Find(kSizemode) > kNotFound;
|
2002-08-07 05:59:22 +04:00
|
|
|
|
|
|
|
return NS_OK;
|
2001-03-09 05:04:06 +03:00
|
|
|
}
|
|
|
|
|
2011-04-15 01:27:53 +04:00
|
|
|
NS_IMETHODIMP
|
2016-12-09 05:41:45 +03:00
|
|
|
nsChromeTreeOwner::GetTabCount(uint32_t* aResult) {
|
|
|
|
if (mXULWindow) {
|
|
|
|
return mXULWindow->GetTabCount(aResult);
|
|
|
|
}
|
|
|
|
|
2011-04-15 01:27:53 +04:00
|
|
|
*aResult = 0;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2016-07-14 23:31:41 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::GetHasPrimaryContent(bool* aResult) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->GetHasPrimaryContent(aResult);
|
|
|
|
}
|
|
|
|
|
2000-01-22 06:15:41 +03:00
|
|
|
//*****************************************************************************
|
|
|
|
// nsChromeTreeOwner::nsIBaseWindow
|
2017-07-06 15:00:35 +03:00
|
|
|
//*****************************************************************************
|
2000-01-22 06:15:41 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::InitWindow(nativeWindow aParentNativeWindow,
|
2017-07-06 15:00:35 +03:00
|
|
|
nsIWidget* parentWidget, int32_t x,
|
|
|
|
int32_t y, int32_t cx, int32_t cy) {
|
2005-11-26 00:57:13 +03:00
|
|
|
// Ignore widget parents for now. Don't think those are a vaild thing to
|
|
|
|
// call.
|
2016-05-12 03:07:45 +03:00
|
|
|
NS_ENSURE_SUCCESS(SetPositionAndSize(x, y, cx, cy, 0), NS_ERROR_FAILURE);
|
2000-01-26 03:10:59 +03:00
|
|
|
|
2000-01-22 06:15:41 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::Create() {
|
2011-10-17 18:59:28 +04:00
|
|
|
NS_ASSERTION(false, "You can't call this");
|
2000-01-27 08:59:48 +03:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2000-01-22 06:15:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::Destroy() {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-02-08 16:40:10 +03:00
|
|
|
return mXULWindow->Destroy();
|
2000-01-22 06:15:41 +03:00
|
|
|
}
|
|
|
|
|
2012-10-16 23:41:19 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(
|
|
|
|
double* aScale) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
|
|
|
|
}
|
|
|
|
|
2015-11-25 22:12:07 +03:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetDevicePixelsPerDesktopPixel(
|
|
|
|
double* aScale) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->GetDevicePixelsPerDesktopPixel(aScale);
|
|
|
|
}
|
|
|
|
|
2016-02-18 13:46:16 +03:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::SetPositionDesktopPix(int32_t x, int32_t y) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->SetPositionDesktopPix(x, y);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::SetPosition(int32_t x, int32_t y) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
return mXULWindow->SetPosition(x, y);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetPosition(int32_t* x, int32_t* y) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
return mXULWindow->GetPosition(x, y);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::SetSize(int32_t cx, int32_t cy,
|
|
|
|
bool fRepaint) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
return mXULWindow->SetSize(cx, cy, fRepaint);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetSize(int32_t* cx, int32_t* cy) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
return mXULWindow->GetSize(cx, cy);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::SetPositionAndSize(int32_t x, int32_t y,
|
2016-05-12 03:07:45 +03:00
|
|
|
int32_t cx, int32_t cy,
|
|
|
|
uint32_t aFlags) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2016-05-12 03:07:45 +03:00
|
|
|
return mXULWindow->SetPositionAndSize(x, y, cx, cy, aFlags);
|
2000-01-22 06:15:41 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetPositionAndSize(int32_t* x, int32_t* y,
|
|
|
|
int32_t* cx, int32_t* cy) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
return mXULWindow->GetPositionAndSize(x, y, cx, cy);
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::Repaint(bool aForce) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
return mXULWindow->Repaint(aForce);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetParentWidget(nsIWidget** aParentWidget) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-02-08 16:40:10 +03:00
|
|
|
return mXULWindow->GetParentWidget(aParentWidget);
|
2000-01-22 06:15:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::SetParentWidget(nsIWidget* aParentWidget) {
|
2011-10-17 18:59:28 +04:00
|
|
|
NS_ASSERTION(false, "You can't call this");
|
2000-01-26 03:10:59 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2000-01-22 06:15:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetParentNativeWindow(
|
|
|
|
nativeWindow* aParentNativeWindow) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-02-08 16:40:10 +03:00
|
|
|
return mXULWindow->GetParentNativeWindow(aParentNativeWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::SetParentNativeWindow(
|
|
|
|
nativeWindow aParentNativeWindow) {
|
2011-10-17 18:59:28 +04:00
|
|
|
NS_ASSERTION(false, "You can't call this");
|
2000-01-22 06:15:41 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2012-07-25 05:35:32 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetNativeHandle(nsAString& aNativeHandle) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
|
|
|
return mXULWindow->GetNativeHandle(aNativeHandle);
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetVisibility(bool* aVisibility) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
return mXULWindow->GetVisibility(aVisibility);
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::SetVisibility(bool aVisibility) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
return mXULWindow->SetVisibility(aVisibility);
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetEnabled(bool* aEnabled) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2002-03-01 02:22:55 +03:00
|
|
|
return mXULWindow->GetEnabled(aEnabled);
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::SetEnabled(bool aEnable) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2002-03-01 02:22:55 +03:00
|
|
|
return mXULWindow->SetEnabled(aEnable);
|
|
|
|
}
|
|
|
|
|
2000-01-22 06:15:41 +03:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetMainWidget(nsIWidget** aMainWidget) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aMainWidget);
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
|
2000-01-26 03:10:59 +03:00
|
|
|
*aMainWidget = mXULWindow->mWindow;
|
|
|
|
NS_IF_ADDREF(*aMainWidget);
|
|
|
|
|
2000-01-22 06:15:41 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::SetFocus() {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
return mXULWindow->SetFocus();
|
|
|
|
}
|
|
|
|
|
2017-09-25 06:10:51 +03:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::GetTitle(nsAString& aTitle) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2000-01-22 06:15:41 +03:00
|
|
|
return mXULWindow->GetTitle(aTitle);
|
|
|
|
}
|
|
|
|
|
2017-09-25 06:10:51 +03:00
|
|
|
NS_IMETHODIMP nsChromeTreeOwner::SetTitle(const nsAString& aTitle) {
|
2007-02-19 18:26:48 +03:00
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2002-06-27 02:34:09 +04:00
|
|
|
return mXULWindow->SetTitle(aTitle);
|
2000-01-22 06:15:41 +03:00
|
|
|
}
|
|
|
|
|
2000-04-12 03:50:14 +04:00
|
|
|
//*****************************************************************************
|
|
|
|
// nsChromeTreeOwner::nsIWebProgressListener
|
2017-07-06 15:00:35 +03:00
|
|
|
//*****************************************************************************
|
2000-04-12 03:50:14 +04:00
|
|
|
|
2000-06-19 09:54:37 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::OnProgressChange(nsIWebProgress* aWebProgress,
|
|
|
|
nsIRequest* aRequest,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aCurSelfProgress,
|
2017-07-06 15:00:35 +03:00
|
|
|
int32_t aMaxSelfProgress,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aCurTotalProgress,
|
|
|
|
int32_t aMaxTotalProgress) {
|
2000-04-12 03:50:14 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-06-19 09:54:37 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::OnStateChange(nsIWebProgress* aWebProgress,
|
|
|
|
nsIRequest* aRequest,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aProgressStateFlags,
|
2000-06-19 09:54:37 +04:00
|
|
|
nsresult aStatus) {
|
2000-04-12 03:50:14 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-02-08 14:29:10 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress,
|
|
|
|
nsIRequest* aRequest, nsIURI* aLocation,
|
|
|
|
uint32_t aFlags) {
|
|
|
|
NS_ENSURE_STATE(mXULWindow);
|
2001-05-30 06:07:48 +04:00
|
|
|
|
2018-02-08 14:29:10 +03:00
|
|
|
// If loading a new root .xul document, then redo chrome.
|
2001-05-30 06:07:48 +04:00
|
|
|
if (aWebProgress) {
|
|
|
|
nsCOMPtr<nsIDocShell> docshell;
|
|
|
|
mXULWindow->GetDocShell(getter_AddRefs(docshell));
|
|
|
|
|
2018-02-08 14:29:10 +03:00
|
|
|
nsCOMPtr<nsIWebProgress> webProgress(do_QueryInterface(docshell));
|
|
|
|
if (webProgress != aWebProgress) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2001-05-30 06:07:48 +04:00
|
|
|
}
|
|
|
|
|
2018-02-08 14:29:10 +03:00
|
|
|
mXULWindow->mChromeLoaded = false;
|
2001-05-30 06:07:48 +04:00
|
|
|
return NS_OK;
|
2000-04-12 03:50:14 +04:00
|
|
|
}
|
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
NS_IMETHODIMP
|
2000-07-25 09:45:56 +04:00
|
|
|
nsChromeTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress,
|
|
|
|
nsIRequest* aRequest, nsresult aStatus,
|
2014-01-04 19:02:17 +04:00
|
|
|
const char16_t* aMessage) {
|
2000-07-25 09:45:56 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::OnSecurityChange(nsIWebProgress* aWebProgress,
|
2019-01-07 01:45:57 +03:00
|
|
|
nsIRequest* aRequest, uint32_t aState) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsChromeTreeOwner::OnContentBlockingEvent(nsIWebProgress* aWebProgress,
|
|
|
|
nsIRequest* aRequest,
|
|
|
|
uint32_t aEvent) {
|
2002-05-17 00:57:37 +04:00
|
|
|
return NS_OK;
|
2000-09-15 02:56:56 +04:00
|
|
|
}
|
|
|
|
|
2000-01-22 06:15:41 +03:00
|
|
|
//*****************************************************************************
|
|
|
|
// nsChromeTreeOwner: Helpers
|
2017-07-06 15:00:35 +03:00
|
|
|
//*****************************************************************************
|
2000-01-22 06:15:41 +03:00
|
|
|
|
|
|
|
//*****************************************************************************
|
|
|
|
// nsChromeTreeOwner: Accessors
|
2017-07-06 15:00:35 +03:00
|
|
|
//*****************************************************************************
|
2000-01-22 06:15:41 +03:00
|
|
|
|
|
|
|
void nsChromeTreeOwner::XULWindow(nsXULWindow* aXULWindow) {
|
|
|
|
mXULWindow = aXULWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsXULWindow* nsChromeTreeOwner::XULWindow() { return mXULWindow; }
|