Commit 9f054fbd authored by yilkal's avatar yilkal Committed by Commit Bot

Adds PATL blocking page resources.

This CL adds PATL blocking page strings and blocking page.

Bug: 1015661
Change-Id: I9641c94c0989b1d6335eff6b1ef4cb59bc002f37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895784
Commit-Queue: Yilkal Abe <yilkal@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarAga Wronska <agawronska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715329}
parent b03817a2
...@@ -18,6 +18,8 @@ per-file os_settings_strings.grdp=* ...@@ -18,6 +18,8 @@ per-file os_settings_strings.grdp=*
per-file app_management_strings.grdp=file://chrome/browser/ui/webui/app_management/OWNERS per-file app_management_strings.grdp=file://chrome/browser/ui/webui/app_management/OWNERS
per-file web_time_limit_error_page_strings.grdp=file://chrome/browser/chromeos/child_accounts/OWNERS
per-file global_media_controls_strings.grdp=file://chrome/browser/ui/global_media_controls/OWNERS per-file global_media_controls_strings.grdp=file://chrome/browser/ui/global_media_controls/OWNERS
per-file media_router_strings.grdp=file://chrome/browser/media/router/OWNERS per-file media_router_strings.grdp=file://chrome/browser/media/router/OWNERS
......
...@@ -239,6 +239,10 @@ are declared in tools/grit/grit_rule.gni. ...@@ -239,6 +239,10 @@ are declared in tools/grit/grit_rule.gni.
<part file="supervised_user_error_page_strings.grdp" /> <part file="supervised_user_error_page_strings.grdp" />
</if> </if>
<if expr="chromeos">
<part file="web_time_limit_error_page_strings.grdp" />
</if>
<!-- TODO add all of your "string table" messages here. Remember to <!-- TODO add all of your "string table" messages here. Remember to
change nontranslateable parts of the messages into placeholders (using the change nontranslateable parts of the messages into placeholders (using the
<ph> element). You can also use the 'grit add' tool to help you identify <ph> element). You can also use the 'grit add' tool to help you identify
......
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<!-- Web time limit error page data -->
<message name="IDS_WEB_TIME_LIMIT_ERROR_PAGE_APP_HEADER" desc="A heading for the user when the web time limit has been reached and page is being shown in PWAs.">
<ph name="NAME">$1<ex>App</ex></ph> is paused
</message>
<message name="IDS_WEB_TIME_LIMIT_ERROR_PAGE_APP_MESSAGE" desc="A paragraph informing the user that web time limit has been reached and the error page is being shown in PWAs.">
The limit on <ph name="IDS_SHORT_PRODUCT_NAME">$1<ex>Chrome</ex></ph> or <ph name="IDS_SHORT_PRODUCT_NAME">$1<ex>Chrome</ex></ph> apps that your parent set ran out.
</message>
<message name="IDS_WEB_TIME_LIMIT_ERROR_PAGE_CHROME_HEADER" desc="A heading for the user when the web time limit has been reached.">
<ph name="IDS_SHORT_PRODUCT_NAME">$1<ex>Chrome</ex></ph> is paused
</message>
<message name="IDS_WEB_TIME_LIMIT_ERROR_PAGE_CHROME_MESSAGE" desc="A paragraph informing the user that web time limit has been reached.">
The limit on <ph name="IDS_SHORT_PRODUCT_NAME">$1<ex>Chrome</ex></ph> that your parent set ran out.
</message>
<message name="IDS_WEB_TIME_LIMIT_ERROR_PAGE_NEXT_ACCESS_TIME" desc="A paragraph informing the user the next time the user will be able to use chrome or PWA.">
You can use it for <ph name="TIME_LIMIT">$1<ex>1 hour and 30 minutes</ex></ph> tomorrow.
</message>
<message name="IDS_WEB_TIME_LIMIT_ERROR_PAGE_TITLE" desc="The title for the blocked page.">
<ph name="IDS_SHORT_PRODUCT_NAME">$1<ex>Chrome</ex></ph> is paused
</message>
</grit-part>
file://chrome/browser/supervised_user/supervised_user_error_page/OWNERS
This directory of image SHA-1 hashes is used to improve translations of UI
strings through context images for translators.
See also: [Chrome Translation Screenshots - Instructions & FAQ
](https://docs.google.com/document/d/1nwYWDny20icMSpLUuV_LgrlbWKrYpbXOERUIZNH636o/edit#heading=h.2t7lc4cxo2au)
...@@ -139,6 +139,10 @@ ...@@ -139,6 +139,10 @@
<part file="resources/supervised_user_error_page_resources.grdp" /> <part file="resources/supervised_user_error_page_resources.grdp" />
</if> </if>
<if expr="chromeos">
<part file="resources/web_time_limit_error_page_resources.grdp" />
</if>
<if expr="enable_hangout_services_extension"> <if expr="enable_hangout_services_extension">
<!-- Hangout Services extension, included in Google Chrome builds only. --> <!-- Hangout Services extension, included in Google Chrome builds only. -->
<include name="IDR_HANGOUT_SERVICES_MANIFEST" file="resources\hangout_services\manifest.json" type="BINDATA" /> <include name="IDR_HANGOUT_SERVICES_MANIFEST" file="resources\hangout_services\manifest.json" type="BINDATA" />
......
...@@ -67,6 +67,7 @@ source_set("chromeos") { ...@@ -67,6 +67,7 @@ source_set("chromeos") {
"//chrome/browser:theme_properties", "//chrome/browser:theme_properties",
"//chrome/browser/apps/platform_apps", "//chrome/browser/apps/platform_apps",
"//chrome/browser/apps/platform_apps/api", "//chrome/browser/apps/platform_apps/api",
"//chrome/browser/chromeos/child_accounts/time_limits/web_time_limit_error_page",
"//chrome/browser/chromeos/power/ml/smart_dim", "//chrome/browser/chromeos/power/ml/smart_dim",
"//chrome/browser/devtools", "//chrome/browser/devtools",
"//chrome/browser/extensions", "//chrome/browser/extensions",
......
# Copyright 2019 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("web_time_limit_error_page") {
sources = [
"web_time_limit_error_page.cc",
"web_time_limit_error_page.h",
]
deps = [
"//base",
"//chrome/app:chromium_strings",
"//chrome/app:generated_resources",
"//chrome/browser:resources_grit",
"//ui/base",
]
}
<!doctype html>
<html dir="$i18n{textdirection}" lang="$i18n{language}">
<head>
<meta charset="utf-8">
<meta name="viewport"
content="initial-scale=1, minimum-scale=1,width=device-width">
<title>$i18n{blockPageTitle}</title>
</head>
<body id="web-time-limit-block">
<div class ="main-frame-blocked">
<div id="information-container">
<div clas="icon" id="icon">
<img id="family-link-kite">
</div>
<div id="main-message">
<h1 id="block-page-header">$i18n{blockPageHeader}</h1>
<p id="block-message"> $i18n{blockPageMessage}</p>
</div>
</div>
</div>
</body>
</html>
// Copyright 2019 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.
#include "chrome/browser/chromeos/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_piece_forward.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/time_format.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/jstemplate_builder.h"
#include "ui/base/webui/web_ui_util.h"
namespace {
base::string16 GetTimeLimitMessage(base::TimeDelta time_limit) {
return ui::TimeFormat::Detailed(ui::TimeFormat::Format::FORMAT_DURATION,
ui::TimeFormat::Length::LENGTH_LONG,
/* cutoff */ 3, time_limit);
}
std::string GetWebTimeLimitErrorPage(base::string16 block_header,
base::string16 block_message,
base::TimeDelta time_limit,
const std::string& app_locale) {
block_message +=
l10n_util::GetStringFUTF16(IDS_WEB_TIME_LIMIT_ERROR_PAGE_NEXT_ACCESS_TIME,
GetTimeLimitMessage(time_limit));
base::DictionaryValue strings;
strings.SetString("blockPageTitle",
l10n_util::GetStringFUTF16(
IDS_WEB_TIME_LIMIT_ERROR_PAGE_TITLE,
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)));
strings.SetString("blockPageHeader", block_header);
strings.SetString("blockPageMessage", block_message);
webui::SetLoadTimeDataDefaults(app_locale, &strings);
std::string html =
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
IDR_WEB_TIME_LIMIT_ERROR_PAGE_HTML);
webui::AppendWebUiCssTextDefaults(&html);
std::string error_html = webui::GetI18nTemplateHtml(html, &strings);
return error_html;
}
} // namespace
std::string GetWebTimeLimitChromeErrorPage(base::TimeDelta time_limit,
const std::string& app_locale) {
auto block_header = l10n_util::GetStringFUTF16(
IDS_WEB_TIME_LIMIT_ERROR_PAGE_CHROME_HEADER,
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
auto block_message = l10n_util::GetStringFUTF16(
IDS_WEB_TIME_LIMIT_ERROR_PAGE_CHROME_MESSAGE,
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
return GetWebTimeLimitErrorPage(block_header, block_message, time_limit,
app_locale);
}
std::string GetWebTimeLimitAppErrorPage(base::TimeDelta time_limit,
const std::string& app_locale,
const std::string& app_name) {
auto block_header =
l10n_util::GetStringFUTF16(IDS_WEB_TIME_LIMIT_ERROR_PAGE_APP_HEADER,
UTF8ToUTF16(base::StringPiece(app_name)));
auto block_message = l10n_util::GetStringFUTF16(
IDS_WEB_TIME_LIMIT_ERROR_PAGE_APP_MESSAGE,
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
return GetWebTimeLimitErrorPage(block_header, block_message, time_limit,
app_locale);
}
// Copyright 2019 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.
#ifndef CHROME_BROWSER_CHROMEOS_CHILD_ACCOUNTS_TIME_LIMITS_WEB_TIME_LIMIT_ERROR_PAGE_WEB_TIME_LIMIT_ERROR_PAGE_H_
#define CHROME_BROWSER_CHROMEOS_CHILD_ACCOUNTS_TIME_LIMITS_WEB_TIME_LIMIT_ERROR_PAGE_WEB_TIME_LIMIT_ERROR_PAGE_H_
#include <string>
namespace base {
class TimeDelta;
} // namespace base
// Generates the appropriate time limit error page for Chrome.
// |time_limit| is used to specify the amount of time the user can use Chrome
// and PWAs the following day.
// |app_locale| is used to specify the locale used by the browser.
std::string GetWebTimeLimitChromeErrorPage(base::TimeDelta time_limit,
const std::string& app_locale);
// Generates the appropriate time limit error page for PWAs.
std::string GetWebTimeLimitAppErrorPage(base::TimeDelta time_limit,
const std::string& app_locale,
const std::string& app_name);
#endif // CHROME_BROWSER_CHROMEOS_CHILD_ACCOUNTS_TIME_LIMITS_WEB_TIME_LIMIT_ERROR_PAGE_WEB_TIME_LIMIT_ERROR_PAGE_H_
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<include name="IDR_WEB_TIME_LIMIT_ERROR_PAGE_HTML" file="chromeos/child_accounts/time_limits/web_time_limit_error_page/resources/web_time_limit_error_page.html" flattenhtml="true" type="BINDATA" compress="brotli" />
</grit-part>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment