Commit f25c8c2e authored by Dom Schulz's avatar Dom Schulz Committed by Commit Bot

Port OSSettings to non-manifest install

Delete the pwa.html and os-settings-manifest.json files, and install via
a WebApplicationInfo.

Bug: 1085274
Bug: 1126752
Change-Id: Ie269b46771daa7f302821491735e42b53e7bfc2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2475310
Commit-Queue: Dominic Schulz <dominicschulz@google.com>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Auto-Submit: Dominic Schulz <dominicschulz@google.com>
Cr-Commit-Position: refs/heads/master@{#819034}
parent 04d97b52
......@@ -442,7 +442,6 @@
<include name="IDR_IME_WINDOW_CLOSE_C" file="resources\input_ime\ime_window_close_click.png" type="BINDATA" />
<include name="IDR_IME_WINDOW_CLOSE_H" file="resources\input_ime\ime_window_close_hover.png" type="BINDATA" />
</if>
<include name="IDR_PWA_HTML" file="resources\pwa.html" type="BINDATA" />
<if expr="chromeos">
<include name="IDR_SMB_SHARES_DIALOG_CONTAINER_HTML" file="resources\chromeos\smb_shares\smb_share_dialog_container.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" />
<include name="IDR_SMB_SHARES_DIALOG_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\smb_shares\smb_share_dialog.js" use_base_dir="false" type="chrome_html" />
......
......@@ -87,6 +87,7 @@ source_set("chromeos") {
"//chrome/browser/image_decoder",
"//chrome/browser/nearby_sharing/logging",
"//chrome/browser/resource_coordinator:tab_metrics_event_proto",
"//chrome/browser/resources:settings_resources_grit",
"//chrome/browser/ui/webui/bluetooth_internals:mojo_bindings",
"//chrome/browser/ui/webui/chromeos/crostini_upgrader:mojo_bindings",
"//chrome/browser/ui/webui/settings/chromeos/constants:mojom",
......@@ -2800,6 +2801,8 @@ source_set("chromeos") {
"web_applications/help_app_web_app_info.h",
"web_applications/media_web_app_info.cc",
"web_applications/media_web_app_info.h",
"web_applications/os_settings_web_app_info.cc",
"web_applications/os_settings_web_app_info.h",
"web_applications/print_management_web_app_info.cc",
"web_applications/print_management_web_app_info.h",
"web_applications/scanning_system_web_app_info.cc",
......
// 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/os_settings_web_app_info.h"
#include <memory>
#include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h"
#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 "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/os_settings_resources.h"
#include "chromeos/strings/grit/chromeos_strings.h"
#include "ui/base/l10n/l10n_util.h"
std::unique_ptr<WebApplicationInfo>
CreateWebAppInfoForOSSettingsSystemWebApp() {
std::unique_ptr<WebApplicationInfo> info =
std::make_unique<WebApplicationInfo>();
info->start_url = GURL(chrome::kChromeUIOSSettingsURL);
info->scope = GURL(chrome::kChromeUIOSSettingsURL);
info->title = l10n_util::GetStringUTF16(IDS_SETTINGS_SETTINGS);
web_app::CreateIconInfoForSystemWebApp(
info->start_url,
{
{"icon-192.png", 192, IDR_SETTINGS_LOGO_192},
},
*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_OS_SETTINGS_WEB_APP_INFO_H_
#define CHROME_BROWSER_CHROMEOS_WEB_APPLICATIONS_OS_SETTINGS_WEB_APP_INFO_H_
#include <memory>
struct WebApplicationInfo;
// Return a WebApplicationInfo used to install the app.
std::unique_ptr<WebApplicationInfo> CreateWebAppInfoForOSSettingsSystemWebApp();
#endif // CHROME_BROWSER_CHROMEOS_WEB_APPLICATIONS_OS_SETTINGS_WEB_APP_INFO_H_
<!-- TODO(calamity): Remove this once manifest URL installs are implemented. -->
<!-- See https://crbug.com/896575 for details -->
<html>
<head>
<link rel="manifest" href="manifest.json">
</head>
</html>
{
"name": "$i18nRaw{name}",
"display": "standalone",
"icons": [
{
"src": "icon-192.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "/",
"theme_color": "#fff"
}
......@@ -342,9 +342,6 @@
<structure name="IDR_OS_SETTINGS_TTS_SUBPAGE_BROWSER_PROXY_HTML"
file="chromeos/os_a11y_page/tts_subpage_browser_proxy.html"
compress="false" type="chrome_html" />
<structure name="IDR_OS_SETTINGS_MANIFEST"
file="os_settings_manifest.json"
compress="false" type="chrome_html" />
<structure name="IDR_OS_SETTINGS_ABOUT_PAGE_BROWSER_PROXY_HTML"
file="about_page/about_page_browser_proxy.html"
compress="false" type="chrome_html" />
......
......@@ -34,10 +34,6 @@
use_base_dir="false"
flattenhtml="true"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_MANIFEST"
file="os_settings_manifest.json"
type="BINDATA"
compress="gzip" />
<!-- Constants -->
<include name="IDR_OS_SETTINGS_ROUTES_MOJOM_LITE_JS"
......
......@@ -27,7 +27,6 @@
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/os_settings_resources.h"
#include "chromeos/components/web_applications/manifest_request_filter.h"
#include "chromeos/constants/chromeos_features.h"
#include "components/strings/grit/components_strings.h"
#include "components/user_manager/user_manager.h"
......@@ -173,9 +172,6 @@ void MainSection::AddLoadTimeData(content::WebUIDataSource* html_source) {
// Add the System Web App resources for Settings.
html_source->AddResourcePath("icon-192.png", IDR_SETTINGS_LOGO_192);
html_source->AddResourcePath("pwa.html", IDR_PWA_HTML);
web_app::SetManifestRequestFilter(html_source, IDR_OS_SETTINGS_MANIFEST,
IDS_SETTINGS_SETTINGS);
html_source->AddResourcePath("constants/routes.mojom-lite.js",
IDR_OS_SETTINGS_ROUTES_MOJOM_LITE_JS);
......
......@@ -50,6 +50,7 @@
#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/os_settings_web_app_info.h"
#include "chrome/browser/chromeos/web_applications/print_management_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"
......@@ -97,7 +98,6 @@ url::Origin GetOrigin(const char* url) {
return origin;
}
#endif // OS_CHROMEOS
base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() {
......@@ -137,9 +137,10 @@ base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() {
base::BindRepeating(&CreateWebAppInfoForDiagnosticsSystemWebApp)));
}
infos.emplace(
SystemAppType::SETTINGS,
SystemAppInfo("OSSettings", GURL("chrome://os-settings/pwa.html")));
infos.emplace(SystemAppType::SETTINGS,
SystemAppInfo("OSSettings", GURL(chrome::kChromeUISettingsURL),
base::BindRepeating(
&CreateWebAppInfoForOSSettingsSystemWebApp)));
infos.at(SystemAppType::SETTINGS).uninstall_and_replace = {
chromeos::default_web_apps::kSettingsAppId, ash::kInternalAppIdSettings};
// Large enough to see the heading text "Settings" in the top-left.
......
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