Commit 455d4467 authored by Callistus's avatar Callistus Committed by Commit Bot

Install the help SWA through WebApplicationInfo.

- Deleted manifest.json, pwa.html
- Populated WebApplicationInfo with values from manifest.json
- Updated installation for Help app in CreateSystemWebApps

Bug: b/168159973
Change-Id: I3106cd8eba5806762afd24ce36b9ff522e93b375
Cq-Include-Trybots: chrome/try:linux-chromeos-chrome
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2428490Reviewed-by: default avatarRachel Carpenter <carpenterr@chromium.org>
Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Auto-Submit: Callistus Tan <callistus@google.com>
Commit-Queue: Callistus Tan <callistus@google.com>
Cr-Commit-Position: refs/heads/master@{#811096}
parent 5bf6763d
...@@ -185,6 +185,7 @@ source_set("chromeos") { ...@@ -185,6 +185,7 @@ source_set("chromeos") {
"//chromeos/memory", "//chromeos/memory",
"//chromeos/network", "//chromeos/network",
"//chromeos/resources:diagnostics_app_resources_grit", "//chromeos/resources:diagnostics_app_resources_grit",
"//chromeos/resources:help_app_resources_grit",
"//chromeos/resources:media_app_resources_grit", "//chromeos/resources:media_app_resources_grit",
"//chromeos/resources:scanning_app_resources_grit", "//chromeos/resources:scanning_app_resources_grit",
"//chromeos/services/assistant/public/cpp", "//chromeos/services/assistant/public/cpp",
...@@ -2703,6 +2704,8 @@ source_set("chromeos") { ...@@ -2703,6 +2704,8 @@ source_set("chromeos") {
"web_applications/default_web_app_ids.h", "web_applications/default_web_app_ids.h",
"web_applications/diagnostics_system_web_app_info.cc", "web_applications/diagnostics_system_web_app_info.cc",
"web_applications/diagnostics_system_web_app_info.h", "web_applications/diagnostics_system_web_app_info.h",
"web_applications/help_app_web_app_info.cc",
"web_applications/help_app_web_app_info.h",
"web_applications/media_web_app_info.cc", "web_applications/media_web_app_info.cc",
"web_applications/media_web_app_info.h", "web_applications/media_web_app_info.h",
"web_applications/scanning_system_web_app_info.cc", "web_applications/scanning_system_web_app_info.cc",
......
...@@ -418,9 +418,9 @@ IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest, ...@@ -418,9 +418,9 @@ IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest,
EXPECT_EQ(GURL("chrome://help-app"), GetActiveWebContents()->GetVisibleURL()); EXPECT_EQ(GURL("chrome://help-app"), GetActiveWebContents()->GetVisibleURL());
} }
INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_MANIFEST_INSTALL_P( INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_WEB_APP_INFO_INSTALL_P(
HelpAppIntegrationTest); HelpAppIntegrationTest);
INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_ALL_PROFILE_TYPES_P( INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_ALL_PROFILE_TYPES_P(
HelpAppAllProfilesIntegrationTest, HelpAppAllProfilesIntegrationTest,
kManifestInstall); kWebAppInfoInstall);
// Copyright 2020 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/web_applications/help_app_web_app_info.h"
#include <memory>
#include "chrome/browser/chromeos/web_applications/system_web_app_install_utils.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/common/web_application_info.h"
#include "chromeos/components/help_app_ui/url_constants.h"
#include "chromeos/grit/chromeos_help_app_resources.h"
#include "chromeos/strings/grit/chromeos_strings.h"
#include "ui/base/l10n/l10n_util.h"
std::unique_ptr<WebApplicationInfo> CreateWebAppInfoForHelpWebApp() {
std::unique_ptr<WebApplicationInfo> info =
std::make_unique<WebApplicationInfo>();
info->start_url = GURL(chromeos::kChromeUIHelpAppURL);
info->scope = GURL(chromeos::kChromeUIHelpAppURL);
info->title = l10n_util::GetStringUTF16(IDS_HELP_APP_EXPLORE);
web_app::CreateIconInfoForSystemWebApp(
info->start_url,
{
{"app_icon_192.png", 192, IDR_HELP_APP_ICON_192},
{"app_icon_512.png", 512, IDR_HELP_APP_ICON_512},
},
*info);
info->theme_color = 0xffffffff;
info->background_color = 0xffffffff;
info->display_mode = blink::mojom::DisplayMode::kStandalone;
info->open_as_window = true;
return info;
}
// Copyright 2020 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_WEB_APPLICATIONS_HELP_APP_WEB_APP_INFO_H_
#define CHROME_BROWSER_CHROMEOS_WEB_APPLICATIONS_HELP_APP_WEB_APP_INFO_H_
#include <memory>
struct WebApplicationInfo;
// Return a WebApplicationInfo used to install the app.
std::unique_ptr<WebApplicationInfo> CreateWebAppInfoForHelpWebApp();
#endif // CHROME_BROWSER_CHROMEOS_WEB_APPLICATIONS_HELP_APP_WEB_APP_INFO_H_
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "chrome/browser/chromeos/web_applications/camera_system_web_app_info.h" #include "chrome/browser/chromeos/web_applications/camera_system_web_app_info.h"
#include "chrome/browser/chromeos/web_applications/default_web_app_ids.h" #include "chrome/browser/chromeos/web_applications/default_web_app_ids.h"
#include "chrome/browser/chromeos/web_applications/diagnostics_system_web_app_info.h" #include "chrome/browser/chromeos/web_applications/diagnostics_system_web_app_info.h"
#include "chrome/browser/chromeos/web_applications/help_app_web_app_info.h"
#include "chrome/browser/chromeos/web_applications/media_web_app_info.h" #include "chrome/browser/chromeos/web_applications/media_web_app_info.h"
#include "chrome/browser/chromeos/web_applications/scanning_system_web_app_info.h" #include "chrome/browser/chromeos/web_applications/scanning_system_web_app_info.h"
#include "chrome/browser/chromeos/web_applications/terminal_source.h" #include "chrome/browser/chromeos/web_applications/terminal_source.h"
...@@ -152,8 +153,10 @@ base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() { ...@@ -152,8 +153,10 @@ base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() {
} }
if (SystemWebAppManager::IsAppEnabled(SystemAppType::HELP)) { if (SystemWebAppManager::IsAppEnabled(SystemAppType::HELP)) {
infos.emplace(SystemAppType::HELP, infos.emplace(
SystemAppInfo("Help", GURL("chrome://help-app/pwa.html"))); SystemAppType::HELP,
SystemAppInfo("Help", GURL("chrome://help-app/pwa.html"),
base::BindRepeating(&CreateWebAppInfoForHelpWebApp)));
infos.at(SystemAppType::HELP).additional_search_terms = { infos.at(SystemAppType::HELP).additional_search_terms = {
IDS_GENIUS_APP_NAME, IDS_HELP_APP_PERKS, IDS_HELP_APP_OFFERS}; IDS_GENIUS_APP_NAME, IDS_HELP_APP_PERKS, IDS_HELP_APP_OFFERS};
infos.at(SystemAppType::HELP).minimum_window_size = {600, 320}; infos.at(SystemAppType::HELP).minimum_window_size = {600, 320};
......
...@@ -32,7 +32,6 @@ content::WebUIDataSource* CreateHostDataSource() { ...@@ -32,7 +32,6 @@ content::WebUIDataSource* CreateHostDataSource() {
// TODO(crbug.com/1012578): This is a placeholder only, update with the // TODO(crbug.com/1012578): This is a placeholder only, update with the
// actual app content. // actual app content.
source->SetDefaultResource(IDR_HELP_APP_HOST_INDEX_HTML); source->SetDefaultResource(IDR_HELP_APP_HOST_INDEX_HTML);
source->AddResourcePath("pwa.html", IDR_HELP_APP_PWA_HTML);
source->AddResourcePath("app_icon_192.png", IDR_HELP_APP_ICON_192); source->AddResourcePath("app_icon_192.png", IDR_HELP_APP_ICON_192);
source->AddResourcePath("app_icon_512.png", IDR_HELP_APP_ICON_512); source->AddResourcePath("app_icon_512.png", IDR_HELP_APP_ICON_512);
source->AddResourcePath("help_app_index_scripts.js", source->AddResourcePath("help_app_index_scripts.js",
...@@ -44,8 +43,6 @@ content::WebUIDataSource* CreateHostDataSource() { ...@@ -44,8 +43,6 @@ content::WebUIDataSource* CreateHostDataSource() {
source->AddResourcePath("local_search_service_proxy.mojom-lite.js", source->AddResourcePath("local_search_service_proxy.mojom-lite.js",
IDR_HELP_APP_LOCAL_SEARCH_SERVICE_PROXY_MOJOM_JS); IDR_HELP_APP_LOCAL_SEARCH_SERVICE_PROXY_MOJOM_JS);
source->AddLocalizedString("appTitle", IDS_HELP_APP_EXPLORE); source->AddLocalizedString("appTitle", IDS_HELP_APP_EXPLORE);
web_app::SetManifestRequestFilter(source, IDR_HELP_APP_MANIFEST,
IDS_HELP_APP_EXPLORE);
return source; return source;
} }
} // namespace } // namespace
......
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
<includes> <includes>
<include name="IDR_HELP_APP_HOST_INDEX_HTML" file="index.html" <include name="IDR_HELP_APP_HOST_INDEX_HTML" file="index.html"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_HELP_APP_PWA_HTML" file="pwa.html" type="BINDATA" />
<include name="IDR_HELP_APP_MANIFEST" file="manifest.json"
type="BINDATA" />
<include name="IDR_HELP_APP_ICON_192" file="app_icon_192.png" <include name="IDR_HELP_APP_ICON_192" file="app_icon_192.png"
type="BINDATA" /> type="BINDATA" />
<include name="IDR_HELP_APP_ICON_512" file="app_icon_512.png" <include name="IDR_HELP_APP_ICON_512" file="app_icon_512.png"
......
{
"name": "$i18nRaw{name}",
"short_name": "$i18nRaw{name}",
"start_url": "/",
"display": "standalone",
"theme_color": "#ffffff",
"background_color": "#ffffff",
"icons": [
{
"src": "app_icon_192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "app_icon_512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
<!-- 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. -->
<!-- TODO(crbug/896575): Delete when manifest URL installs are implemented. -->
<!DOCTYPE html>
<link rel="manifest" href="manifest.json">
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