rendered paste bodyIndex: src/downloader.cpp
===================================================================
--- src/downloader.cpp (revision 131791)
+++ src/downloader.cpp (working copy)
@@ -367,7 +367,7 @@
if (!url->isAbsolute) {
const char *source_location = NULL;
- source_location = GetSurface ()->GetXapLocation ();
+ source_location = GetDeployment ()->GetXapLocation ();
if (source_location) {
if (!url->Parse (source_location))
return;
@@ -377,7 +377,7 @@
//FIXME: ONLY VALIDATE IF USED FROM THE PLUGIN
char *location;
- (location = g_strdup(GetSurface ()->GetXapLocation ())) || (location = g_strdup(GetSurface ()->GetSourceLocation ()));
+ (location = g_strdup(GetDeployment ()->GetXapLocation ())) || (location = g_strdup(GetSurface ()->GetSourceLocation ()));
if (!validate_policy (location, url, policy)) {
LOG_DOWNLOADER ("aborting due to security policy violation\n");
failed_msg = g_strdup ("Security Policy Violation");
Index: src/deployment.h
===================================================================
--- src/deployment.h (revision 131791)
+++ src/deployment.h (working copy)
@@ -95,6 +95,13 @@
void TrackObjectCreated (EventObject *obj);
void TrackObjectDestroyed (EventObject *obj);
+ bool IsLoadedFromXap ();
+ /* @GenerateCBinding,GeneratePInvoke */
+ void SetIsLoadedFromXap (bool flag);
+
+ void SetXapLocation (const char *location);
+ const char *GetXapLocation ();
+
const static int ShuttingDownEvent;
protected:
@@ -113,6 +120,9 @@
MonoDomain *domain;
List *downloaders;
+ bool is_loaded_from_xap;
+ char *xap_location;
+
#if GLIB_CHECK_VERSION(2,10,0)
volatile gpointer pending_unrefs;
#else
Index: src/deployment.cpp
===================================================================
--- src/deployment.cpp (revision 131791)
+++ src/deployment.cpp (working copy)
@@ -243,6 +243,8 @@
void
Deployment::InnerConstructor ()
{
+ is_loaded_from_xap = false;
+ xap_location = NULL;
current_app = NULL;
pending_unrefs = NULL;
objects_created = 0;
@@ -294,6 +296,8 @@
Deployment::~Deployment()
{
+ g_free (xap_location);
+
pthread_mutex_lock (&hash_mutex);
g_hash_table_remove (current_hash, domain);
pthread_mutex_unlock (&hash_mutex);
@@ -545,6 +549,31 @@
#endif
}
+bool
+Deployment::IsLoadedFromXap ()
+{
+ return is_loaded_from_xap;
+}
+
+void
+Deployment::SetIsLoadedFromXap (bool flag)
+{
+ is_loaded_from_xap = flag;
+}
+
+void
+Deployment::SetXapLocation (const char *location)
+{
+ g_free (xap_location);
+ xap_location = g_strdup (location);
+}
+
+const char*
+Deployment::GetXapLocation ()
+{
+ return xap_location;
+}
+
/*
* AssemblyPart
*/
Index: src/runtime.h
===================================================================
--- src/runtime.h (revision 131791)
+++ src/runtime.h (working copy)
@@ -213,9 +213,6 @@
void SetSourceLocation (const char *location);
bool FullScreenKeyHandled (GdkEventKey *key);
- const char* GetXapLocation ();
- void SetXapLocation (const char *location);
-
/* @GenerateCBinding,GeneratePInvoke */
TimeManager *GetTimeManager () { return time_manager; }
Index: src/runtime.cpp
===================================================================
--- src/runtime.cpp (revision 131791)
+++ src/runtime.cpp (working copy)
@@ -760,19 +760,6 @@
source_location = g_strdup (location);
}
-const char*
-Surface::GetXapLocation ()
-{
- return xap_location;
-}
-
-void
-Surface::SetXapLocation (const char* location)
-{
- g_free (xap_location);
- xap_location = g_strdup (location);
-}
-
void
Surface::HideFullScreenMessage ()
{
Index: plugin/plugin.h
===================================================================
--- plugin/plugin.h (revision 131791)
+++ plugin/plugin.h (working copy)
@@ -203,8 +203,6 @@
PluginXamlLoader *xaml_loader;
Deployment *deployment;
#if PLUGIN_SL_2_0
- bool xap_loaded;
-
MonoAssembly *system_windows_assembly;
static bool mono_is_loaded;
Index: plugin/plugin.cpp
===================================================================
--- plugin/plugin.cpp (revision 131791)
+++ plugin/plugin.cpp (working copy)
@@ -402,8 +402,6 @@
vm_missing_file = NULL;
xaml_loader = NULL;
#if PLUGIN_SL_2_0
- xap_loaded = false;
-
system_windows_assembly = NULL;
moon_load_xaml =
@@ -1145,23 +1143,19 @@
return;
}
- if (surface)
- surface->SetXapLocation (url);
-
if (source_location)
g_free (source_location);
source_location = g_strdup (url);
ManagedInitializeDeployment (fname);
- xap_loaded = true;
+ GetDeployment()->SetXapLocation (url);
}
void
PluginInstance::DestroyApplication ()
{
- if (xap_loaded)
+ if (GetDeployment()->IsLoadedFromXap())
ManagedDestroyApplication ();
- xap_loaded = false;
}
#endif
Index: class/System.Windows/System.Windows/Deployment.cs
===================================================================
--- class/System.Windows/System.Windows/Deployment.cs (revision 131791)
+++ class/System.Windows/System.Windows/Deployment.cs (working copy)
@@ -160,6 +160,7 @@
if (!ReadManifest ())
return false;
+ NativeMethods.deployment_set_is_loaded_from_xap (native, true);
return LoadAssemblies ();
}