forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make monochrome use the same copy of licenses as chrome
1. Compare chrome and webview licenses, and add the Chromium project license; 2. Get the Brotli decompression function and put it in component/about_ui/; 3. make monochrome call the function via JNI. Bug: 688077 Change-Id: I125dce46f85d3b268d9cee6d19249905f79f0209 Reviewed-on: https://chromium-review.googlesource.com/497870 Commit-Queue: Yipeng Wang <yipengw@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Kunihiko Sakamoto <ksakamoto@chromium.org> Reviewed-by: Yaron Friedman <yfriedman@chromium.org> Reviewed-by: Dan Beam <dbeam@chromium.org> Reviewed-by: Richard Coles <torne@chromium.org> Reviewed-by: Andrew Grieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#478052}
- Loading branch information
Yipeng Wang
authored and
Commit Bot
committed
Jun 8, 2017
1 parent
b5da597
commit 5671d4f
Showing
23 changed files
with
358 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2017 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. | ||
|
||
import("//build/config/android/rules.gni") | ||
|
||
# Since Monochrome has its own content provider, these two files are put | ||
# in two different targets. | ||
android_library("webview_license_provider_java") { | ||
java_files = [ "//android_webview/apk/java/src/com/android/webview/chromium/LicenseContentProvider.java" ] | ||
} | ||
|
||
android_library("webview_license_activity_java") { | ||
java_files = [ "//android_webview/apk/java/src/com/android/webview/chromium/LicenseActivity.java" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2017 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. | ||
|
||
import("//build/config/android/rules.gni") | ||
|
||
android_library("monochrome_license_provider_java") { | ||
java_files = | ||
[ "java/src/com/android/webview/chromium/LicenseContentProvider.java" ] | ||
|
||
deps = [ | ||
"//base:base_java", | ||
"//chrome/android:chrome_java", | ||
"//components/about_ui/android:aboutui_java", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include_rules = [ | ||
"+components/about_ui/android/java", | ||
] |
99 changes: 99 additions & 0 deletions
99
chrome/android/monochrome/java/src/com/android/webview/chromium/LicenseContentProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// Copyright 2015 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 com.android.webview.chromium; | ||
|
||
import android.annotation.TargetApi; | ||
import android.content.ContentProvider; | ||
import android.content.ContentValues; | ||
import android.database.Cursor; | ||
import android.net.Uri; | ||
import android.os.Build; | ||
import android.os.Bundle; | ||
import android.os.ParcelFileDescriptor; | ||
import android.util.Log; | ||
|
||
import org.chromium.base.ThreadUtils; | ||
import org.chromium.base.library_loader.ProcessInitException; | ||
import org.chromium.chrome.browser.init.ChromeBrowserInitializer; | ||
import org.chromium.components.aboutui.CreditUtils; | ||
|
||
import java.io.FileNotFoundException; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
|
||
/** | ||
* Content provider for the OSS licenses file. | ||
*/ | ||
@TargetApi(Build.VERSION_CODES.KITKAT) | ||
public class LicenseContentProvider | ||
extends ContentProvider implements ContentProvider.PipeDataWriter<String> { | ||
public static final String LICENSES_URI_SUFFIX = "LicenseContentProvider/webview_licenses"; | ||
public static final String LICENSES_CONTENT_TYPE = "text/html"; | ||
private static final String TAG = "LicenseCP"; | ||
|
||
@Override | ||
public boolean onCreate() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { | ||
if (uri != null && uri.toString().endsWith(LICENSES_URI_SUFFIX)) { | ||
return openPipeHelper(null, null, null, "webview_licenses.notice", this); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public void writeDataToPipe( | ||
ParcelFileDescriptor output, Uri uri, String mimeType, Bundle opts, String filename) { | ||
try (OutputStream out = new FileOutputStream(output.getFileDescriptor());) { | ||
ThreadUtils.runOnUiThreadBlocking(new Runnable() { | ||
@Override | ||
public void run() { | ||
try { | ||
ChromeBrowserInitializer.getInstance(getContext()) | ||
.handleSynchronousStartup(); | ||
} catch (ProcessInitException e) { | ||
Log.e(TAG, "Fail to initialize the Chrome Browser.", e); | ||
} | ||
} | ||
}); | ||
out.write(CreditUtils.nativeGetJavaWrapperCredits()); | ||
} catch (IOException e) { | ||
Log.e(TAG, "Failed to write the license file", e); | ||
} | ||
} | ||
|
||
@Override | ||
public String getType(Uri uri) { | ||
if (uri != null && uri.toString().endsWith(LICENSES_URI_SUFFIX)) { | ||
return LICENSES_CONTENT_TYPE; | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public int update(Uri uri, ContentValues values, String where, String[] whereArgs) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public int delete(Uri uri, String selection, String[] selectionArgs) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public Uri insert(Uri uri, ContentValues values) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, | ||
String sortOrder) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2017 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. | ||
|
||
static_library("about_ui") { | ||
sources = [ | ||
"credit_utils.cc", | ||
"credit_utils.h", | ||
] | ||
deps = [ | ||
"//base", | ||
"//components/resources:components_resources", | ||
"//third_party/brotli:dec", | ||
"//ui/base", | ||
"//ui/resources", | ||
] | ||
|
||
if (is_android) { | ||
deps += [ "//components/about_ui/android:about_ui_jni_headers" ] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include_rules = [ | ||
"+components/grit/components_resources.h", | ||
"+jni", | ||
"+third_party/brotli", | ||
"+ui/base", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2017 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. | ||
import("//build/config/android/rules.gni") | ||
|
||
generate_jni("about_ui_jni_headers") { | ||
sources = [ | ||
"java/src/org/chromium/components/aboutui/CreditUtils.java", | ||
] | ||
jni_package = "components/about_ui" | ||
} | ||
|
||
android_library("aboutui_java") { | ||
java_files = [ "java/src/org/chromium/components/aboutui/CreditUtils.java" ] | ||
deps = [ | ||
"//base:base_java", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
agrieve@chromium.org | ||
torne@chromium.org |
16 changes: 16 additions & 0 deletions
16
components/about_ui/android/java/src/org/chromium/components/aboutui/CreditUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2017 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.components.aboutui; | ||
|
||
import org.chromium.base.annotations.JNINamespace; | ||
|
||
/** Credits-related utilities. */ | ||
@JNINamespace("about_ui") | ||
public class CreditUtils { | ||
private CreditUtils() {} | ||
|
||
/** Returns a string containing the content of about_credits.html. */ | ||
public static native byte[] nativeGetJavaWrapperCredits(); | ||
} |
Oops, something went wrong.