Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / TrustUi / MS / Internal / documents / Application / NavigationHelper.cs / 1 / NavigationHelper.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description:
// NavigationHelper is an internal utility class for Mongoose to deal
// with Uri navigations.
//
// History:
// 11/10/05 - [....] created
//
//---------------------------------------------------------------------------
using System;
using System.Security;
using System.Windows.Interop;
using System.Windows.TrustUI;
using MS.Internal;
using MS.Internal.PresentationUI;
namespace MS.Internal.Documents.Application
{
///
/// Helper class for handling browser navigations.
///
internal static class NavigationHelper
{
/////
///// Invokes a navigation to a new document
/////
///
/// Critical:
/// - uses delegate from framework
/// - uses Document.Uri
///
[SecurityCritical]
internal static void NavigateToDocument(Document document)
{
Trace.SafeWrite(
Trace.File,
"Attempting to navigate to new document {0}.",
document.Uri);
Invariant.Assert(
_navigate != null,
"Navigation object has not been instantiated.");
Invariant.Assert(
_navigate.Value != null,
"Navigation delegate has not been assigned.");
Invariant.Assert(
document != null,
"Target document has not been assigned.");
_navigate.Value(new SecurityCriticalData(document.Uri));
}
/////
///// Invokes a top-level browserNavigation action to the specified Uri.
/////
/////
///// Critical:
///// - causes a navigation action to occur to an external uri
///// - passes the Uri to another method
/////
[SecurityCritical]
internal static void NavigateToExternalUri(Uri uri)
{
Trace.SafeWrite(
Trace.File,
"Attempting to navigate to external Uri {0}.",
uri);
Invariant.Assert(
_navigate != null,
"Navigation object has not been instantiated.");
Invariant.Assert(
_navigate.Value != null,
"Navigation delegate has not been assigned.");
Invariant.Assert(
uri != null,
"Target uri has not been assigned.");
_navigate.Value(new SecurityCriticalData(uri));
}
///
/// A delegate that will navigate the root browser window.
///
///
/// Critical:
/// - sets _navigate which should only be BrowserInteropHelper.Navigate
///
///
/// If we are going to add more functionality a IBrowserService interface
/// of some type should be defined and set vs many delegates.
///
[FriendAccessAllowed]
internal static NavigateDelegate Navigate
{
[SecurityCritical]
get
{
if (_navigate != null)
{
return _navigate.Value;
}
return null;
}
[SecurityCritical]
set
{
_navigate = new SecurityCriticalDataClass(value);
}
}
internal delegate void NavigateDelegate(SecurityCriticalData uri);
private static SecurityCriticalDataClass _navigate;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- X509Certificate2.cs
- Opcode.cs
- PreProcessInputEventArgs.cs
- DataList.cs
- ProfileEventArgs.cs
- basecomparevalidator.cs
- TempEnvironment.cs
- PropertyGridView.cs
- BaseProcessProtocolHandler.cs
- SrgsSubset.cs
- SpecialTypeDataContract.cs
- MenuItemBindingCollection.cs
- Bold.cs
- InvalidOleVariantTypeException.cs
- WindowsMenu.cs
- Group.cs
- Themes.cs
- CodeArrayIndexerExpression.cs
- SqlDataSourceQueryEditor.cs
- IsolatedStorage.cs
- ValidationRuleCollection.cs
- ImportContext.cs
- RoleManagerEventArgs.cs
- ContextMenu.cs
- SetterBaseCollection.cs
- WebPartUtil.cs
- HyperLinkStyle.cs
- CompilerWrapper.cs
- XmlSchemaFacet.cs
- WindowsAltTab.cs
- UpWmlPageAdapter.cs
- _ListenerAsyncResult.cs
- ImageListUtils.cs
- TextSimpleMarkerProperties.cs
- TypeElementCollection.cs
- PageAdapter.cs
- DashStyle.cs
- DataBinder.cs
- COM2PropertyDescriptor.cs
- httpapplicationstate.cs
- SimpleExpression.cs
- CryptoKeySecurity.cs
- Application.cs
- DbSetClause.cs
- PropertyTab.cs
- Rotation3DAnimation.cs
- TimelineGroup.cs
- ProcessHostFactoryHelper.cs
- TextEffect.cs
- PersistChildrenAttribute.cs
- SqlCacheDependencySection.cs
- DelegatingHeader.cs
- HttpModuleCollection.cs
- EventHandlersStore.cs
- TextEndOfParagraph.cs
- ItemCheckedEvent.cs
- ActivityMarkupSerializer.cs
- ParseHttpDate.cs
- TypeUnloadedException.cs
- MetadataPropertyAttribute.cs
- ColorTransform.cs
- ControlBuilder.cs
- ImageMapEventArgs.cs
- initElementDictionary.cs
- UdpDiscoveryEndpointProvider.cs
- EntitySetBase.cs
- HtmlButton.cs
- BrowserDefinitionCollection.cs
- GestureRecognizer.cs
- ApplicationActivator.cs
- SafeHandles.cs
- RuntimeEnvironment.cs
- CodeTypeOfExpression.cs
- LayoutEditorPart.cs
- ADRoleFactoryConfiguration.cs
- PhysicalAddress.cs
- SqlDependencyUtils.cs
- Rules.cs
- ModelPropertyDescriptor.cs
- FaultContractInfo.cs
- CodeTypeDelegate.cs
- IxmlLineInfo.cs
- QuaternionRotation3D.cs
- CanExecuteRoutedEventArgs.cs
- _MultipleConnectAsync.cs
- DesignerLoader.cs
- XmlEventCache.cs
- SettingsPropertyNotFoundException.cs
- SoapRpcMethodAttribute.cs
- BeginEvent.cs
- ExpressionTextBox.xaml.cs
- XmlNamespaceMapping.cs
- BamlVersionHeader.cs
- XXXOnTypeBuilderInstantiation.cs
- CheckBox.cs
- TitleStyle.cs
- XmlIlGenerator.cs
- ProgramNode.cs
- Stream.cs
- MailDefinition.cs