0

[remoting android] Generate trimmed-down credits.html.

This copies resources to a central location, so that the Android build
is independent of anything under remoting/webapp.

This provides GN options to tools/licenses.py to only list third-party
projects that are included in the app (currently the "remoting_apk"
target, but followup work will enable us to specify the actual target
for Official builds).

Also stripped out CSS rules that were only meaningful for the webapp.

BUG=697128,178215

Review-Url: https://codereview.chromium.org/2728913002
Cr-Commit-Position: refs/heads/master@{#454936}
This commit is contained in:
lambroslambrou
2017-03-06 12:22:06 -08:00
committed by Commit bot
parent 58f544ff4a
commit aeec4d330e
5 changed files with 158 additions and 5 deletions

@ -64,21 +64,49 @@ shared_library("remoting_client_jni") {
assert_no_deps = [ "//third_party/ffmpeg:*" ]
}
action("credits") {
credits_html_file = "$target_gen_dir/credits.html"
script = "//tools/licenses.py"
depfile = "$target_gen_dir/$target_name.d"
credits_template = "//remoting/credits/credits.tmpl"
credits_entry_template = "//remoting/credits/credits_entry.tmpl"
inputs = [
credits_template,
credits_entry_template,
]
outputs = [
credits_html_file,
]
args = [
"credits",
rebase_path(credits_html_file, root_build_dir),
"--file-template",
rebase_path(credits_template, root_build_dir),
"--entry-template",
rebase_path(credits_entry_template, root_build_dir),
"--depfile",
rebase_path(depfile, root_build_dir),
"--gn-target",
"//remoting/android:remoting_apk",
"--gn-out-dir",
rebase_path(root_build_dir),
]
}
_raw_resources_base_dir = "$target_gen_dir/remoting_android_raw_resources/res"
copy("remoting_android_raw_resources") {
_credits_html = get_label_info("//remoting/webapp:credits",
_credits_html = get_label_info("//remoting/android:credits",
"target_gen_dir") + "/credits.html"
sources = [
"//remoting/webapp/base/html/credits_css.css",
"//remoting/webapp/base/html/main.css",
"//remoting/webapp/base/js/credits_js.js",
"//remoting/credits/credits_css.css",
"//remoting/credits/credits_js.js",
_credits_html,
]
outputs = [
"$_raw_resources_base_dir/raw/{{source_file_part}}",
]
deps = [
"//remoting/webapp:credits",
":credits",
]
}

@ -0,0 +1,18 @@
<!doctype html>
<html class="full-height">
<head>
<meta charset="utf-8">
<title>Credits</title>
<!-- The CSS and JS files are named this way so they can be used as
Android resources, which requires the filenames without the
extensions to be distinct. -->
<link rel="stylesheet" href="credits_css.css">
<script src="credits_js.js"></script>
</head>
<body class="full-height">
<div class="entries">
<div class="page-title">Credits</div>
{{entries}}
</div>
</body>
</html>

@ -0,0 +1,75 @@
/* 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.
*/
body {
font-family: "Arial", "Helvetica", sans-serif;
color: #222;
font-size: 13px;
margin: 0;
direction: __MSG_@@bidi_dir__;
overflow: auto;
}
a {
text-decoration: none;
color: #15c;
cursor: pointer;
}
a:active {
color: #d14836;
}
body.show-only-selected .product:not(.selected) {
display: none;
}
.page-title {
font-size: 164%;
font-weight: bold;
}
.entries {
margin: 8px;
}
.product {
background-color: #c3d9ff;
border-radius: 5px;
margin-top: 16px;
overflow: auto;
padding: 2px;
}
.product .title {
float: left;
font-size: 110%;
font-weight: bold;
margin: 3px;
}
.right-align {
float: right;
margin: 3px 6px;
}
.licence {
background-color: #e8eef7;
border-radius: 3px;
clear: both;
padding: 16px;
}
.product:not(.selected) .licence {
display: none;
}
.licence h3 {
margin-top: 0;
}
.licence pre {
white-space: pre-wrap;
}

@ -0,0 +1,12 @@
<div class="product">
<span class="title">{{name}}</span>
<span class="right-align">
<span class="homepage"><a href="{{url}}" target="_blank">homepage</a></span>
-
<a class="toggle-licence" href="#">show license</a>
</span>
<div class="licence">
<pre>{{license}}</pre>
</div>
</div>

@ -0,0 +1,20 @@
// 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.
(function() {
'use strict';
/** @param {Event} event */
function onClick(event) {
var element = /** @type {HTMLElement} */ (event.target);
if (element.classList.contains('toggle-licence')) {
element.parentElement.parentElement.classList.toggle('selected');
document.body.classList.toggle('show-only-selected');
}
}
document.addEventListener('click', onClick, false);
})();