Skip to content

Commit

Permalink
add support for Android WebView APK
Browse files Browse the repository at this point in the history
  • Loading branch information
davisford committed Nov 11, 2013
1 parent 49504ef commit a760a09
Show file tree
Hide file tree
Showing 77 changed files with 9,099 additions and 250 deletions.
2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion android-chromium.iml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ configure(subprojects.findAll { project ->
// configure android apk projects
configure(subprojects.findAll { project ->
['content-shell',
'android-webview',
'testshell'].contains(project.name) }) {
apply plugin: 'android'
// the rest is boilerplate
Expand Down
27 changes: 27 additions & 0 deletions chromium/android-webview/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
79 changes: 79 additions & 0 deletions chromium/android-webview/android-webview.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="Debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebug" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":chromium:android-webview" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/r/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/aidl/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/rs/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/res/rs/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/assets" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/res" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/resources" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/apk" />
<excludeFolder url="file://$MODULE_DIR$/build/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 18 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="content" exported="" />
<orderEntry type="library" exported="" name="support-v4-18.0.0" level="project" />
<orderEntry type="module" module-name="components" exported="" />
<orderEntry type="library" exported="" name="guava-1.0" level="project" />
<orderEntry type="library" exported="" name="jsr305-1.0" level="project" />
</component>
</module>

15 changes: 15 additions & 0 deletions chromium/android-webview/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

// android-webview/build.gradle

// this is an Android application that builds the Chromium AndroidWebview apk

dependencies {
compile fileTree(dir: "${buildDir}/native/", include: "*.jar")
compile project(':chromium:content')
compile project(':chromium:components')
compile project(':chromium:media')
}

tasks.withType(Compile) {
compileTask -> compileTask.dependsOn(copyNativeLibsToJar)
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.android_webview.shell;

import android.app.Application;
import android.os.Debug;
import android.util.Log;

import org.chromium.android_webview.AwBrowserProcess;
import org.chromium.content.app.LibraryLoader;
import org.chromium.content.browser.ResourceExtractor;
import org.chromium.content.common.CommandLine;

public class AwShellApplication extends Application {

private static final String TAG = "AwShellApplication";
/** The minimum set of .pak files the test runner needs. */
private static final String[] MANDATORY_PAKS = {
"webviewchromium.pak", "en-US.pak"
};
private static final String[] LIBRARIES = { "standalonelibwebviewchromium" };

@Override
public void onCreate() {
super.onCreate();

AwShellResourceProvider.registerResources(this);

CommandLine.initFromFile("/data/local/tmp/android-webview-command-line");

if (CommandLine.getInstance().hasSwitch(CommandLine.WAIT_FOR_JAVA_DEBUGGER)) {
Log.e(TAG, "Waiting for Java debugger to connect...");
Debug.waitForDebugger();
Log.e(TAG, "Java debugger connected. Resuming execution.");
}

ResourceExtractor.setMandatoryPaksToExtract(MANDATORY_PAKS);
ResourceExtractor.setExtractImplicitLocaleForTesting(false);
LibraryLoader.setLibraryToLoad(LIBRARIES);
AwBrowserProcess.loadLibrary();
AwBrowserProcess.start(this);
}
}
38 changes: 38 additions & 0 deletions chromium/android-webview/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- Copyright 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.chromium.android_webview.shell">

<application android:name="org.chromium.android_webview.shell.AwShellApplication"
android:label="AwShellApplication" android:hardwareAccelerated="false">
<activity android:name="org.chromium.android_webview.shell.AwShellActivity"
android:label="Android WebView Test Shell">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="org.chromium.android_webview.test.AwTestRunnerActivity"
android:label="AwTestRunnerActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
</intent-filter>
</activity>
<provider android:name="org.chromium.android_webview.test.TestContentProvider"
android:authorities="org.chromium.android_webview.test.TestContentProvider" />
</application>

<!-- TODO(joth): Change minSdkVersion to 16 when crbug/161864 lands. -->
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
8 changes: 8 additions & 0 deletions chromium/android-webview/src/main/assets/asset_file.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<head>
<title>Asset File</title>
</head>
<body>
This is an asset file.
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<html>
<head>
<script>
function goFullscreen(id) {
var element = document.getElementById(id);
if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}

addEventListener('Loaded', function() {
document.getElementById('video').addEventListener('play', function() {
console.log('Video Played');
}, false);
}, false);
</script>
</head>
<body>
</script></head><body>
<button autofocus style ='padding:1024px 1024px;' onclick="goFullscreen('video'); return false">Big enough you can't miss it</button>
<p></p>
<video style = 'width: 10px; height: 10px;' id='video' controls>
<source id="webm" src="VIDEO_FILE_URL" type="video/webm">
</video>
</body>
</html>
Binary file not shown.
Loading

0 comments on commit a760a09

Please sign in to comment.