Reduce do_GetService code bloat further by adding specialized assignment to nsCOMPtr and providing a version with no error pointer. Also make CallGetService work the same way as CallGetComponent does, as far as using frozen/non-frozen interface to service manager. Bug 264456, r=darin.
This commit is contained in:
Родитель
267c1afd03
Коммит
1435145ce6
|
@ -48,7 +48,7 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsRootAccessible.h"
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "nsIProperties.h"
|
||||
#include "nsIProfileMigrator.h"
|
||||
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsXPCOMCID.h"
|
||||
#include "nsCRT.h"
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
#include "nsILocalFile.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIProfileMigrator.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#import "NSString+Utils.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsICookie.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#import "SecurityPane.h"
|
||||
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
// prefs for showing security dialogs
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#import "NSString+Utils.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIPermission.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
#include "nsIWebBrowser.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIRDFRemoteDataSource.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIURIFixup.h"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsIEmbeddingSiteWindow.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
CocoaPromptService::CocoaPromptService()
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsIPrompt.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
SecurityDialogs::SecurityDialogs()
|
||||
{
|
||||
|
|
|
@ -1,241 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
* Simon Woodside <sbwoodside@yahoo.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#import "NSString+Utils.h"
|
||||
|
||||
#import "RDFOutlineViewDataSource.h"
|
||||
#import "CHBrowserService.h"
|
||||
#import "ExtendedOutlineView.h"
|
||||
#import "RDFItem.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIRDFLiteral.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIRDFContainer.h"
|
||||
#include "nsIRDFContainerUtils.h"
|
||||
#include "nsRDFCID.h"
|
||||
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsString.h"
|
||||
|
||||
|
||||
@interface RDFOutlineViewDataSource(Private)
|
||||
- (void)cleanup;
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation RDFOutlineViewDataSource
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(shutdown:)
|
||||
name:XPCOMShutDownNotificationName object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
[self cleanup];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)cleanup
|
||||
{
|
||||
NS_IF_RELEASE(mRDFContainer);
|
||||
NS_IF_RELEASE(mRDFContainerUtils);
|
||||
NS_IF_RELEASE(mRDFService);
|
||||
|
||||
NS_IF_RELEASE(mRDFDataSource);
|
||||
}
|
||||
|
||||
- (void)cleanupDataSource
|
||||
{
|
||||
[self cleanup];
|
||||
}
|
||||
|
||||
- (RDFItem *)rootRDFItem;
|
||||
{
|
||||
return mRootRDFItem;
|
||||
}
|
||||
|
||||
- (void)setRootRDFItem:(RDFItem*)item;
|
||||
{
|
||||
[mRootRDFItem autorelease];
|
||||
mRootRDFItem = [item retain];
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// loadLazily
|
||||
//
|
||||
// defer loading all this rdf junk until it's requested because it's slow
|
||||
// TODO measure how slow it really is
|
||||
//
|
||||
- (void) loadLazily
|
||||
{
|
||||
if ( !mRDFContainer ) {
|
||||
nsCOMPtr<nsIRDFContainer> ctr = do_CreateInstance("@mozilla.org/rdf/container;1");
|
||||
NS_ADDREF(mRDFContainer = ctr);
|
||||
|
||||
nsCOMPtr<nsIRDFContainerUtils> ctrUtils = do_GetService("@mozilla.org/rdf/container-utils;1");
|
||||
NS_ADDREF(mRDFContainerUtils = ctrUtils);
|
||||
|
||||
nsCOMPtr<nsIRDFService> rdfService = do_GetService("@mozilla.org/rdf/rdf-service;1");
|
||||
NS_ADDREF(mRDFService = rdfService);
|
||||
|
||||
mRDFDataSource = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)shutdown:(NSNotification*)aNotification
|
||||
{
|
||||
[self cleanupDataSource];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
// Implementation of NSOutlineViewDataSource protocol
|
||||
|
||||
// XXX - For now, we'll just say that none of our items are editable, as we aren't using any
|
||||
// RDF datasources that are mutable.
|
||||
|
||||
- (BOOL)outlineView:(NSOutlineView*)aOutlineView shouldEditTableColumn:(NSTableColumn*)aTableColumn item:(id)aItem
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)outlineView:(NSOutlineView*)aOutlineView isItemExpandable:(id)aItem
|
||||
{
|
||||
if (!mRDFDataSource)
|
||||
return NO;
|
||||
if (!aItem)
|
||||
return YES; // The root is always open
|
||||
if( [aItem isKindOfClass:[RDFItem class]] ) {
|
||||
RDFItem * rdfItem = aItem;
|
||||
return [rdfItem isExpandable];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (id)outlineView:(NSOutlineView*)aOutlineView child:(int)aIndex ofItem:(id)aItem
|
||||
{
|
||||
if (!mRDFDataSource)
|
||||
return nil;
|
||||
if (!aItem) {
|
||||
aItem = [self rootRDFItem];
|
||||
}
|
||||
if( [aItem isKindOfClass:[RDFItem class]] ) {
|
||||
RDFItem * rdfItem = aItem;
|
||||
return [rdfItem childAtIndex:aIndex];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (int)outlineView:(NSOutlineView*)aOutlineView numberOfChildrenOfItem:(id)aItem;
|
||||
{
|
||||
if (!mRDFDataSource)
|
||||
return 0;
|
||||
if (!aItem) {
|
||||
aItem = [self rootRDFItem];
|
||||
}
|
||||
if( [aItem isKindOfClass:[RDFItem class]] ) {
|
||||
RDFItem * rdfItem = aItem;
|
||||
return [rdfItem numChildren];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO move to subclass
|
||||
- (id)outlineView:(NSOutlineView*)aOutlineView objectValueForTableColumn:(NSTableColumn*)aTableColumn byItem:(id)aItem
|
||||
{
|
||||
if (!mRDFDataSource || !aItem)
|
||||
return nil;
|
||||
// The table column's identifier is the last part of the RDF Resource URI of the property
|
||||
// being displayed in that column, e.g. "http://home.netscape.com/NC-rdf#Name"
|
||||
NSString *resourceName;
|
||||
if( [[aTableColumn identifier] isEqualToString:@"title"] )
|
||||
resourceName = @"Name";
|
||||
else if( [[aTableColumn identifier] isEqualToString:@"url"] )
|
||||
resourceName = @"URL";
|
||||
else
|
||||
return nil;
|
||||
NSString * RDFURI = @"http://home.netscape.com/NC-rdf#";
|
||||
NSString * RDFpropertyURI = [RDFURI stringByAppendingString:resourceName];
|
||||
NSString * propertyString = [aItem getStringForRDFPropertyURI:RDFpropertyURI];
|
||||
return propertyString;
|
||||
}
|
||||
|
||||
// returns the value of the Name property as the tooltip for the given item. Override to do
|
||||
// anything more complicated
|
||||
- (NSString *)outlineView:(NSOutlineView *)outlineView tooltipStringForItem:(id)anItem
|
||||
{
|
||||
return [anItem getStringForRDFPropertyURI:@"http://home.netscape.com/NC-rdf#Name"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
|
||||
- (void)reloadDataForItem:(id)aItem reloadChildren:(BOOL)aReloadChildren
|
||||
{
|
||||
if (!aItem)
|
||||
[mOutlineView reloadData];
|
||||
else
|
||||
[mOutlineView reloadItem:aItem reloadChildren:aReloadChildren];
|
||||
}
|
||||
|
||||
- (void)invalidateCachedItems
|
||||
{
|
||||
[[self rootRDFItem] invalidateCache];
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,314 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@netscape.com> (Original Author)
|
||||
* Simon Woodside <sbwoodside@yahoo.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// These objects cache their children to avoid excessive lookups through
|
||||
// the gecko API, which can be slow
|
||||
|
||||
#import "RDFItem.h"
|
||||
|
||||
#import "NSString+Utils.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIRDFLiteral.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIRDFContainer.h"
|
||||
#include "nsIRDFContainerUtils.h"
|
||||
#include "nsRDFCID.h"
|
||||
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
|
||||
@interface RDFItem (Private)
|
||||
- (unsigned int)cacheVersion;
|
||||
- (BOOL)cachedChildren;
|
||||
- (void)buildChildCache;
|
||||
- (NSString*)getTextForNode:(nsIRDFNode *)aNode;
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation RDFItem
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
nsCOMPtr<nsIRDFContainer> ctr = do_CreateInstance("@mozilla.org/rdf/container;1");
|
||||
NS_ADDREF(mRDFContainer = ctr);
|
||||
|
||||
nsCOMPtr<nsIRDFContainerUtils> ctrUtils = do_GetService("@mozilla.org/rdf/container-utils;1");
|
||||
NS_ADDREF(mRDFContainerUtils = ctrUtils);
|
||||
|
||||
nsCOMPtr<nsIRDFService> rdfService = do_GetService("@mozilla.org/rdf/rdf-service;1");
|
||||
NS_ADDREF(mRDFService = rdfService);
|
||||
|
||||
mRDFDataSource = nsnull;
|
||||
mRDFResource = nsnull;
|
||||
|
||||
mPropertyCache = [[[NSMutableDictionary alloc] init] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithRDFResource:(nsIRDFResource*)aRDFResource RDFDataSource:(nsIRDFDataSource*)aRDFDataSource parent:(RDFItem*)newparent;
|
||||
{
|
||||
if( (self = [self init]) ) {
|
||||
NS_IF_ADDREF(mRDFResource = aRDFResource);
|
||||
mRDFDataSource = aRDFDataSource;
|
||||
mParent = newparent;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[mChildNodes autorelease];
|
||||
[mPropertyCache autorelease];
|
||||
NS_IF_RELEASE(mRDFResource);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (RDFItem*)newChild;
|
||||
{
|
||||
return [RDFItem alloc];
|
||||
}
|
||||
|
||||
- (void)invalidateCache;
|
||||
{
|
||||
if( mChildNodes ) {
|
||||
//invalidate children first (in case they have children)
|
||||
[mChildNodes makeObjectsPerformSelector:@selector(invalidateCache)];
|
||||
[mChildNodes autorelease];
|
||||
mChildNodes = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)cachedChildren
|
||||
{
|
||||
return (mChildNodes != nil);
|
||||
}
|
||||
|
||||
- (BOOL)isExpandable
|
||||
{
|
||||
if( mChildNodes )
|
||||
return YES; // cached already
|
||||
|
||||
// Query gecko for the answer
|
||||
PRBool isSeq = PR_FALSE;
|
||||
mRDFContainerUtils->IsSeq(mRDFDataSource, mRDFResource, &isSeq);
|
||||
if (isSeq)
|
||||
return YES;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> childRDFProperty;
|
||||
mRDFService->GetResource(nsDependentCString("http://home.netscape.com/NC-rdf#child"),
|
||||
getter_AddRefs(childRDFProperty));
|
||||
nsCOMPtr<nsISimpleEnumerator> childNodesEnum;
|
||||
mRDFDataSource->GetTargets(mRDFResource, childRDFProperty, PR_TRUE, getter_AddRefs(childNodesEnum));
|
||||
|
||||
PRBool hasMore = PR_FALSE;
|
||||
if( NS_SUCCEEDED(childNodesEnum->HasMoreElements(&hasMore)) && hasMore ) {
|
||||
nsCOMPtr<nsISupports> supp;
|
||||
childNodesEnum->GetNext(getter_AddRefs(supp));
|
||||
nsCOMPtr<nsIRDFResource> childResource = do_QueryInterface(supp);
|
||||
if (childResource)
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
- (int)numChildren;
|
||||
{
|
||||
if( mChildNodes )
|
||||
return [mChildNodes count];
|
||||
|
||||
// Since gecko RDF enumerator->HasMoreElements
|
||||
// is so slow, we may as well build the cache now
|
||||
// because the extra time it takes is tiny
|
||||
[self buildChildCache];
|
||||
int numChilds = [mChildNodes count];
|
||||
return numChilds;
|
||||
}
|
||||
|
||||
// 0- based
|
||||
- (RDFItem*)childAtIndex:(int)index;
|
||||
{
|
||||
RDFItem* child = nil;
|
||||
if (!mChildNodes)
|
||||
[self buildChildCache];
|
||||
if (index < [mChildNodes count])
|
||||
child = [mChildNodes objectAtIndex:index];
|
||||
return child;
|
||||
}
|
||||
|
||||
- (void)buildChildCache;
|
||||
{
|
||||
NSMutableArray * childNodes = [[[NSMutableArray alloc] init] retain];
|
||||
|
||||
[self invalidateCache];
|
||||
|
||||
nsCOMPtr<nsIRDFResource> childRDFProperty;
|
||||
mRDFService->GetResource(nsDependentCString("http://home.netscape.com/NC-rdf#child"),
|
||||
getter_AddRefs(childRDFProperty));
|
||||
nsCOMPtr<nsISimpleEnumerator> childNodesEnum;
|
||||
mRDFDataSource->GetTargets(mRDFResource, childRDFProperty, PR_TRUE, getter_AddRefs(childNodesEnum));
|
||||
|
||||
PRBool hasMore = PR_FALSE;
|
||||
// this call to HasMoreElements can take more than 10 ms !!
|
||||
// maybe not any more though
|
||||
while( NS_SUCCEEDED(childNodesEnum->HasMoreElements(&hasMore)) && hasMore ) {
|
||||
nsCOMPtr<nsISupports> supp;
|
||||
childNodesEnum->GetNext(getter_AddRefs(supp));
|
||||
nsCOMPtr<nsIRDFResource> childResource = do_QueryInterface(supp);
|
||||
if (childResource) {
|
||||
RDFItem * childItem = [self newChild];
|
||||
[childItem initWithRDFResource:childResource RDFDataSource:mRDFDataSource parent:self];
|
||||
if (childItem)
|
||||
[childNodes addObject:childItem];
|
||||
}
|
||||
}
|
||||
mChildNodes = [childNodes retain];
|
||||
}
|
||||
|
||||
- (void)deleteChildFromCache:(RDFItem*)child;
|
||||
{
|
||||
[mChildNodes removeObject:child];
|
||||
}
|
||||
|
||||
- (RDFItem*)parent;
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (NSString*)getStringForRDFPropertyURI:(NSString*)aPropertyURI;
|
||||
{
|
||||
NSString * cached = [mPropertyCache objectForKey:aPropertyURI];
|
||||
if( cached )
|
||||
return cached;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> myRDFProperty;
|
||||
mRDFService->GetResource(nsDependentCString([aPropertyURI UTF8String]),
|
||||
getter_AddRefs(myRDFProperty));
|
||||
nsCOMPtr<nsIRDFNode> resultNode;
|
||||
nsresult rv;
|
||||
rv = mRDFDataSource->GetTarget(mRDFResource, myRDFProperty, PR_TRUE, getter_AddRefs(resultNode));
|
||||
if( NS_FAILED(rv) )
|
||||
return @"mRDFDataSource->GetTarget NS_FAILED";
|
||||
if (!resultNode) {
|
||||
// NSLog(@"resultNode is null in getStringForRDFPropertyURI, aPropertyURI= %@", aPropertyURI);
|
||||
return @"";
|
||||
}
|
||||
NSString * result = [self getTextForNode:resultNode];
|
||||
[mPropertyCache setObject:result forKey:aPropertyURI];
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSString *)description;
|
||||
{
|
||||
return [self getStringForRDFPropertyURI:@"http://home.netscape.com/NC-rdf#Name"];
|
||||
}
|
||||
|
||||
- (NSString*)getTextForNode:(nsIRDFNode *)aNode;
|
||||
{
|
||||
nsString aResult;
|
||||
NSString * resultString = nil;
|
||||
|
||||
nsresult rv;
|
||||
nsIRDFResource *resource;
|
||||
nsIRDFLiteral *literal;
|
||||
nsIRDFDate *dateLiteral;
|
||||
nsIRDFInt *intLiteral;
|
||||
if (! aNode) {
|
||||
aResult.Truncate();
|
||||
rv = NS_OK;
|
||||
}
|
||||
else if (NS_SUCCEEDED(rv = aNode->QueryInterface(NS_GET_IID(nsIRDFResource), (void**) &resource))) {
|
||||
const char *p = nsnull;
|
||||
if (NS_SUCCEEDED(rv = resource->GetValueConst( &p )) && (p)) {
|
||||
aResult.AssignWithConversion(p);
|
||||
}
|
||||
NS_RELEASE(resource);
|
||||
}
|
||||
else if (NS_SUCCEEDED(rv = aNode->QueryInterface(NS_GET_IID(nsIRDFDate), (void**) &dateLiteral))) {
|
||||
PRInt64 theDate, million;
|
||||
if (NS_SUCCEEDED(rv = dateLiteral->GetValue( &theDate ))) {
|
||||
LL_I2L(million, PR_USEC_PER_SEC);
|
||||
LL_DIV(theDate, theDate, million); // convert from microseconds (PRTime) to seconds
|
||||
PRInt32 now32;
|
||||
LL_L2I(now32, theDate);
|
||||
double interval = (double)now32;
|
||||
NSDate * date = [NSDate dateWithTimeIntervalSince1970:interval];
|
||||
resultString = [date description];
|
||||
}
|
||||
NS_RELEASE(dateLiteral);
|
||||
}
|
||||
else if (NS_SUCCEEDED(rv = aNode->QueryInterface(NS_GET_IID(nsIRDFInt), (void**) &intLiteral)))
|
||||
{
|
||||
PRInt32 theInt;
|
||||
aResult.Truncate();
|
||||
if (NS_SUCCEEDED(rv = intLiteral->GetValue( &theInt ))) {
|
||||
aResult.AppendInt(theInt, 10);
|
||||
}
|
||||
NS_RELEASE(intLiteral);
|
||||
}
|
||||
else if (NS_SUCCEEDED(rv = aNode->QueryInterface(NS_GET_IID(nsIRDFLiteral), (void**) &literal))) {
|
||||
const PRUnichar *p = nsnull;
|
||||
if (NS_SUCCEEDED(rv = literal->GetValueConst( &p )) && (p)) {
|
||||
aResult = p;
|
||||
}
|
||||
NS_RELEASE(literal);
|
||||
}
|
||||
else {
|
||||
NS_ERROR("not a resource or a literal");
|
||||
rv = NS_ERROR_UNEXPECTED;
|
||||
return @"Not a resource or a literal";
|
||||
}
|
||||
if( !resultString )
|
||||
resultString = [NSString stringWith_nsAString:aResult];
|
||||
return resultString;
|
||||
}
|
||||
|
||||
@end
|
|
@ -70,7 +70,7 @@
|
|||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
#include "nsNetCID.h"
|
||||
#include "nsICookieService.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsParserUtils.h"
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefLocalizedString.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsINodeInfo.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsILoadGroup.h"
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsLayoutCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsLayoutStylesheetCache, nsIObserver)
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIScriptEventHandler.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#include "nsIDOMNSUIEvent.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "nsGlobalHistory2Adapter.h"
|
||||
|
||||
#include "nsDocShellCID.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsGlobalHistoryAdapter.h"
|
||||
#include "nsIURI.h"
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "nsGlobalHistoryAdapter.h"
|
||||
|
||||
#include "nsDocShellCID.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsGlobalHistory2Adapter.h"
|
||||
#include "nsIURI.h"
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "nsIControllerContext.h"
|
||||
#include "nsIControllerCommandTable.h"
|
||||
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#define NS_HTMLEDITOR_COMMANDTABLE_CID \
|
||||
{ 0x7a727843, 0x6ae1, 0x11d7, { 0xa5eb, 0x00, 0x03, 0x93, 0x63, 0x65, 0x92 } }
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIParserService.h"
|
||||
#include "nsEditorParserObserver.h"
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIChromeRegistry.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
#include "nsITextContent.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
// transactions the editor knows how to build
|
||||
#include "TransactionFactory.h"
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMNSRange.h"
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <Wininet.h>
|
||||
|
||||
#include "npapi.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranchInternal.h"
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "nsIMozAxPlugin.h"
|
||||
#include "nsIClassInfo.h"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIClassInfo.h"
|
||||
#include "nsIMozAxPlugin.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
#include "ControlEventSink.h"
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "EmbedPrivate.h"
|
||||
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
EmbedContentListener::EmbedContentListener(void)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "PtMozilla.h"
|
||||
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
EmbedContentListener::EmbedContentListener(void)
|
||||
{
|
||||
|
|
|
@ -1,569 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Local Includes
|
||||
#include "CBrowserChrome.h"
|
||||
#include "CBrowserShell.h"
|
||||
#include "CBrowserMsgDefs.h"
|
||||
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
|
||||
#include "UMacUnicode.h"
|
||||
#include "ApplIDs.h"
|
||||
|
||||
#include <LStaticText.h>
|
||||
#include <LCheckBox.h>
|
||||
#include <LEditText.h>
|
||||
#include <UModalDialogs.h>
|
||||
#include <LPushButton.h>
|
||||
|
||||
// Interfaces needed to be included
|
||||
|
||||
// Defines
|
||||
|
||||
// Constants
|
||||
const PRInt32 kGrowIconSize = 15;
|
||||
|
||||
//*****************************************************************************
|
||||
//*** CBrowserChrome:
|
||||
//*****************************************************************************
|
||||
|
||||
CBrowserChrome::CBrowserChrome(CBrowserShell *aShell,
|
||||
UInt32 aChromeFlags,
|
||||
Boolean aIsMainContent) :
|
||||
mBrowserShell(aShell), mBrowserWindow(nsnull),
|
||||
mChromeFlags(aChromeFlags), mIsMainContent(aIsMainContent),
|
||||
mSizeToContent(false),
|
||||
mInModalLoop(false), mWindowVisible(false),
|
||||
mInitialLoadComplete(false)
|
||||
{
|
||||
ThrowIfNil_(mBrowserShell);
|
||||
mBrowserWindow = LWindow::FetchWindowObject(mBrowserShell->GetMacWindow());
|
||||
StartListening();
|
||||
}
|
||||
|
||||
CBrowserChrome::~CBrowserChrome()
|
||||
{
|
||||
}
|
||||
|
||||
void CBrowserChrome::SetBrowserShell(CBrowserShell *aShell)
|
||||
{
|
||||
mBrowserShell = aShell;
|
||||
if (mBrowserShell)
|
||||
mBrowserWindow = LWindow::FetchWindowObject(mBrowserShell->GetMacWindow());
|
||||
else
|
||||
mBrowserWindow = nsnull;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// CBrowserChrome::nsISupports
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ISUPPORTS8(CBrowserChrome,
|
||||
nsIWebBrowserChrome,
|
||||
nsIInterfaceRequestor,
|
||||
nsIWebBrowserChromeFocus,
|
||||
nsIEmbeddingSiteWindow,
|
||||
nsIEmbeddingSiteWindow2,
|
||||
nsIContextMenuListener2,
|
||||
nsITooltipListener,
|
||||
nsISupportsWeakReference);
|
||||
|
||||
//*****************************************************************************
|
||||
// CBrowserChrome::nsIInterfaceRequestor
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::GetInterface(const nsIID &aIID, void** aInstancePtr)
|
||||
{
|
||||
if (aIID.Equals(NS_GET_IID(nsIDOMWindow)))
|
||||
{
|
||||
nsCOMPtr<nsIWebBrowser> browser;
|
||||
GetWebBrowser(getter_AddRefs(browser));
|
||||
if (browser)
|
||||
return browser->GetContentDOMWindow((nsIDOMWindow **) aInstancePtr);
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
return QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// CBrowserChrome::nsIWebBrowserChrome
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::SetStatus(PRUint32 statusType, const PRUnichar *status)
|
||||
{
|
||||
NS_ENSURE_TRUE(mBrowserShell, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
MsgChromeStatusChangeInfo info(mBrowserShell, statusType, status);
|
||||
mBrowserShell->BroadcastMessage(msg_OnChromeStatusChange, &info);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::GetWebBrowser(nsIWebBrowser** aWebBrowser)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWebBrowser);
|
||||
NS_ENSURE_TRUE(mBrowserShell, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
mBrowserShell->GetWebBrowser(aWebBrowser);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::SetWebBrowser(nsIWebBrowser* aWebBrowser)
|
||||
{
|
||||
NS_ENSURE_ARG(aWebBrowser); // Passing nsnull is NOT OK
|
||||
NS_ENSURE_TRUE(mBrowserShell, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
mBrowserShell->SetWebBrowser(aWebBrowser);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::GetChromeFlags(PRUint32* aChromeMask)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChromeMask);
|
||||
|
||||
*aChromeMask = mChromeFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::SetChromeFlags(PRUint32 aChromeMask)
|
||||
{
|
||||
// Yuck - our window would have to be rebuilt to do this.
|
||||
NS_ERROR("Haven't implemented this yet!");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::DestroyBrowserWindow()
|
||||
{
|
||||
NS_ENSURE_TRUE(mBrowserShell, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
mInModalLoop = false;
|
||||
delete mBrowserWindow;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::IsWindowModal(PRBool *_retval)
|
||||
{
|
||||
*_retval = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
|
||||
{
|
||||
SDimension16 curSize;
|
||||
mBrowserShell->GetFrameSize(curSize);
|
||||
mBrowserWindow->ResizeWindowBy((aCX - curSize.width), (aCY - curSize.height));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::ShowAsModal(void)
|
||||
{
|
||||
// We need this override because StDialogHandler deletes
|
||||
// its window in its destructor. We don't want that here.
|
||||
class CChromeDialogHandler : public StDialogHandler
|
||||
{
|
||||
public:
|
||||
CChromeDialogHandler(LWindow* inWindow,
|
||||
LCommander* inSuper) :
|
||||
StDialogHandler(inWindow, inSuper)
|
||||
{ }
|
||||
|
||||
virtual ~CChromeDialogHandler()
|
||||
{ mDialog = nil; }
|
||||
};
|
||||
|
||||
CChromeDialogHandler theHandler(mBrowserWindow, mBrowserWindow->GetSuperCommander());
|
||||
|
||||
// Set to false by ExitModalEventLoop or DestroyBrowserWindow
|
||||
mInModalLoop = true;
|
||||
while (mInModalLoop)
|
||||
theHandler.DoDialog();
|
||||
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::ExitModalEventLoop(nsresult aStatus)
|
||||
{
|
||||
mInModalLoop = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// CBrowserChrome::nsIWebBrowserChromeFocus
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::FocusNextElement()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::FocusPrevElement()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// CBrowserChrome::nsIEmbeddingSiteWindow
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::SetDimensions(PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
|
||||
{
|
||||
NS_ENSURE_STATE(mBrowserWindow);
|
||||
NS_ENSURE_STATE(mBrowserShell);
|
||||
|
||||
if ((flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER) &&
|
||||
(flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION)
|
||||
{
|
||||
mBrowserWindow->MoveWindowTo(x, y);
|
||||
}
|
||||
|
||||
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER)
|
||||
{
|
||||
// Don't resize the inner view independently from the window. Keep them in
|
||||
// proportion by resizing the window and letting that affect the inner view.
|
||||
SDimension16 curSize;
|
||||
mBrowserShell->GetFrameSize(curSize);
|
||||
mBrowserWindow->ResizeWindowBy(cx - curSize.width, cy - curSize.height);
|
||||
}
|
||||
else if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)
|
||||
{
|
||||
if (mBrowserWindow->HasAttribute(windAttr_Resizable /*windAttr_SizeBox*/))
|
||||
cy += 15;
|
||||
mBrowserWindow->ResizeWindowTo(cx, cy);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::GetDimensions(PRUint32 flags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
|
||||
{
|
||||
NS_ENSURE_STATE(mBrowserWindow);
|
||||
NS_ENSURE_STATE(mBrowserShell);
|
||||
|
||||
if ((flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER) &&
|
||||
(flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
Rect outerBounds;
|
||||
if ((flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) ||
|
||||
(flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER))
|
||||
mBrowserWindow->GetGlobalBounds(outerBounds);
|
||||
|
||||
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION)
|
||||
{
|
||||
if (x)
|
||||
*x = outerBounds.left;
|
||||
if (y)
|
||||
*y = outerBounds.top;
|
||||
}
|
||||
|
||||
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER)
|
||||
{
|
||||
SDimension16 curSize;
|
||||
mBrowserShell->GetFrameSize(curSize);
|
||||
if (cx)
|
||||
*cx = curSize.width;
|
||||
if (cy)
|
||||
*cy = curSize.height;
|
||||
}
|
||||
else if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)
|
||||
{
|
||||
if (cx)
|
||||
*cx = outerBounds.right - outerBounds.left;
|
||||
if (cy)
|
||||
{
|
||||
*cy = outerBounds.bottom - outerBounds.top;
|
||||
if (mBrowserWindow->HasAttribute(windAttr_Resizable /*windAttr_SizeBox*/))
|
||||
*cy -= 15;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::SetFocus()
|
||||
{
|
||||
mBrowserWindow->Select();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::GetVisibility(PRBool *aVisibility)
|
||||
{
|
||||
NS_ENSURE_STATE(mBrowserWindow);
|
||||
NS_ENSURE_ARG_POINTER(aVisibility);
|
||||
|
||||
*aVisibility = mWindowVisible;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::SetVisibility(PRBool aVisibility)
|
||||
{
|
||||
NS_ENSURE_STATE(mBrowserWindow);
|
||||
|
||||
if (aVisibility == mWindowVisible)
|
||||
return NS_OK;
|
||||
|
||||
mWindowVisible = aVisibility;
|
||||
|
||||
// If we are being told to become visible but we need to wait for
|
||||
// content to load so that we can size ourselves to it,
|
||||
// don't actually show it now. That will be done after the
|
||||
// load completes.
|
||||
PRBool sizingToContent = mIsMainContent &&
|
||||
(mChromeFlags & CHROME_OPENAS_CHROME) &&
|
||||
(mChromeFlags & CHROME_OPENAS_DIALOG);
|
||||
if (sizingToContent && mWindowVisible && !mInitialLoadComplete)
|
||||
return NS_OK;
|
||||
aVisibility ? mBrowserWindow->Show() : mBrowserWindow->Hide();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::GetTitle(PRUnichar * *aTitle)
|
||||
{
|
||||
NS_ENSURE_STATE(mBrowserWindow);
|
||||
NS_ENSURE_ARG_POINTER(aTitle);
|
||||
|
||||
Str255 pStr;
|
||||
nsAutoString titleStr;
|
||||
|
||||
mBrowserWindow->GetDescriptor(pStr);
|
||||
CPlatformUCSConversion::GetInstance()->PlatformToUCS(pStr, titleStr);
|
||||
*aTitle = ToNewUnicode(titleStr);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::SetTitle(const PRUnichar * aTitle)
|
||||
{
|
||||
NS_ENSURE_STATE(mBrowserWindow);
|
||||
NS_ENSURE_ARG(aTitle);
|
||||
|
||||
Str255 pStr;
|
||||
|
||||
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(aTitle), pStr);
|
||||
mBrowserWindow->SetDescriptor(pStr);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::GetSiteWindow(void * *aSiteWindow)
|
||||
{
|
||||
NS_ENSURE_ARG(aSiteWindow);
|
||||
NS_ENSURE_STATE(mBrowserWindow);
|
||||
|
||||
*aSiteWindow = mBrowserWindow->GetMacWindow();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// CBrowserChrome::nsIEmbeddingSiteWindow2
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::Blur(void)
|
||||
{
|
||||
WindowPtr currWindow = ::GetWindowList();
|
||||
WindowPtr nextWindow;
|
||||
|
||||
// Find the rearmost window and put ourselves behind it
|
||||
while (currWindow && ((nextWindow = ::MacGetNextWindow(currWindow)) != nsnull))
|
||||
currWindow = nextWindow;
|
||||
|
||||
WindowPtr ourWindow = mBrowserWindow->GetMacWindow();
|
||||
if (ourWindow != currWindow)
|
||||
::SendBehind(ourWindow, currWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// CBrowserChrome::nsIContextMenuListener2
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::OnShowContextMenu(PRUint32 aContextFlags, nsIContextMenuInfo *aInfo)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
try
|
||||
{
|
||||
rv = mBrowserShell->OnShowContextMenu(aContextFlags, aInfo);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// CBrowserChrome::nsITooltipListener
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
try
|
||||
{
|
||||
rv = mBrowserShell->OnShowTooltip(aXCoords, aYCoords, aTipText);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserChrome::OnHideTooltip()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
try
|
||||
{
|
||||
rv = mBrowserShell->OnHideTooltip();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// CBrowserChrome::LListener
|
||||
//*****************************************************************************
|
||||
|
||||
void CBrowserChrome::ListenToMessage(MessageT inMessage, void* ioParam)
|
||||
{
|
||||
switch (inMessage)
|
||||
{
|
||||
case msg_OnNetStopChange:
|
||||
{
|
||||
mInitialLoadComplete = true;
|
||||
|
||||
// See if we need to size it and show it
|
||||
if (mIsMainContent &&
|
||||
(mChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME) &&
|
||||
(mChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG))
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
(void)GetInterface(NS_GET_IID(nsIDOMWindow), getter_AddRefs(domWindow));
|
||||
if (domWindow)
|
||||
domWindow->SizeToContent();
|
||||
if (mWindowVisible != mBrowserWindow->IsVisible())
|
||||
mBrowserWindow->Show();
|
||||
}
|
||||
|
||||
// If we are chrome, get the window title from the DOM
|
||||
if (mChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
rv = GetInterface(NS_GET_IID(nsIDOMWindow), getter_AddRefs(domWindow));
|
||||
if (NS_FAILED(rv)) return;
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
rv = domWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
if (NS_FAILED(rv)) return;
|
||||
nsCOMPtr<nsIDOMElement> domDocElem;
|
||||
rv = domDoc->GetDocumentElement(getter_AddRefs(domDocElem));
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
nsAutoString windowTitle;
|
||||
domDocElem->GetAttribute(NS_LITERAL_STRING("title"), windowTitle);
|
||||
if (!windowTitle.IsEmpty()) {
|
||||
Str255 pStr;
|
||||
CPlatformUCSConversion::GetInstance()->UCSToPlatform(windowTitle, pStr);
|
||||
mBrowserWindow->SetDescriptor(pStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// Static Utility Method
|
||||
//*****************************************************************************
|
||||
|
||||
LWindow* CBrowserChrome::GetLWindowForDOMWindow(nsIDOMWindow* aDOMWindow)
|
||||
{
|
||||
if (!aDOMWindow)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> windowWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
if (!windowWatcher)
|
||||
return nsnull;
|
||||
nsCOMPtr<nsIWebBrowserChrome> windowChrome;
|
||||
windowWatcher->GetChromeForWindow(aDOMWindow, getter_AddRefs(windowChrome));
|
||||
if (!windowChrome)
|
||||
return nsnull;
|
||||
nsCOMPtr<nsIEmbeddingSiteWindow> siteWindow(do_QueryInterface(windowChrome));
|
||||
if (!siteWindow)
|
||||
return nsnull;
|
||||
WindowPtr macWindow = nsnull;
|
||||
siteWindow->GetSiteWindow((void **)&macWindow);
|
||||
if (!macWindow)
|
||||
return nsnull;
|
||||
|
||||
return LWindow::FetchWindowObject(macWindow);
|
||||
}
|
||||
|
|
@ -1,192 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Local
|
||||
#include "CPrintAttachment.h"
|
||||
#include "CBrowserShell.h"
|
||||
|
||||
// Gecko
|
||||
#include "nsIPrintingPromptService.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsIWebBrowserPrint.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsIEmbeddingSiteWindow.h"
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//*** CPrintAttachment
|
||||
//*****************************************************************************
|
||||
|
||||
CPrintAttachment::CPrintAttachment(PaneIDT inBrowserPaneID,
|
||||
MessageT inMessage,
|
||||
Boolean inExecuteHost) :
|
||||
LAttachment(inMessage,inExecuteHost),
|
||||
mBrowserShell(nil), mBrowserShellPaneID(inBrowserPaneID)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CPrintAttachment::CPrintAttachment(LStream* inStream) :
|
||||
LAttachment(inStream),
|
||||
mBrowserShell(nil), mBrowserShellPaneID(PaneIDT_Unspecified)
|
||||
{
|
||||
*inStream >> mBrowserShellPaneID;
|
||||
}
|
||||
|
||||
|
||||
CPrintAttachment::~CPrintAttachment()
|
||||
{
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//*** CPrintAttachment::LAttachment
|
||||
//*****************************************************************************
|
||||
|
||||
void CPrintAttachment::SetOwnerHost(LAttachable* inOwnerHost)
|
||||
{
|
||||
LAttachment::SetOwnerHost(inOwnerHost);
|
||||
|
||||
if (mBrowserShell == nil) {
|
||||
if (mBrowserShellPaneID != PaneIDT_Unspecified) {
|
||||
LView* container = GetTopmostView(dynamic_cast<LPane*>(mOwnerHost));
|
||||
if (container != nil) {
|
||||
LPane* targetPane = container->FindPaneByID(mBrowserShellPaneID);
|
||||
if (targetPane != nil)
|
||||
mBrowserShell = dynamic_cast<CBrowserShell*>(targetPane);
|
||||
}
|
||||
}
|
||||
else
|
||||
mBrowserShell = dynamic_cast<CBrowserShell*>(mOwnerHost);
|
||||
|
||||
Assert_(mBrowserShell != nil); // Programmer error
|
||||
}
|
||||
}
|
||||
|
||||
void CPrintAttachment::ExecuteSelf(MessageT inMessage, void *ioParam)
|
||||
{
|
||||
mExecuteHost = true;
|
||||
|
||||
if (inMessage == msg_CommandStatus) {
|
||||
SCommandStatus *status = (SCommandStatus *)ioParam;
|
||||
if (status->command == cmd_Print) {
|
||||
*status->enabled = true;
|
||||
*status->usesMark = false;
|
||||
mExecuteHost = false; // we handled it
|
||||
}
|
||||
else if (status->command == cmd_PageSetup) {
|
||||
*status->enabled = true;
|
||||
*status->usesMark = false;
|
||||
mExecuteHost = false; // we handled it
|
||||
}
|
||||
}
|
||||
else if (inMessage == cmd_Print) {
|
||||
DoPrint();
|
||||
mExecuteHost = false; // we handled it
|
||||
}
|
||||
else if (inMessage == cmd_PageSetup) {
|
||||
DoPageSetup();
|
||||
mExecuteHost = false; // we handled it
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//*** CPrintAttachment::CPrintAttachment
|
||||
//*****************************************************************************
|
||||
|
||||
void CPrintAttachment::DoPrint()
|
||||
{
|
||||
nsCOMPtr<nsIWebBrowser> wb;
|
||||
mBrowserShell->GetWebBrowser(getter_AddRefs(wb));
|
||||
ThrowIfNil_(wb);
|
||||
nsCOMPtr<nsIWebBrowserPrint> wbPrint(do_GetInterface(wb));
|
||||
ThrowIfNil_(wbPrint);
|
||||
nsCOMPtr<nsIPrintSettings> settings;
|
||||
mBrowserShell->GetPrintSettings(getter_AddRefs(settings));
|
||||
ThrowIfNil_(settings);
|
||||
|
||||
nsresult rv = wbPrint->Print(settings, nsnull);
|
||||
if (rv != NS_ERROR_ABORT)
|
||||
ThrowIfError_(rv);
|
||||
}
|
||||
|
||||
|
||||
void CPrintAttachment::DoPageSetup()
|
||||
{
|
||||
nsCOMPtr<nsIWebBrowser> wb;
|
||||
mBrowserShell->GetWebBrowser(getter_AddRefs(wb));
|
||||
ThrowIfNil_(wb);
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
wb->GetContentDOMWindow(getter_AddRefs(domWindow));
|
||||
ThrowIfNil_(domWindow);
|
||||
nsCOMPtr<nsIPrintSettings> settings;
|
||||
mBrowserShell->GetPrintSettings(getter_AddRefs(settings));
|
||||
ThrowIfNil_(settings);
|
||||
|
||||
nsCOMPtr<nsIPrintingPromptService> printingPromptService =
|
||||
do_GetService("@mozilla.org/embedcomp/printingprompt-service;1");
|
||||
ThrowIfNil_(printingPromptService);
|
||||
|
||||
nsresult rv = printingPromptService->ShowPageSetup(domWindow, settings, nsnull);
|
||||
if (rv != NS_ERROR_ABORT)
|
||||
ThrowIfError_(rv);
|
||||
}
|
||||
|
||||
|
||||
LView* CPrintAttachment::GetTopmostView(LPane* inStartPane)
|
||||
{
|
||||
// Begin with the start Pane as a
|
||||
// View. Will be nil if start Pane
|
||||
// is nil or is not an LView.
|
||||
LView* theView = dynamic_cast<LView*>(inStartPane);
|
||||
|
||||
if (inStartPane != nil) {
|
||||
// Look at SuperView of start Pane
|
||||
LView* superView = inStartPane->GetSuperView();
|
||||
|
||||
while (superView != nil) { // Move up view hierarchy until
|
||||
theView = superView; // reaching a nil SuperView
|
||||
superView = theView->GetSuperView();
|
||||
}
|
||||
}
|
||||
|
||||
return theView;
|
||||
}
|
||||
|
|
@ -1,335 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "CWindowCreator.h"
|
||||
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsIWebBrowserSetup.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
#include "CBrowserShell.h"
|
||||
#include "CBrowserWindow.h"
|
||||
#include "CPrintAttachment.h"
|
||||
#include "ApplIDs.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// CWindowCreator
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_ISUPPORTS2(CWindowCreator, nsIWindowCreator, nsIWindowCreator2)
|
||||
|
||||
CWindowCreator::CWindowCreator()
|
||||
{
|
||||
}
|
||||
|
||||
CWindowCreator::~CWindowCreator()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CWindowCreator::CreateChromeWindow(nsIWebBrowserChrome *aParent,
|
||||
PRUint32 aChromeFlags,
|
||||
nsIWebBrowserChrome **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
*_retval = 0;
|
||||
|
||||
// we're ignoring aParent,
|
||||
// but since windows on the Mac don't have parents anyway...
|
||||
try {
|
||||
LWindow *theWindow = CreateWindowInternal(aChromeFlags, PR_FALSE, -1, -1);
|
||||
CBrowserShell *browser = dynamic_cast<CBrowserShell*>(theWindow->FindPaneByID(CBrowserShell::paneID_MainBrowser));
|
||||
ThrowIfNil_(browser);
|
||||
browser->GetWebBrowserChrome(_retval);
|
||||
} catch(...) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CWindowCreator::CreateChromeWindow2(nsIWebBrowserChrome *parent,
|
||||
PRUint32 chromeFlags, PRUint32 contextFlags,
|
||||
nsIURI *aURI, PRBool *aCancel,
|
||||
nsIWebBrowserChrome **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCancel);
|
||||
*aCancel = PR_FALSE;
|
||||
if (contextFlags & nsIWindowCreator2::PARENT_IS_LOADING_OR_RUNNING_TIMEOUT) {
|
||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService("@mozilla.org/preferences-service;1"));
|
||||
if (prefs) {
|
||||
PRBool showBlocker = PR_TRUE;
|
||||
prefs->GetBoolPref("browser.popups.showPopupBlocker", &showBlocker);
|
||||
if (showBlocker) {
|
||||
short itemHit;
|
||||
AlertStdAlertParamRec pb;
|
||||
|
||||
LStr255 msgString(STRx_StdAlertStrings, str_OpeningPopupWindow);
|
||||
LStr255 explainString(STRx_StdAlertStrings, str_OpeningPopupWindowExp);
|
||||
LStr255 defaultButtonText(STRx_StdButtonTitles, str_DenyAll);
|
||||
LStr255 cancelButtonText(STRx_StdButtonTitles, str_Allow);
|
||||
|
||||
pb.movable = false;
|
||||
pb.helpButton = false;
|
||||
pb.filterProc = nil;
|
||||
pb.defaultText = defaultButtonText;
|
||||
pb.cancelText = cancelButtonText;
|
||||
pb.otherText = nil;
|
||||
pb.defaultButton = kStdOkItemIndex;
|
||||
pb.cancelButton = kStdCancelItemIndex;
|
||||
pb.position = kWindowAlertPositionParentWindowScreen;
|
||||
|
||||
::StandardAlert(kAlertStopAlert, msgString, explainString, &pb, &itemHit);
|
||||
// This a one-time (for the life of prefs.js) alert
|
||||
prefs->SetBoolPref("browser.popups.showPopupBlocker", PR_FALSE);
|
||||
if (itemHit == kAlertStdAlertOKButton) {
|
||||
// Also, if these prefs are set, the DOM itself will prevent future
|
||||
// popups from being opened and our window creator won't even get
|
||||
// called. If you wanted to filter each request, don't set these
|
||||
// prefs. For this purpose, it's what we want, though.
|
||||
prefs->SetBoolPref("dom.disable_open_during_load", PR_TRUE);
|
||||
prefs->SetIntPref("dom.disable_open_click_delay", 1000);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return CreateChromeWindow(parent, chromeFlags, _retval);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
InitializeWindowCreator creates and hands off an object with a callback
|
||||
to a window creation function. This will be used by Gecko C++ code
|
||||
(never JS) to create new windows when no previous window is handy
|
||||
to begin with. This is done in a few exceptional cases, like PSM code.
|
||||
Failure to set this callback will only disable the ability to create
|
||||
new windows under these circumstances.
|
||||
*/
|
||||
|
||||
nsresult CWindowCreator::Initialize()
|
||||
{
|
||||
// Create a CWindowCreator and give it to the WindowWatcher service
|
||||
// The WindowWatcher service will own it so we don't keep a ref.
|
||||
CWindowCreator *windowCreator = new CWindowCreator;
|
||||
if (!windowCreator) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
if (!wwatch) return NS_ERROR_FAILURE;
|
||||
return wwatch->SetWindowCreator(windowCreator);
|
||||
}
|
||||
|
||||
LWindow* CWindowCreator::CreateWindowInternal(PRUint32 inChromeFlags,
|
||||
PRBool enablePrinting,
|
||||
PRInt32 width, PRInt32 height)
|
||||
{
|
||||
const SInt16 kStatusBarHeight = 16;
|
||||
const SDimension16 kMinimumWindowDimension = { 300, 150 };
|
||||
const SInt16 kStdSizeVertMargin = 100;
|
||||
|
||||
LWindow *theWindow;
|
||||
PRUint32 chromeFlags;
|
||||
|
||||
if (inChromeFlags == nsIWebBrowserChrome::CHROME_DEFAULT)
|
||||
chromeFlags = nsIWebBrowserChrome::CHROME_WINDOW_RESIZE |
|
||||
nsIWebBrowserChrome::CHROME_WINDOW_CLOSE |
|
||||
nsIWebBrowserChrome::CHROME_TOOLBAR |
|
||||
nsIWebBrowserChrome::CHROME_STATUSBAR;
|
||||
else
|
||||
chromeFlags = inChromeFlags;
|
||||
|
||||
// Bounds - Set to an arbitrary rect - we'll size it after all the subviews are in.
|
||||
Rect globalBounds;
|
||||
globalBounds.left = 4;
|
||||
globalBounds.top = 42;
|
||||
globalBounds.right = globalBounds.left + 600;
|
||||
globalBounds.bottom = globalBounds.top + 400;
|
||||
|
||||
// ProcID and attributes
|
||||
short windowDefProc;
|
||||
UInt32 windowAttrs = (windAttr_Enabled | windAttr_Targetable);
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG)
|
||||
{
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_TITLEBAR)
|
||||
{
|
||||
windowDefProc = kWindowMovableModalDialogProc;
|
||||
windowAttrs |= windAttr_TitleBar;
|
||||
}
|
||||
else
|
||||
windowDefProc = kWindowModalDialogProc;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE)
|
||||
{
|
||||
windowDefProc = kWindowGrowDocumentProc;
|
||||
windowAttrs |= windAttr_Resizable;
|
||||
windowAttrs |= windAttr_Zoomable;
|
||||
}
|
||||
else
|
||||
windowDefProc = kWindowDocumentProc;
|
||||
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_CLOSE)
|
||||
windowAttrs |= windAttr_CloseBox;
|
||||
}
|
||||
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL)
|
||||
windowAttrs |= windAttr_Modal;
|
||||
else
|
||||
windowAttrs |= windAttr_Regular;
|
||||
|
||||
theWindow = new CBrowserWindow(LCommander::GetTopCommander(), globalBounds, "\p", windowDefProc, windowAttrs, window_InFront);
|
||||
ThrowIfNil_(theWindow);
|
||||
|
||||
if (windowAttrs & windAttr_Resizable)
|
||||
{
|
||||
Rect stdBounds, minMaxBounds;
|
||||
SDimension16 stdSize;
|
||||
|
||||
theWindow->CalcStandardBounds(stdBounds);
|
||||
stdSize.width = stdBounds.right - stdBounds.left;
|
||||
stdSize.height = stdBounds.bottom - stdBounds.top;
|
||||
stdSize.width -= kStdSizeVertMargin; // Leave a vertical strip of desktop exposed
|
||||
theWindow->SetStandardSize(stdSize);
|
||||
minMaxBounds.left = kMinimumWindowDimension.width;
|
||||
minMaxBounds.top = kMinimumWindowDimension.height;
|
||||
|
||||
Rect deskRect;
|
||||
::GetRegionBounds(::GetGrayRgn(), &deskRect);
|
||||
minMaxBounds.left = kMinimumWindowDimension.width;
|
||||
minMaxBounds.top = kMinimumWindowDimension.height;
|
||||
minMaxBounds.right = deskRect.right - deskRect.left;
|
||||
minMaxBounds.bottom = deskRect.bottom - deskRect.top;
|
||||
theWindow->SetMinMaxSize(minMaxBounds);
|
||||
}
|
||||
|
||||
SDimension16 windowSize, toolBarSize;
|
||||
theWindow->GetFrameSize(windowSize);
|
||||
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_TOOLBAR)
|
||||
{
|
||||
LView::SetDefaultView(theWindow);
|
||||
LCommander::SetDefaultCommander(theWindow);
|
||||
LAttachable::SetDefaultAttachable(nil);
|
||||
|
||||
LView *toolBarView = static_cast<LView*>(UReanimator::ReadObjects(ResType_PPob, 131));
|
||||
ThrowIfNil_(toolBarView);
|
||||
|
||||
toolBarView->GetFrameSize(toolBarSize);
|
||||
toolBarView->PlaceInSuperFrameAt(0, 0, false);
|
||||
toolBarSize.width = windowSize.width;
|
||||
toolBarView->ResizeFrameTo(toolBarSize.width, toolBarSize.height, false);
|
||||
}
|
||||
|
||||
SPaneInfo aPaneInfo;
|
||||
SViewInfo aViewInfo;
|
||||
|
||||
aPaneInfo.paneID = CBrowserShell::paneID_MainBrowser;
|
||||
aPaneInfo.width = windowSize.width;
|
||||
aPaneInfo.height = windowSize.height;
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_TOOLBAR)
|
||||
aPaneInfo.height -= toolBarSize.height;
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_STATUSBAR)
|
||||
aPaneInfo.height -= kStatusBarHeight - 1;
|
||||
aPaneInfo.visible = true;
|
||||
aPaneInfo.enabled = true;
|
||||
aPaneInfo.bindings.left = true;
|
||||
aPaneInfo.bindings.top = true;
|
||||
aPaneInfo.bindings.right = true;
|
||||
aPaneInfo.bindings.bottom = true;
|
||||
aPaneInfo.left = 0;
|
||||
aPaneInfo.top = (chromeFlags & nsIWebBrowserChrome::CHROME_TOOLBAR) ? toolBarSize.height : 0;
|
||||
aPaneInfo.userCon = 0;
|
||||
aPaneInfo.superView = theWindow;
|
||||
|
||||
aViewInfo.imageSize.width = 0;
|
||||
aViewInfo.imageSize.height = 0;
|
||||
aViewInfo.scrollPos.h = aViewInfo.scrollPos.v = 0;
|
||||
aViewInfo.scrollUnit.h = aViewInfo.scrollUnit.v = 1;
|
||||
aViewInfo.reconcileOverhang = 0;
|
||||
|
||||
CBrowserShell *aShell = new CBrowserShell(aPaneInfo, aViewInfo, chromeFlags, PR_TRUE);
|
||||
ThrowIfNil_(aShell);
|
||||
aShell->AddAttachments();
|
||||
aShell->PutInside(theWindow, false);
|
||||
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME)
|
||||
{
|
||||
nsCOMPtr<nsIWebBrowser> browser;
|
||||
aShell->GetWebBrowser(getter_AddRefs(browser));
|
||||
nsCOMPtr<nsIWebBrowserSetup> setup(do_QueryInterface(browser));
|
||||
if (setup)
|
||||
setup->SetProperty(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER, PR_TRUE);
|
||||
}
|
||||
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_STATUSBAR)
|
||||
{
|
||||
LView::SetDefaultView(theWindow);
|
||||
LCommander::SetDefaultCommander(theWindow);
|
||||
LAttachable::SetDefaultAttachable(nil);
|
||||
|
||||
LView *statusView = static_cast<LView*>(UReanimator::ReadObjects(ResType_PPob, 130));
|
||||
ThrowIfNil_(statusView);
|
||||
|
||||
statusView->PlaceInSuperFrameAt(0, windowSize.height - kStatusBarHeight + 1, false);
|
||||
statusView->ResizeFrameTo(windowSize.width - 15, kStatusBarHeight, false);
|
||||
}
|
||||
|
||||
if (enablePrinting)
|
||||
{
|
||||
CPrintAttachment *printAttachment = new CPrintAttachment(CBrowserShell::paneID_MainBrowser);
|
||||
ThrowIfNil_(printAttachment);
|
||||
theWindow->AddAttachment(printAttachment);
|
||||
}
|
||||
|
||||
// Now the window is constructed...
|
||||
theWindow->FinishCreate();
|
||||
|
||||
Rect theBounds;
|
||||
theWindow->GetGlobalBounds(theBounds);
|
||||
if (width == -1)
|
||||
width = theBounds.right - theBounds.left;
|
||||
if (height == -1)
|
||||
height = theBounds.bottom - theBounds.top;
|
||||
|
||||
theWindow->ResizeWindowTo(width, height);
|
||||
|
||||
return theWindow;
|
||||
}
|
|
@ -45,7 +45,7 @@
|
|||
#include "qgeckoembed.h"
|
||||
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
EmbedContentListener::EmbedContentListener(QGeckoEmbed *aOwner)
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
#include "nsString.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsParserCIID.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsCRT.h"
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "nsString.h"
|
||||
|
||||
#include "nsIPopupWindowManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
#include "nsIWebBrowser.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIEmbeddingSiteWindow.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsQAWindowCreator.h"
|
||||
#include "nsIQABrowserUIGlue.h"
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
// Mozilla Includes
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "nsMemory.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "BrowserFrm.h"
|
||||
#include "EditorFrm.h"
|
||||
#include "winEmbedFileLocProvider.h"
|
||||
|
|
|
@ -1,147 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: Mozilla-sample-code 1.0
|
||||
*
|
||||
* Copyright (c) 2002 Netscape Communications Corporation and
|
||||
* other contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this Mozilla sample software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
* persons to whom the Software is furnished to do so, subject to the
|
||||
* following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
//
|
||||
// CMostRecentUrls object is responsible for keeping track of the
|
||||
// 16 most recently used URLs. It stores this list in a file named
|
||||
// "urls.txt" on a per profile basis in the user's profile directory
|
||||
//
|
||||
// The constructor loads the URL list
|
||||
// The destructor saves the URL list
|
||||
//
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "MostRecentUrls.h"
|
||||
|
||||
//--------------------------------------------------------
|
||||
//-- CMostRecentUrls
|
||||
//--------------------------------------------------------
|
||||
CMostRecentUrls::CMostRecentUrls() :
|
||||
mNumURLs(0)
|
||||
{
|
||||
for (int i=0;i<MAX_URLS;i++) {
|
||||
mURLs[i] = NULL;
|
||||
}
|
||||
|
||||
FILE * fd = GetFD("r");
|
||||
if (fd) {
|
||||
char line[512];
|
||||
while (fgets(line, 512, fd)) {
|
||||
if (strlen(line) > 1) {
|
||||
line[strlen(line)-1] = 0;
|
||||
mURLs[mNumURLs++] = _strdup(line);
|
||||
}
|
||||
}
|
||||
fclose(fd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FILE * CMostRecentUrls::GetFD(const char * aMode)
|
||||
{
|
||||
FILE * fd = nsnull;
|
||||
nsCOMPtr<nsIFile> file;
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(file));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsILocalFile> local_file(do_QueryInterface(file));
|
||||
local_file->AppendNative(nsEmbedCString("urls.txt"));
|
||||
local_file->OpenANSIFileDesc(aMode, &fd);
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
CMostRecentUrls::~CMostRecentUrls()
|
||||
{
|
||||
FILE * fd = GetFD("w");
|
||||
if (fd) {
|
||||
for (int i=0;i<MAX_URLS;i++) {
|
||||
if(mURLs[i])
|
||||
fprintf(fd, "%s\n", mURLs[i]);
|
||||
}
|
||||
fclose(fd);
|
||||
}
|
||||
|
||||
for (int i=0;i<MAX_URLS;i++) {
|
||||
if(mURLs[i])
|
||||
free(mURLs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
char * CMostRecentUrls::GetURL(int aInx)
|
||||
{
|
||||
if (aInx < mNumURLs) {
|
||||
return mURLs[aInx];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CMostRecentUrls::AddURL(const char * aURL)
|
||||
{
|
||||
char szTemp[512];
|
||||
strncpy(szTemp, aURL, sizeof(szTemp));
|
||||
szTemp[sizeof(szTemp) - 1] = '\0';
|
||||
|
||||
// check to see if an existing url matches the one passed in
|
||||
int i = 0;
|
||||
for (; i<MAX_URLS-1; i++)
|
||||
{
|
||||
if(mURLs[i])
|
||||
{
|
||||
if(strcmpi(mURLs[i], szTemp) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if there was a match "i" will point to matching url entry
|
||||
// if not i will be MAX_URLS-1
|
||||
|
||||
// move all url entries before this one down
|
||||
for (; i>0; i--)
|
||||
{
|
||||
if(mURLs[i])
|
||||
free(mURLs[i]);
|
||||
|
||||
if(mURLs[i-1])
|
||||
mURLs[i] = _strdup(mURLs[i-1]);
|
||||
}
|
||||
|
||||
// place this url at the top
|
||||
if(mURLs[0])
|
||||
free(mURLs[0]);
|
||||
mURLs[0] = _strdup(szTemp);
|
||||
}
|
|
@ -1,203 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: Mozilla-sample-code 1.0
|
||||
*
|
||||
* Copyright (c) 2002 Netscape Communications Corporation and
|
||||
* other contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this Mozilla sample software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
* persons to whom the Software is furnished to do so, subject to the
|
||||
* following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Local Includes
|
||||
#include "stdafx.h"
|
||||
#include "mfcembed.h"
|
||||
#include "ProfileMgr.h"
|
||||
#include "ProfilesDlg.h"
|
||||
|
||||
// Mozilla Includes
|
||||
#include "nsEmbedString.h"
|
||||
#include "nsIRegistry.h"
|
||||
#include "nsIProfile.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
// Constants
|
||||
#define kRegistryGlobalPrefsSubtreeString (nsEmbedString(L"global-prefs"))
|
||||
#define kRegistryShowProfilesAtStartup "start-show-dialog"
|
||||
|
||||
//*****************************************************************************
|
||||
//*** CProfileMgr: Object Management
|
||||
//*****************************************************************************
|
||||
|
||||
CProfileMgr::CProfileMgr()
|
||||
{
|
||||
}
|
||||
|
||||
CProfileMgr::~CProfileMgr()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//*** CProfileMgr: Public Methods
|
||||
//*****************************************************************************
|
||||
|
||||
nsresult CProfileMgr::StartUp()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIProfile> profileService =
|
||||
do_GetService(NS_PROFILE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRInt32 profileCount;
|
||||
rv = profileService->GetProfileCount(&profileCount);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (profileCount == 0)
|
||||
{
|
||||
// Make a new default profile
|
||||
nsEmbedString newProfileName(L"default");
|
||||
|
||||
rv = profileService->CreateNewProfile(newProfileName.get(), nsnull, nsnull, PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = profileService->SetCurrentProfile(newProfileName.get());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use our flag here to check for whether to show profile mgr UI. If the flag
|
||||
// says don't show it, just start with the last used profile.
|
||||
|
||||
PRBool showIt;
|
||||
rv = GetShowDialogOnStart(&showIt);
|
||||
|
||||
if (NS_FAILED(rv) || (profileCount > 1 && showIt))
|
||||
{
|
||||
DoManageProfilesDialog(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// GetCurrentProfile returns the profile which was last used but is not nescesarily
|
||||
// active. Call SetCurrentProfile to make it installed and active.
|
||||
|
||||
PRUnichar *currProfileName = nsnull;
|
||||
rv = profileService->GetCurrentProfile(&currProfileName);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = profileService->SetCurrentProfile(currProfileName);
|
||||
nsMemory::Free(currProfileName);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult CProfileMgr::DoManageProfilesDialog(PRBool bAtStartUp)
|
||||
{
|
||||
CProfilesDlg dialog;
|
||||
nsresult rv;
|
||||
PRBool showIt;
|
||||
|
||||
rv = GetShowDialogOnStart(&showIt);
|
||||
dialog.m_bAtStartUp = bAtStartUp;
|
||||
dialog.m_bAskAtStartUp = NS_SUCCEEDED(rv) ? showIt : TRUE;
|
||||
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
SetShowDialogOnStart(dialog.m_bAskAtStartUp);
|
||||
|
||||
nsCOMPtr<nsIProfile> profileService =
|
||||
do_GetService(NS_PROFILE_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = profileService->SetCurrentProfile(dialog.m_SelectedProfile.get());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//*** CProfileMgr: Protected Methods
|
||||
//*****************************************************************************
|
||||
|
||||
nsresult CProfileMgr::GetShowDialogOnStart(PRBool* showIt)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
*showIt = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsIRegistry> registry(do_CreateInstance(NS_REGISTRY_CONTRACTID, &rv));
|
||||
rv = registry->OpenWellKnownRegistry(nsIRegistry::ApplicationRegistry);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsRegistryKey profilesTreeKey;
|
||||
|
||||
rv = registry->GetKey(nsIRegistry::Common,
|
||||
kRegistryGlobalPrefsSubtreeString.get(),
|
||||
&profilesTreeKey);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRInt32 flagValue;
|
||||
rv = registry->GetInt(profilesTreeKey,
|
||||
kRegistryShowProfilesAtStartup,
|
||||
&flagValue);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
*showIt = (flagValue != 0);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult CProfileMgr::SetShowDialogOnStart(PRBool showIt)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIRegistry> registry(do_CreateInstance(NS_REGISTRY_CONTRACTID, &rv));
|
||||
rv = registry->OpenWellKnownRegistry(nsIRegistry::ApplicationRegistry);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsRegistryKey profilesTreeKey;
|
||||
|
||||
rv = registry->GetKey(nsIRegistry::Common,
|
||||
kRegistryGlobalPrefsSubtreeString.get(),
|
||||
&profilesTreeKey);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
rv = registry->AddKey(nsIRegistry::Common,
|
||||
kRegistryGlobalPrefsSubtreeString.get(),
|
||||
&profilesTreeKey);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
||||
rv = registry->SetInt(profilesTreeKey,
|
||||
kRegistryShowProfilesAtStartup,
|
||||
showIt);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -1,333 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: Mozilla-sample-code 1.0
|
||||
*
|
||||
* Copyright (c) 2002 Netscape Communications Corporation and
|
||||
* other contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this Mozilla sample software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
* persons to whom the Software is furnished to do so, subject to the
|
||||
* following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// ProfilesDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <afxpriv.h>
|
||||
#include "mfcembed.h"
|
||||
#include "ProfilesDlg.h"
|
||||
|
||||
// Mozilla
|
||||
#include "nsIProfile.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
// Static Routines
|
||||
static void ValidateProfileName(const CString& profileName, CDataExchange* pDX)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
nsresult rv;
|
||||
PRBool exists = FALSE;
|
||||
|
||||
{
|
||||
nsCOMPtr<nsIProfile> profileService =
|
||||
do_GetService(NS_PROFILE_CONTRACTID, &rv);
|
||||
rv = profileService->ProfileExists(T2CW(profileName), &exists);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && exists)
|
||||
{
|
||||
CString errMsg;
|
||||
errMsg.Format(_T("Error: A profile named \"%s\" already exists."), profileName);
|
||||
AfxMessageBox( errMsg, MB_ICONEXCLAMATION );
|
||||
errMsg.Empty();
|
||||
pDX->Fail();
|
||||
}
|
||||
|
||||
if (profileName.FindOneOf(_T("\\/")) != -1)
|
||||
{
|
||||
AfxMessageBox( _T("Error: A profile name cannot contain the characters \"\\\" or \"/\"."), MB_ICONEXCLAMATION );
|
||||
pDX->Fail();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNewProfileDlg dialog
|
||||
|
||||
|
||||
CNewProfileDlg::CNewProfileDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CNewProfileDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CNewProfileDlg)
|
||||
m_LocaleIndex = -1;
|
||||
m_Name = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CNewProfileDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CNewProfileDlg)
|
||||
DDX_CBIndex(pDX, IDC_LOCALE_COMBO, m_LocaleIndex);
|
||||
DDX_Text(pDX, IDC_NEW_PROF_NAME, m_Name);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
pDX->PrepareEditCtrl(IDC_NEW_PROF_NAME);
|
||||
if (pDX->m_bSaveAndValidate)
|
||||
{
|
||||
ValidateProfileName(m_Name, pDX);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CNewProfileDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CNewProfileDlg)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNewProfileDlg message handlers
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CRenameProfileDlg dialog
|
||||
|
||||
|
||||
CRenameProfileDlg::CRenameProfileDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CRenameProfileDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CRenameProfileDlg)
|
||||
m_NewName = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CRenameProfileDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CRenameProfileDlg)
|
||||
DDX_Text(pDX, IDC_NEW_NAME, m_NewName);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
pDX->PrepareEditCtrl(IDC_NEW_NAME);
|
||||
if (pDX->m_bSaveAndValidate)
|
||||
{
|
||||
ValidateProfileName(m_NewName, pDX);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CRenameProfileDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CRenameProfileDlg)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CRenameProfileDlg message handlers
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CProfilesDlg dialog
|
||||
|
||||
|
||||
CProfilesDlg::CProfilesDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CProfilesDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CProfilesDlg)
|
||||
m_bAtStartUp = FALSE;
|
||||
m_bAskAtStartUp = FALSE;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CProfilesDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CProfilesDlg)
|
||||
DDX_Control(pDX, IDC_LIST1, m_ProfileList);
|
||||
DDX_Check(pDX, IDC_CHECK_ASK_AT_START, m_bAskAtStartUp);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
if (pDX->m_bSaveAndValidate)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
int itemIndex = m_ProfileList.GetCurSel();
|
||||
if (itemIndex != LB_ERR)
|
||||
{
|
||||
CString itemText;
|
||||
m_ProfileList.GetText(itemIndex, itemText);
|
||||
m_SelectedProfile.Assign(T2CW(itemText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CProfilesDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CProfilesDlg)
|
||||
ON_BN_CLICKED(IDC_PROF_NEW, OnNewProfile)
|
||||
ON_BN_CLICKED(IDC_PROF_RENAME, OnRenameProfile)
|
||||
ON_BN_CLICKED(IDC_PROF_DELETE, OnDeleteProfile)
|
||||
ON_LBN_DBLCLK(IDC_LIST1, OnDblclkProfile)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CProfilesDlg message handlers
|
||||
|
||||
BOOL CProfilesDlg::OnInitDialog()
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
PRUnichar *curProfileName = nsnull;
|
||||
|
||||
// Fill the list of profiles
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIProfile> profileService =
|
||||
do_GetService(NS_PROFILE_CONTRACTID, &rv);
|
||||
profileService->GetCurrentProfile(&curProfileName);
|
||||
|
||||
PRInt32 selectedRow = 0;
|
||||
PRUint32 listLen;
|
||||
PRUnichar **profileList;
|
||||
rv = profileService->GetProfileList(&listLen, &profileList);
|
||||
|
||||
for (PRUint32 index = 0; index < listLen; index++)
|
||||
{
|
||||
CString tmpStr(W2T(profileList[index]));
|
||||
m_ProfileList.AddString(tmpStr);
|
||||
if (wcscmp(profileList[index], curProfileName) == 0)
|
||||
selectedRow = index;
|
||||
}
|
||||
nsMemory::Free(curProfileName);
|
||||
|
||||
m_ProfileList.SetCurSel(selectedRow);
|
||||
|
||||
if (m_bAtStartUp)
|
||||
{
|
||||
GetDlgItem(IDCANCEL)->EnableWindow(FALSE);
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CProfilesDlg::OnNewProfile()
|
||||
{
|
||||
CNewProfileDlg dialog;
|
||||
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIProfile> profileService =
|
||||
do_GetService(NS_PROFILE_CONTRACTID, &rv);
|
||||
ASSERT(NS_SUCCEEDED(rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
rv = profileService->CreateNewProfile(T2CW(dialog.m_Name), nsnull, nsnull, PR_FALSE);
|
||||
ASSERT(NS_SUCCEEDED(rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
int item = m_ProfileList.AddString(dialog.m_Name);
|
||||
m_ProfileList.SetCurSel(item);
|
||||
GetDlgItem(IDOK)->EnableWindow(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CProfilesDlg::OnRenameProfile()
|
||||
{
|
||||
CRenameProfileDlg dialog;
|
||||
|
||||
int itemIndex = m_ProfileList.GetCurSel();
|
||||
ASSERT(itemIndex != LB_ERR);
|
||||
if (itemIndex == LB_ERR)
|
||||
return;
|
||||
|
||||
m_ProfileList.GetText(itemIndex, dialog.m_CurrentName);
|
||||
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIProfile> profileService =
|
||||
do_GetService(NS_PROFILE_CONTRACTID, &rv);
|
||||
ASSERT(NS_SUCCEEDED(rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = profileService->RenameProfile(T2CW(dialog.m_CurrentName), T2CW(dialog.m_NewName));
|
||||
ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CProfilesDlg::OnDeleteProfile()
|
||||
{
|
||||
int itemIndex = m_ProfileList.GetCurSel();
|
||||
ASSERT(itemIndex != LB_ERR);
|
||||
if (itemIndex == LB_ERR)
|
||||
return;
|
||||
|
||||
CString selectedProfile;
|
||||
m_ProfileList.GetText(itemIndex, selectedProfile);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIProfile> profileService =
|
||||
do_GetService(NS_PROFILE_CONTRACTID, &rv);
|
||||
ASSERT(NS_SUCCEEDED(rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
rv = profileService->DeleteProfile(T2CW(selectedProfile), PR_TRUE);
|
||||
ASSERT(NS_SUCCEEDED(rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
int itemCount = m_ProfileList.DeleteString(itemIndex);
|
||||
if (itemCount == 0)
|
||||
GetDlgItem(IDOK)->EnableWindow(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CProfilesDlg::OnDblclkProfile()
|
||||
{
|
||||
OnOK();
|
||||
}
|
|
@ -37,7 +37,7 @@
|
|||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIProperties.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefBranchInternal.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNodeFilter.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "inIDOMUtils.h"
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -55,7 +55,7 @@
|
|||
#include "nsILocalFile.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsITridentProfileMigrator.h"
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsIWebDAVService.h"
|
||||
#include "nsWebDAVServiceCID.h"
|
||||
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIIOService.h"
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#ifdef MOZ_ENABLE_XFT
|
||||
#include "nsFontMetricsXft.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "prenv.h"
|
||||
#endif /* MOZ_ENABLE_XFT */
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsFontMetricsXft.h"
|
||||
#include "prenv.h"
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "nsIDeviceContext.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#define PANGO_ENABLE_BACKEND
|
||||
#define PANGO_ENABLE_ENGINE
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#ifdef MOZ_ENABLE_XFT
|
||||
#include "nsFontMetricsXft.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "prenv.h"
|
||||
#endif /* MOZ_ENABLE_XFT */
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsFontMetricsXft.h"
|
||||
#include "prenv.h"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "plbase64.h"
|
||||
#include "prmem.h"
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "nsILocaleService.h"
|
||||
#include "nsLocale.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "prprf.h"
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "nsXPCOM.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsILineBreakerFactory.h"
|
||||
#include "nsILineBreaker.h"
|
||||
#include "nsIWordBreakerFactory.h"
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsITimelineService.h"
|
||||
#include "nsPlatformCharset.h"
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include "nsISupportsUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsICharRepresentable.h"
|
||||
#include <string.h>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "ipcMessageReader.h"
|
||||
#include "ipcLog.h"
|
||||
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIInterfaceInfo.h"
|
||||
#include "nsIInterfaceInfoManager.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include <stdio.h>
|
||||
#include "ipcILockService.h"
|
||||
#include "ipcLockCID.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "org_mozilla_webclient_impl_wrapper_0005fnative_NavigationImpl.h"
|
||||
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsString.h"
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsLayoutCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsLayoutStylesheetCache, nsIObserver)
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "nsIProperties.h"
|
||||
#include "nsIProfileMigrator.h"
|
||||
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsXPCOMCID.h"
|
||||
#include "nsCRT.h"
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include "nsIModule.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsXPCOMCID.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "imgCache.h"
|
||||
#include "imgContainer.h"
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "nsSharedPrefHandler.h"
|
||||
#include "nsPrefService.h"
|
||||
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
|
|
@ -86,11 +86,11 @@
|
|||
#include "nsInterfaceRequestorAgg.h"
|
||||
|
||||
// Helper, to simplify getting the I/O service.
|
||||
inline const nsGetServiceByCID
|
||||
inline const nsGetServiceByCIDWithError
|
||||
do_GetIOService(nsresult* error = 0)
|
||||
{
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
return nsGetServiceByCID(kIOServiceCID, 0, error);
|
||||
return nsGetServiceByCIDWithError(kIOServiceCID, error);
|
||||
}
|
||||
|
||||
// private little helper function... don't call this directly!
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "nsAppShell.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "plhash.h"
|
||||
#include "prenv.h"
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsEventQueueWatcher.h"
|
||||
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsGfxCIID.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIFullScreen.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIScreenManager.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
* Header Files *
|
||||
*******************************************************************************/
|
||||
#include "nscore.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -66,7 +66,6 @@ endif
|
|||
EXPORTS = \
|
||||
nsCategoryManagerUtils.h \
|
||||
nsComponentManagerObsolete.h \
|
||||
nsIServiceManagerUtils.h \
|
||||
nsIServiceManagerObsolete.h \
|
||||
nsModule.h \
|
||||
nsNativeComponentLoader.h \
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include "nsIFactory.h"
|
||||
#include "nsIStringEnumerator.h"
|
||||
#include "nsSupportsPrimitives.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsCRT.h"
|
||||
|
|
|
@ -217,17 +217,24 @@ nsGetServiceFromCategory::operator()(const nsIID& aIID, void** aInstancePtr) con
|
|||
{
|
||||
nsresult rv;
|
||||
nsXPIDLCString value;
|
||||
nsCOMPtr<nsIServiceManager> serviceManager =
|
||||
do_QueryInterface(mServiceManager);
|
||||
// XXX Should we use the provided service manager?
|
||||
nsCOMPtr<nsICategoryManager> catman =
|
||||
do_GetService(kCategoryManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) goto error;
|
||||
nsCOMPtr<nsICategoryManager> catman;
|
||||
nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager;
|
||||
if (!compMgr) {
|
||||
rv = NS_ERROR_NOT_INITIALIZED;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!mCategory || !mEntry) {
|
||||
// when categories have defaults, use that for null mEntry
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
goto error;
|
||||
}
|
||||
|
||||
rv = compMgr->nsComponentManagerImpl::GetService(kCategoryManagerCID,
|
||||
NS_GET_IID(nsICategoryManager),
|
||||
getter_AddRefs(catman));
|
||||
if (NS_FAILED(rv)) goto error;
|
||||
|
||||
/* find the contractID for category.entry */
|
||||
rv = catman->GetCategoryEntry(mCategory, mEntry,
|
||||
getter_Copies(value));
|
||||
|
@ -236,14 +243,10 @@ nsGetServiceFromCategory::operator()(const nsIID& aIID, void** aInstancePtr) con
|
|||
rv = NS_ERROR_SERVICE_NOT_AVAILABLE;
|
||||
goto error;
|
||||
}
|
||||
if (serviceManager) {
|
||||
rv = serviceManager->GetServiceByContractID(value, aIID, (void**)aInstancePtr);
|
||||
} else {
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
if (mgr)
|
||||
rv = mgr->GetServiceByContractID(value, aIID, (void**)aInstancePtr);
|
||||
}
|
||||
|
||||
rv = compMgr->
|
||||
nsComponentManagerImpl::GetServiceByContractID(value,
|
||||
aIID, aInstancePtr);
|
||||
if (NS_FAILED(rv)) {
|
||||
error:
|
||||
*aInstancePtr = 0;
|
||||
|
|
|
@ -112,7 +112,7 @@ interface nsIServiceManager : nsISupports
|
|||
|
||||
#ifndef MOZILLA_STRICT_API
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIServiceManagerObsolete.h"
|
||||
#endif
|
||||
%}
|
||||
|
|
|
@ -107,6 +107,42 @@ nsCOMPtr_base::assign_from_qi_with_error( const nsQueryInterfaceWithError& qi, c
|
|||
assign_assuming_AddRef(newRawPtr);
|
||||
}
|
||||
|
||||
void
|
||||
nsCOMPtr_base::assign_from_gs_cid( const nsGetServiceByCID gs, const nsIID& iid )
|
||||
{
|
||||
nsISupports* newRawPtr;
|
||||
if ( NS_FAILED( gs(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
|
||||
newRawPtr = 0;
|
||||
assign_assuming_AddRef(newRawPtr);
|
||||
}
|
||||
|
||||
void
|
||||
nsCOMPtr_base::assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError& gs, const nsIID& iid )
|
||||
{
|
||||
nsISupports* newRawPtr;
|
||||
if ( NS_FAILED( gs(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
|
||||
newRawPtr = 0;
|
||||
assign_assuming_AddRef(newRawPtr);
|
||||
}
|
||||
|
||||
void
|
||||
nsCOMPtr_base::assign_from_gs_contractid( const nsGetServiceByContractID gs, const nsIID& iid )
|
||||
{
|
||||
nsISupports* newRawPtr;
|
||||
if ( NS_FAILED( gs(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
|
||||
newRawPtr = 0;
|
||||
assign_assuming_AddRef(newRawPtr);
|
||||
}
|
||||
|
||||
void
|
||||
nsCOMPtr_base::assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError& gs, const nsIID& iid )
|
||||
{
|
||||
nsISupports* newRawPtr;
|
||||
if ( NS_FAILED( gs(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
|
||||
newRawPtr = 0;
|
||||
assign_assuming_AddRef(newRawPtr);
|
||||
}
|
||||
|
||||
void
|
||||
nsCOMPtr_base::assign_from_helper( const nsCOMPtr_helper& helper, const nsIID& iid )
|
||||
{
|
||||
|
|
|
@ -409,6 +409,71 @@ do_QueryInterface( already_AddRefed<T>&, nsresult* )
|
|||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Using servicemanager with COMPtrs
|
||||
class NS_COM_GLUE nsGetServiceByCID
|
||||
{
|
||||
public:
|
||||
nsGetServiceByCID(const nsCID& aCID)
|
||||
: mCID(aCID)
|
||||
{
|
||||
// nothing else to do
|
||||
}
|
||||
|
||||
nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const nsCID& mCID;
|
||||
};
|
||||
|
||||
class NS_COM_GLUE nsGetServiceByCIDWithError
|
||||
{
|
||||
public:
|
||||
nsGetServiceByCIDWithError( const nsCID& aCID, nsresult* aErrorPtr )
|
||||
: mCID(aCID),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
// nothing else to do
|
||||
}
|
||||
|
||||
nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const nsCID& mCID;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
class NS_COM_GLUE nsGetServiceByContractID
|
||||
{
|
||||
public:
|
||||
nsGetServiceByContractID(const char* aContractID)
|
||||
: mContractID(aContractID)
|
||||
{
|
||||
// nothing else to do
|
||||
}
|
||||
|
||||
nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const char* mContractID;
|
||||
};
|
||||
|
||||
class NS_COM_GLUE nsGetServiceByContractIDWithError
|
||||
{
|
||||
public:
|
||||
nsGetServiceByContractIDWithError(const char* aContractID, nsresult* aErrorPtr)
|
||||
: mContractID(aContractID),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
// nothing else to do
|
||||
}
|
||||
|
||||
nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const char* mContractID;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
class nsCOMPtr_base
|
||||
/*
|
||||
|
@ -437,6 +502,10 @@ class nsCOMPtr_base
|
|||
NS_COM_GLUE void NS_FASTCALL assign_with_AddRef( nsISupports* );
|
||||
NS_COM_GLUE void NS_FASTCALL assign_from_qi( const nsQueryInterface, const nsIID& );
|
||||
NS_COM_GLUE void NS_FASTCALL assign_from_qi_with_error( const nsQueryInterfaceWithError&, const nsIID& );
|
||||
NS_COM_GLUE void NS_FASTCALL assign_from_gs_cid( const nsGetServiceByCID, const nsIID& );
|
||||
NS_COM_GLUE void NS_FASTCALL assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError&, const nsIID& );
|
||||
NS_COM_GLUE void NS_FASTCALL assign_from_gs_contractid( const nsGetServiceByContractID, const nsIID& );
|
||||
NS_COM_GLUE void NS_FASTCALL assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError&, const nsIID& );
|
||||
NS_COM_GLUE void NS_FASTCALL assign_from_helper( const nsCOMPtr_helper&, const nsIID& );
|
||||
NS_COM_GLUE void** NS_FASTCALL begin_assignment();
|
||||
|
||||
|
@ -481,6 +550,10 @@ class nsCOMPtr
|
|||
void assign_with_AddRef( nsISupports* );
|
||||
void assign_from_qi( const nsQueryInterface, const nsIID& );
|
||||
void assign_from_qi_with_error( const nsQueryInterfaceWithError&, const nsIID& );
|
||||
void assign_from_gs_cid( const nsGetServiceByCID, const nsIID& );
|
||||
void assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError&, const nsIID& );
|
||||
void assign_from_gs_contractid( const nsGetServiceByContractID, const nsIID& );
|
||||
void assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError&, const nsIID& );
|
||||
void assign_from_helper( const nsCOMPtr_helper&, const nsIID& );
|
||||
void** begin_assignment();
|
||||
|
||||
|
@ -580,6 +653,38 @@ class nsCOMPtr
|
|||
assign_from_qi_with_error(qi, NS_GET_IID(T));
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsGetServiceByCID gs )
|
||||
: NSCAP_CTOR_BASE(0)
|
||||
// construct from |do_GetService(cid_expr)|
|
||||
{
|
||||
NSCAP_LOG_ASSIGNMENT(this, 0);
|
||||
assign_from_gs_cid(gs, NS_GET_IID(T));
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsGetServiceByCIDWithError& gs )
|
||||
: NSCAP_CTOR_BASE(0)
|
||||
// construct from |do_GetService(cid_expr, &rv)|
|
||||
{
|
||||
NSCAP_LOG_ASSIGNMENT(this, 0);
|
||||
assign_from_gs_cid_with_error(gs, NS_GET_IID(T));
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsGetServiceByContractID gs )
|
||||
: NSCAP_CTOR_BASE(0)
|
||||
// construct from |do_GetService(contractid_expr)|
|
||||
{
|
||||
NSCAP_LOG_ASSIGNMENT(this, 0);
|
||||
assign_from_gs_contractid(gs, NS_GET_IID(T));
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsGetServiceByContractIDWithError& gs )
|
||||
: NSCAP_CTOR_BASE(0)
|
||||
// construct from |do_GetService(contractid_expr, &rv)|
|
||||
{
|
||||
NSCAP_LOG_ASSIGNMENT(this, 0);
|
||||
assign_from_gs_contractid_with_error(gs, NS_GET_IID(T));
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsCOMPtr_helper& helper )
|
||||
: NSCAP_CTOR_BASE(0)
|
||||
// ...and finally, anything else we might need to construct from
|
||||
|
@ -635,6 +740,38 @@ class nsCOMPtr
|
|||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsGetServiceByCID rhs )
|
||||
// assign from |do_GetService(cid_expr)|
|
||||
{
|
||||
assign_from_gs_cid(rhs, NS_GET_IID(T));
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsGetServiceByCIDWithError& rhs )
|
||||
// assign from |do_GetService(cid_expr, &rv)|
|
||||
{
|
||||
assign_from_gs_cid_with_error(rhs, NS_GET_IID(T));
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsGetServiceByContractID rhs )
|
||||
// assign from |do_GetService(contractid_expr)|
|
||||
{
|
||||
assign_from_gs_contractid(rhs, NS_GET_IID(T));
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsGetServiceByContractIDWithError& rhs )
|
||||
// assign from |do_GetService(contractid_expr, &rv)|
|
||||
{
|
||||
assign_from_gs_contractid_with_error(rhs, NS_GET_IID(T));
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<T>&
|
||||
operator=( const nsCOMPtr_helper& rhs )
|
||||
// ...and finally, anything else we might need to assign from
|
||||
|
@ -837,6 +974,38 @@ class nsCOMPtr<nsISupports>
|
|||
assign_from_qi_with_error(qi, NS_GET_IID(nsISupports));
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsGetServiceByCID gs )
|
||||
: nsCOMPtr_base(0)
|
||||
// assign from |do_GetService(cid_expr)|
|
||||
{
|
||||
NSCAP_LOG_ASSIGNMENT(this, 0);
|
||||
assign_from_gs_cid(gs, NS_GET_IID(nsISupports));
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsGetServiceByCIDWithError& gs )
|
||||
: nsCOMPtr_base(0)
|
||||
// assign from |do_GetService(cid_expr, &rv)|
|
||||
{
|
||||
NSCAP_LOG_ASSIGNMENT(this, 0);
|
||||
assign_from_gs_cid_with_error(gs, NS_GET_IID(nsISupports));
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsGetServiceByContractID gs )
|
||||
: nsCOMPtr_base(0)
|
||||
// assign from |do_GetService(contractid_expr)|
|
||||
{
|
||||
NSCAP_LOG_ASSIGNMENT(this, 0);
|
||||
assign_from_gs_contractid(gs, NS_GET_IID(nsISupports));
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsGetServiceByContractIDWithError& gs )
|
||||
: nsCOMPtr_base(0)
|
||||
// assign from |do_GetService(contractid_expr, &rv)|
|
||||
{
|
||||
NSCAP_LOG_ASSIGNMENT(this, 0);
|
||||
assign_from_gs_contractid_with_error(gs, NS_GET_IID(nsISupports));
|
||||
}
|
||||
|
||||
nsCOMPtr( const nsCOMPtr_helper& helper )
|
||||
: nsCOMPtr_base(0)
|
||||
// ...and finally, anything else we might need to construct from
|
||||
|
@ -889,6 +1058,38 @@ class nsCOMPtr<nsISupports>
|
|||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports>&
|
||||
operator=( const nsGetServiceByCID rhs )
|
||||
// assign from |do_GetService(cid_expr)|
|
||||
{
|
||||
assign_from_gs_cid(rhs, NS_GET_IID(nsISupports));
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports>&
|
||||
operator=( const nsGetServiceByCIDWithError& rhs )
|
||||
// assign from |do_GetService(cid_expr, &rv)|
|
||||
{
|
||||
assign_from_gs_cid_with_error(rhs, NS_GET_IID(nsISupports));
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports>&
|
||||
operator=( const nsGetServiceByContractID rhs )
|
||||
// assign from |do_GetService(contractid_expr)|
|
||||
{
|
||||
assign_from_gs_contractid(rhs, NS_GET_IID(nsISupports));
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports>&
|
||||
operator=( const nsGetServiceByContractIDWithError& rhs )
|
||||
// assign from |do_GetService(contractid_expr, &rv)|
|
||||
{
|
||||
assign_from_gs_contractid_with_error(rhs, NS_GET_IID(nsISupports));
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports>&
|
||||
operator=( const nsCOMPtr_helper& rhs )
|
||||
// ...and finally, anything else we might need to assign from
|
||||
|
@ -1043,6 +1244,46 @@ nsCOMPtr<T>::assign_from_qi_with_error( const nsQueryInterfaceWithError& qi, con
|
|||
assign_assuming_AddRef(newRawPtr);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
nsCOMPtr<T>::assign_from_gs_cid( const nsGetServiceByCID gs, const nsIID& aIID )
|
||||
{
|
||||
T* newRawPtr;
|
||||
if ( NS_FAILED( gs(aIID, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
|
||||
newRawPtr = 0;
|
||||
assign_assuming_AddRef(newRawPtr);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
nsCOMPtr<T>::assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError& gs, const nsIID& aIID )
|
||||
{
|
||||
T* newRawPtr;
|
||||
if ( NS_FAILED( gs(aIID, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
|
||||
newRawPtr = 0;
|
||||
assign_assuming_AddRef(newRawPtr);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
nsCOMPtr<T>::assign_from_gs_contractid( const nsGetServiceByContractID gs, const nsIID& aIID )
|
||||
{
|
||||
T* newRawPtr;
|
||||
if ( NS_FAILED( gs(aIID, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
|
||||
newRawPtr = 0;
|
||||
assign_assuming_AddRef(newRawPtr);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
nsCOMPtr<T>::assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError& gs, const nsIID& aIID )
|
||||
{
|
||||
T* newRawPtr;
|
||||
if ( NS_FAILED( gs(aIID, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
|
||||
newRawPtr = 0;
|
||||
assign_assuming_AddRef(newRawPtr);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void
|
||||
nsCOMPtr<T>::assign_from_helper( const nsCOMPtr_helper& helper, const nsIID& aIID )
|
||||
|
|
|
@ -44,7 +44,55 @@
|
|||
#endif
|
||||
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#ifdef MOZILLA_STRICT_API
|
||||
|
||||
nsresult
|
||||
CallGetService(const nsCID &aCID, const nsIID &aIID, void **aResult)
|
||||
{
|
||||
nsCOMPtr<nsIServiceManager> servMgr;
|
||||
nsresult status = NS_GetServiceManager(getter_AddRefs(servMgr));
|
||||
if (servMgr)
|
||||
status = servMgr->GetService(aCID, aIID, aResult);
|
||||
return status;
|
||||
}
|
||||
|
||||
nsresult
|
||||
CallGetService(const char *aContractID, const nsIID &aIID, void **aResult)
|
||||
{
|
||||
nsCOMPtr<nsIServiceManager> servMgr;
|
||||
nsresult status = NS_GetServiceManager(getter_AddRefs(servMgr));
|
||||
if (servMgr)
|
||||
status = servMgr->GetServiceByContractID(aContractID, aIID, aResult);
|
||||
return status;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include "nsComponentManager.h"
|
||||
|
||||
nsresult
|
||||
CallGetService(const nsCID &aCID, const nsIID &aIID, void **aResult)
|
||||
{
|
||||
nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager;
|
||||
NS_ENSURE_TRUE(compMgr, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
return compMgr->nsComponentManagerImpl::GetService(aCID, aIID, aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
CallGetService(const char *aContractID, const nsIID &aIID, void **aResult)
|
||||
{
|
||||
nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager;
|
||||
NS_ENSURE_TRUE(compMgr, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
return compMgr->
|
||||
nsComponentManagerImpl::GetServiceByContractID(aContractID,
|
||||
aIID, aResult);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MOZILLA_STRICT_API
|
||||
|
||||
|
@ -203,20 +251,24 @@ nsGetClassObjectByContractID::operator()( const nsIID& aIID, void** aInstancePtr
|
|||
nsresult
|
||||
nsGetServiceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const
|
||||
{
|
||||
nsresult status = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIServiceManager> serviceManager =
|
||||
do_QueryInterface(mServiceManager);
|
||||
if ( serviceManager ) {
|
||||
status = serviceManager->GetService(mCID, aIID, (void**)aInstancePtr);
|
||||
} else {
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
if (mgr)
|
||||
status = mgr->GetService(mCID, aIID, (void**)aInstancePtr);
|
||||
}
|
||||
if ( NS_FAILED(status) )
|
||||
nsresult status = CallGetService(mCID, aIID, aInstancePtr);
|
||||
if ( NS_FAILED(status) ) {
|
||||
error:
|
||||
*aInstancePtr = 0;
|
||||
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGetServiceByCIDWithError::operator()( const nsIID& aIID, void** aInstancePtr ) const
|
||||
{
|
||||
nsresult status = CallGetService(mCID, aIID, aInstancePtr);
|
||||
if ( NS_FAILED(status) ) {
|
||||
error:
|
||||
*aInstancePtr = 0;
|
||||
}
|
||||
|
||||
if ( mErrorPtr )
|
||||
*mErrorPtr = status;
|
||||
return status;
|
||||
|
@ -225,20 +277,23 @@ nsGetServiceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const
|
|||
nsresult
|
||||
nsGetServiceByContractID::operator()( const nsIID& aIID, void** aInstancePtr ) const
|
||||
{
|
||||
nsresult status = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIServiceManager> serviceManager =
|
||||
do_QueryInterface(mServiceManager);
|
||||
if ( serviceManager ) {
|
||||
status = serviceManager->GetServiceByContractID(mContractID, aIID, (void**)aInstancePtr);
|
||||
} else {
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
if (mgr)
|
||||
status = mgr->GetServiceByContractID(mContractID, aIID, (void**)aInstancePtr);
|
||||
nsresult status = CallGetService(mContractID, aIID, aInstancePtr);
|
||||
if ( NS_FAILED(status) ) {
|
||||
error:
|
||||
*aInstancePtr = 0;
|
||||
}
|
||||
|
||||
if ( NS_FAILED(status) )
|
||||
return status;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGetServiceByContractIDWithError::operator()( const nsIID& aIID, void** aInstancePtr ) const
|
||||
{
|
||||
nsresult status = CallGetService(mContractID, aIID, aInstancePtr);
|
||||
if ( NS_FAILED(status) ) {
|
||||
error:
|
||||
*aInstancePtr = 0;
|
||||
}
|
||||
|
||||
if ( mErrorPtr )
|
||||
*mErrorPtr = status;
|
||||
|
|
|
@ -35,90 +35,48 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsIServiceManagerUtils_h__
|
||||
#define nsIServiceManagerUtils_h__
|
||||
#ifndef nsServiceManagerUtils_h__
|
||||
#define nsServiceManagerUtils_h__
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerObsolete.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Using servicemanager with COMPtrs
|
||||
class NS_COM nsGetServiceByCID : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
nsGetServiceByCID( const nsCID& aCID, nsISupports* aServiceManager, nsresult* aErrorPtr )
|
||||
: mCID(aCID),
|
||||
mServiceManager(aServiceManager),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
// nothing else to do
|
||||
}
|
||||
|
||||
virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const nsCID& mCID;
|
||||
nsISupports* mServiceManager;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
inline
|
||||
const nsGetServiceByCID
|
||||
do_GetService( const nsCID& aCID, nsresult* error = 0 )
|
||||
do_GetService(const nsCID& aCID)
|
||||
{
|
||||
return nsGetServiceByCID(aCID, 0, error);
|
||||
return nsGetServiceByCID(aCID);
|
||||
}
|
||||
|
||||
inline
|
||||
const nsGetServiceByCID
|
||||
do_GetService( const nsCID& aCID, nsISupports* aServiceManager, nsresult* error = 0 )
|
||||
const nsGetServiceByCIDWithError
|
||||
do_GetService(const nsCID& aCID, nsresult* error)
|
||||
{
|
||||
return nsGetServiceByCID(aCID, aServiceManager, error);
|
||||
}
|
||||
|
||||
class NS_COM nsGetServiceByContractID : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
nsGetServiceByContractID( const char* aContractID, nsISupports* aServiceManager, nsresult* aErrorPtr )
|
||||
: mContractID(aContractID),
|
||||
mServiceManager(aServiceManager),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
// nothing else to do
|
||||
}
|
||||
|
||||
virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
|
||||
|
||||
private:
|
||||
const char* mContractID;
|
||||
nsISupports* mServiceManager;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
inline
|
||||
const nsGetServiceByContractID
|
||||
do_GetService( const char* aContractID, nsresult* error = 0 )
|
||||
{
|
||||
return nsGetServiceByContractID(aContractID, 0, error);
|
||||
return nsGetServiceByCIDWithError(aCID, error);
|
||||
}
|
||||
|
||||
inline
|
||||
const nsGetServiceByContractID
|
||||
do_GetService( const char* aContractID, nsISupports* aServiceManager, nsresult* error = 0 )
|
||||
do_GetService(const char* aContractID)
|
||||
{
|
||||
return nsGetServiceByContractID(aContractID, aServiceManager, error);
|
||||
return nsGetServiceByContractID(aContractID);
|
||||
}
|
||||
|
||||
inline
|
||||
const nsGetServiceByContractIDWithError
|
||||
do_GetService( const char* aContractID, nsresult* error)
|
||||
{
|
||||
return nsGetServiceByContractIDWithError(aContractID, error);
|
||||
}
|
||||
|
||||
class nsGetServiceFromCategory : public nsCOMPtr_helper
|
||||
{
|
||||
public:
|
||||
nsGetServiceFromCategory(const char* aCategory, const char* aEntry,
|
||||
nsISupports* aServiceManager,
|
||||
nsresult* aErrorPtr)
|
||||
: mCategory(aCategory),
|
||||
mEntry(aEntry),
|
||||
mServiceManager(aServiceManager),
|
||||
mErrorPtr(aErrorPtr)
|
||||
{
|
||||
// nothing else to do
|
||||
|
@ -128,7 +86,6 @@ class nsGetServiceFromCategory : public nsCOMPtr_helper
|
|||
protected:
|
||||
const char* mCategory;
|
||||
const char* mEntry;
|
||||
nsISupports* mServiceManager;
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
|
@ -137,9 +94,15 @@ const nsGetServiceFromCategory
|
|||
do_GetServiceFromCategory( const char* category, const char* entry,
|
||||
nsresult* error = 0)
|
||||
{
|
||||
return nsGetServiceFromCategory(category, entry, 0, error);
|
||||
return nsGetServiceFromCategory(category, entry, error);
|
||||
}
|
||||
|
||||
NS_COM_GLUE nsresult
|
||||
CallGetService(const nsCID &aClass, const nsIID &aIID, void **aResult);
|
||||
|
||||
NS_COM_GLUE nsresult
|
||||
CallGetService(const char *aContractID, const nsIID &aIID, void **aResult);
|
||||
|
||||
// type-safe shortcuts for calling |GetService|
|
||||
template <class DestinationType>
|
||||
inline
|
||||
|
@ -149,15 +112,9 @@ CallGetService( const nsCID &aClass,
|
|||
{
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
nsresult rv = NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return mgr->GetService(aClass,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
return CallGetService(aClass,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
template <class DestinationType>
|
||||
|
@ -169,15 +126,9 @@ CallGetService( const char *aContractID,
|
|||
NS_PRECONDITION(aContractID, "null parameter");
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
nsCOMPtr<nsIServiceManager> mgr;
|
||||
nsresult rv = NS_GetServiceManager(getter_AddRefs(mgr));
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return mgr->GetServiceByContractID(aContractID,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
return CallGetService(aContractID,
|
||||
NS_GET_IID(DestinationType),
|
||||
NS_REINTERPRET_CAST(void**, aDestination));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,6 +54,7 @@ XPCOM_GLUE_SRC_LEXPORTS = \
|
|||
nsTraceRefcnt.h \
|
||||
nsWeakReference.h \
|
||||
nsComponentManagerUtils.h \
|
||||
nsServiceManagerUtils.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
|
|
@ -133,11 +133,11 @@ interface nsIFastLoadService : nsISupports
|
|||
# include "nsIServiceManager.h"
|
||||
#endif
|
||||
|
||||
inline const nsGetServiceByCID
|
||||
inline const nsGetServiceByCIDWithError
|
||||
do_GetFastLoadService(nsresult *aResultCode = 0)
|
||||
{
|
||||
static NS_DEFINE_CID(kFastLoadServiceCID, NS_FASTLOADSERVICE_CID);
|
||||
return nsGetServiceByCID(kFastLoadServiceCID, nsnull, aResultCode);
|
||||
return nsGetServiceByCIDWithError(kFastLoadServiceCID, aResultCode);
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
* Header Files *
|
||||
*******************************************************************************/
|
||||
#include "nscore.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -59,6 +59,7 @@ SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
|
|||
|
||||
LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) \
|
||||
$(XPCOM_LIBS) \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include "nsIComponentManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsICmdLineHandler.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsIComponentManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsICmdLineHandler.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче