Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More Cleanup, removed ChildBrowser as it is a plugin and not part of …

…the core
  • Loading branch information...
commit 08ad47781eb36e4ac8c9f9eb8b482ed8e3566084 1 parent 59c9544
@purplecabbage purplecabbage authored
View
198 framework/PhoneGap/Commands/ChildBrowserCommand.cs
@@ -1,198 +0,0 @@
-using System;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Shapes;
-using Microsoft.Phone.Controls;
-using System.Diagnostics;
-using System.Runtime.Serialization;
-using WP7GapClassLib.PhoneGap.UI;
-using Microsoft.Phone.Shell;
-
-namespace WP7GapClassLib.PhoneGap.Commands
-{
- [DataContract]
- public class BrowserOptions
- {
- [DataMember]
- public string url;
-
- [DataMember]
- public bool isGeolocationEnabled;
- }
-
- public class ChildBrowserCommand : BaseCommand
- {
-
- private static WebBrowser browser;
- private static ApplicationBarIconButton backButton;
- private static ApplicationBarIconButton fwdButton;
-
- // Display an inderminate progress indicator
- public void showWebPage(string options)
- {
- BrowserOptions opts = JSON.JsonHelper.Deserialize<BrowserOptions>(options);
-
- Uri loc = new Uri(opts.url);
-
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- if (browser != null)
- {
- browser.IsGeolocationEnabled = opts.isGeolocationEnabled;
- browser.Navigate(loc);
- }
- else
- {
- PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
- if (frame != null)
- {
- PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
- if (page != null)
- {
- Grid grid = page.FindName("LayoutRoot") as Grid;
- if (grid != null)
- {
- browser = new WebBrowser();
- browser.Navigate(loc);
-
- browser.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(browser_LoadCompleted);
-
- browser.Navigating += new EventHandler<NavigatingEventArgs>(browser_Navigating);
- browser.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(browser_NavigationFailed);
- browser.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(browser_Navigated);
- browser.IsScriptEnabled = true;
- browser.IsGeolocationEnabled = opts.isGeolocationEnabled;
- grid.Children.Add(browser);
- }
-
- ApplicationBar bar = new ApplicationBar();
- bar.BackgroundColor = Colors.Black;
- bar.IsMenuEnabled = false;
-
- backButton = new ApplicationBarIconButton();
- backButton.Text = "Back";
- backButton.IconUri = new Uri("/Images/appbar.back.rest.png", UriKind.Relative);
- backButton.Click += new EventHandler(backButton_Click);
- backButton.IsEnabled = false;
- bar.Buttons.Add(backButton);
-
-
- fwdButton = new ApplicationBarIconButton();
- fwdButton.Text = "Forward";
- fwdButton.IconUri = new Uri("/Images/appbar.next.rest.png", UriKind.Relative);
- fwdButton.Click += new EventHandler(fwdButton_Click);
- fwdButton.IsEnabled = false;
- bar.Buttons.Add(fwdButton);
-
- ApplicationBarIconButton closeBtn = new ApplicationBarIconButton();
- closeBtn.Text = "Close";
- closeBtn.IconUri = new Uri("/Images/appbar.close.rest.png", UriKind.Relative);
- closeBtn.Click += new EventHandler(closeBtn_Click);
- bar.Buttons.Add(closeBtn);
-
- page.ApplicationBar = bar;
- }
-
- }
- }
- });
- }
-
- void browser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
- {
-
- }
-
- void fwdButton_Click(object sender, EventArgs e)
- {
- if (browser != null)
- {
- try
- {
- browser.InvokeScript("execScript", "history.forward();");
- }
- catch(Exception)
- {
-
- }
- }
- }
-
- void backButton_Click(object sender, EventArgs e)
- {
- if (browser != null)
- {
- try
- {
- browser.InvokeScript("execScript", "history.back();");
- }
- catch (Exception)
- {
-
- }
- }
- }
-
- void closeBtn_Click(object sender, EventArgs e)
- {
- this.close();
- }
-
-
- public void close(string options="")
- {
- if (browser != null)
- {
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
- if (frame != null)
- {
- PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
- if (page != null)
- {
- Grid grid = page.FindName("LayoutRoot") as Grid;
- if (grid != null)
- {
- grid.Children.Remove(browser);
- }
- page.ApplicationBar = null;
- }
- }
- browser = null;
- });
- }
- }
-
- void browser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
- {
- string message = "{type:\"locationChanged\",location:\"" + e.Uri.AbsoluteUri + "\"}";
- PluginResult result = new PluginResult(PluginResult.Status.OK, message);
- result.KeepCallback = true;
- this.DispatchCommandResult(result);
- }
-
- void browser_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e)
- {
- string message = "{type:\"navigationError\",location:\"" + e.Uri.AbsoluteUri + "\"}";
- PluginResult result = new PluginResult(PluginResult.Status.ERROR, message);
- result.KeepCallback = true;
- this.DispatchCommandResult(result);
- }
-
- void browser_Navigating(object sender, NavigatingEventArgs e)
- {
- string message = "{type:\"locationAboutToChange\",location:\"" + e.Uri.AbsoluteUri + "\"}";
- PluginResult result = new PluginResult(PluginResult.Status.OK, message);
- result.KeepCallback = true;
- this.DispatchCommandResult(result);
- }
-
- }
-}
View
20 tests/BatchSubstitute.bat
@@ -1,20 +0,0 @@
-@echo off
-REM -- Prepare the Command Processor --
-SETLOCAL ENABLEEXTENSIONS
-SETLOCAL DISABLEDELAYEDEXPANSION
-
-::BatchSubstitude - parses a File line by line and replaces a substring"
-::syntax: BatchSubstitude.bat OldStr NewStr File
-:: OldStr [in] - string to be replaced
-:: NewStr [in] - string to replace with
-:: File [in] - file to be parsed
-:$changed 20100115
-:$source http://www.dostips.com
-if "%~1"=="" findstr "^::" "%~f0"&GOTO:EOF
-for /f "tokens=1,* delims=]" %%A in ('"type %3|find /n /v """') do (
- set "line=%%B"
- if defined line (
- call set "line=echo.%%line:%~1=%~2%%"
- for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X
- ) ELSE echo.
-)
View
10 tests/FileNameParser.bat
@@ -1,10 +0,0 @@
-::set "dirpath=c:\Users\herm\Documents\hermwong\phonegap-wp7\tests\MobileSpecUnitTests\"
-
-set dirpath=%CD%"\MobileSpecUnitTests\"
-
-dir /s /b %dirpath%www\*.* > temp.txt
-
-:: remove local path
-BatchSubstitute.bat %dirpath% "" temp.txt > filelist.txt
-
-:: temp.txt is re-used by the xml.js to store the xml nodes
View
90 tests/MobileSpecUnitTests/www/ChildBrowser.js
@@ -1,90 +0,0 @@
-/* MIT licensed */
-// (c) 2010 Jesse MacFadyen, Nitobi
-
-/*global PhoneGap */
-
-function ChildBrowser() {
- // Does nothing
-}
-
-// Callback when the location of the page changes
-// called from native
-ChildBrowser._onLocationChange = function(newLoc)
-{
- window.plugins.childBrowser.onLocationChange(newLoc);
-};
-
-// Callback when the user chooses the 'Done' button
-// called from native
-ChildBrowser._onClose = function()
-{
- window.plugins.childBrowser.onClose();
-};
-
-// Callback when the user chooses the 'open in Safari' button
-// called from native
-ChildBrowser._onOpenExternal = function()
-{
- window.plugins.childBrowser.onOpenExternal();
-};
-
-// Pages loaded into the ChildBrowser can execute callback scripts, so be careful to
-// check location, and make sure it is a location you trust.
-// Warning ... don't exec arbitrary code, it's risky and could fuck up your app.
-// called from native
-ChildBrowser._onJSCallback = function(js,loc)
-{
- // Not Implemented
- //window.plugins.childBrowser.onJSCallback(js,loc);
-};
-
-/* The interface that you will use to access functionality */
-
-// Show a webpage, will result in a callback to onLocationChange
-ChildBrowser.prototype.showWebPage = function(loc,geolocationEnabled)
-{
- var success = function(msg)
- {
- console.log("ChildBrowser.showWebPage success :: " + msg);
- };
-
- var error = function(e)
- {
- console.log("ChildBrowser.showWebPage error :: " + e);
- };
-
- var options =
- {
- url:loc,
- geolocationEnabled:(geolocationEnabled == true)
-
- };
-
- PhoneGap.exec(success,error,"ChildBrowserCommand","showWebPage", options);
- //setTimeout(this.close,5000);
-};
-
-// close the browser, will NOT result in close callback
-ChildBrowser.prototype.close = function()
-{
- PhoneGap.exec(null,null,"ChildBrowserCommand","close");
-};
-
-// Not Implemented
-ChildBrowser.prototype.jsExec = function(jsString)
-{
- // Not Implemented!!
- //PhoneGap.exec("ChildBrowserCommand.jsExec",jsString);
-};
-
-// Note: this plugin does NOT install itself, call this method some time after deviceready to install it
-// it will be returned, and also available globally from window.plugins.childBrowser
-ChildBrowser.install = function()
-{
- if(!window.plugins) {
- window.plugins = {};
- }
-
- window.plugins.childBrowser = new ChildBrowser();
- return window.plugins.childBrowser;
-};
View
111 tests/MobileSpecUnitTests/www/childBrowser.html
@@ -1,111 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <!-- meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=2.0, maximum-scale=4.0, minimum-scale=1.0" / -->
-
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
-
- <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
-
- <title>PhoneGap - ChildBrowser</title>
- <link rel="stylesheet" href="master.css" type="text/css" media="screen"/>
-
- <script type="text/javascript">
- // provide our own console if it does not exist, huge dev aid!
- if(typeof window.console == "undefined")
- {
- window.console = {log:function(str){window.external.Notify(str);}};
- }
-
- // output any errors to console log, created above.
- window.onerror=function(e)
- {
- console.log("window.onerror ::" + JSON.stringify(e));
- };
-
- console.log("Installed console ! ");
- </script>
-
-
- <script type="text/javascript" charset="utf-8" src="phonegap-1.1.0.js"></script>
- <script type="text/javascript" charset="utf-8" src="ChildBrowser.js"></script>
-
-<script type="text/javascript" charset="utf-8">
-
- var childBrowser;
-
- function onDeviceReady(e)
- {
- childBrowser = ChildBrowser.install();
-
- }
-
- function openAppHub()
- {
- if(childBrowser != null)
- {
- childBrowser.onLocationChange = function(loc){locChanged(loc); };
- childBrowser.onClose = function(){onCloseBrowser()};
- childBrowser.onOpenExternal = function(){onOpenExternal();};
- childBrowser.showWebPage("http://create.msdn.com");
-
- }
- }
-
- function onCloseBrowser()
- {
- console.log("onCloseBrowser");
- }
-
- function locChanged(loc)
- {
- console.log("locChanged = " + loc);
- }
-
- function onOpenExternal()
- {
- console.log("onOpenExternal In index.html onOpenExternal");
- }
-
- function loadFacebook()
- {
- var client_id = "91320880376";
- var redir_url = "http://www.facebook.com/connect/login_success.html";
-
- // var authorize_url = "https://graph.facebook.com/oauth/authorize?";
- // authorize_url += "client_id=" + client_id;
- // authorize_url += "&redirect_uri=" + redir_url;
- // authorize_url += "&display="+ "touch";
- // authorize_url += "&type=user_agent";
-
- // var test = "http://m.facebook.com/login.php?app_id=91320880376&cancel=http%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html%3Ferror_reason%3Duser_denied%26error%3Daccess_denied%26error_description%3DThe%2Buser%2Bdenied%2Byour%2Brequest.&fbconnect=1&next=https%3A%2F%2Fwww.facebook.com%2Fdialog%2Fpermissions.request%3F_path%3Dpermissions.request%26app_id%3D91320880376%26redirect_uri%3Dhttp%253A%252F%252Fwww.facebook.com%252Fconnect%252Flogin_success.html%26display%3Dtouch%26type%3Duser_agent%26fbconnect%3D1%26from_login%3D1&rcount=1&_rdr";
-
- var test2 = "https://www.facebook.com/dialog/oauth?client_id=91320880376&redirect_uri=http://www.facebook.com/connect/login_success.html";
-
- window.plugins.childBrowser.showWebPage(test2);
- }
-
-
-
- /**
- * Function called when page has finished loading.
- */
- function init()
- {
- document.addEventListener("deviceready",onDeviceReady, false);
- }
-
-</script>
-
-
- </head>
-
- <body onLoad="init();" id="stage" class="theme">
-
- <div class="btn large" onclick="openAppHub();">Open AppHub</div>
-
- <div class="btn large" onclick="loadFacebook();">Open Facebook</div>
-
- <a href="index.html" class="backBtn">Back</a>
- </body>
-</html>
View
1  tests/MobileSpecUnitTests/www/index.html
@@ -91,7 +91,6 @@
<a href="accelerometer2.html" class="btn large">Accel Game</a>
<a href="audio.html" class="btn large">Audio Play/Record</a>
<a href="camera.html" class="btn large">Camera</a>
- <a href="childBrowser.html" class="btn large">Child Browser</a>
<a href="capture.html" class="btn large">Capture</a>
<a href="compass.html" class="btn large">Compass</a>
<a href="network.html" class="btn large">Connection</a>
View
59 tests/xml.js
@@ -1,59 +0,0 @@
-var strLine = "";
-
-var objFS = new ActiveXObject("Scripting.FileSystemObject");
-
-var DIR_PATH = objFS.GetAbsolutePathName("") + "\\";
-var PATH = DIR_PATH + "MobileSpecUnitTests\\";
-
-var objInputFile = objFS.OpenTextFile(DIR_PATH + "filelist.txt");
-var objOutputFile = objFS.CreateTextFile(DIR_PATH + "temp.txt", true);
-
-while (!objInputFile.AtEndOfStream)
-{
- strLine = objInputFile.ReadLine();
- strLine = strLine.replace(PATH, "");
- strLine = strLine.replace(/\\/gi, "/");
-
- objOutputFile.WriteLine("<FilePath Value=\"" + strLine + "\"/>");
-}
-
-objOutputFile.Close();
-objInputFile.Close();
-
-objFS.DeleteFile(DIR_PATH + "filelist.txt");
-
-objOutputFile = null;
-objInputFile = null;
-
-var objXmlNodeFile = objFS.OpenTextFile(DIR_PATH + "temp.txt");
-var objResourceFile = objFS.CreateTextFile(PATH + "GapSourceDictionary.xml", true);
-
-objResourceFile.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
-objResourceFile.WriteLine("<GapSourceDictionary>");
-objResourceFile.WriteLine("<FilePath Value=\"www/index.html\"/>");
-objResourceFile.WriteLine("<FilePath Value=\"www/master.css\"/>");
-objResourceFile.WriteLine("<FilePath Value=\"www/main.js\"/>");
-
-while (!objXmlNodeFile.AtEndOfStream)
-{
- strLine = objXmlNodeFile.ReadLine();
-
- if (strLine.indexOf(".") > 0)
- {
- objResourceFile.WriteLine(strLine);
- }
-}
-
-objResourceFile.WriteLine("</GapSourceDictionary>");
-
-objXmlNodeFile.Close();
-objResourceFile.Close();
-
-objFS.DeleteFile(DIR_PATH + "temp.txt");
-
-
-objXmlNodeFile = null;
-objResourceFile = null;
-
-objFS = null;
-
Please sign in to comment.
Something went wrong with that request. Please try again.