Commit 198b6770 authored by Gavin Williams's avatar Gavin Williams Committed by Commit Bot

Migrate Print Management App to WebApplicationInfo installation

This change directly creates the WebApplicationInfo struct for the Print
Management SWA installation.

Replace existing SVG icon with the adaptive PNG icon.

Fixed: 1126753
Change-Id: I5fb8c4b0e3c60f92dc4531083313aa6175aa0c0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2439427Reviewed-by: default avatarJimmy Gong <jimmyxgong@chromium.org>
Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Commit-Queue: Gavin Williams <gavinwill@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814105}
parent 6cfb896d
...@@ -120,6 +120,7 @@ source_set("chromeos") { ...@@ -120,6 +120,7 @@ source_set("chromeos") {
"//chromeos/components/multidevice/logging", "//chromeos/components/multidevice/logging",
"//chromeos/components/phonehub", "//chromeos/components/phonehub",
"//chromeos/components/power", "//chromeos/components/power",
"//chromeos/components/print_management",
"//chromeos/components/print_management/mojom", "//chromeos/components/print_management/mojom",
"//chromeos/components/proximity_auth", "//chromeos/components/proximity_auth",
"//chromeos/components/quick_answers/public/cpp:prefs", "//chromeos/components/quick_answers/public/cpp:prefs",
...@@ -187,6 +188,7 @@ source_set("chromeos") { ...@@ -187,6 +188,7 @@ source_set("chromeos") {
"//chromeos/resources:diagnostics_app_resources_grit", "//chromeos/resources:diagnostics_app_resources_grit",
"//chromeos/resources:help_app_resources_grit", "//chromeos/resources:help_app_resources_grit",
"//chromeos/resources:media_app_resources_grit", "//chromeos/resources:media_app_resources_grit",
"//chromeos/resources:print_management_resources_grit",
"//chromeos/resources:scanning_app_resources_grit", "//chromeos/resources:scanning_app_resources_grit",
"//chromeos/services/assistant/public/cpp", "//chromeos/services/assistant/public/cpp",
"//chromeos/services/cfm/public/buildflags", "//chromeos/services/cfm/public/buildflags",
...@@ -2733,6 +2735,8 @@ source_set("chromeos") { ...@@ -2733,6 +2735,8 @@ source_set("chromeos") {
"web_applications/help_app_web_app_info.h", "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/print_management_web_app_info.cc",
"web_applications/print_management_web_app_info.h",
"web_applications/scanning_system_web_app_info.cc", "web_applications/scanning_system_web_app_info.cc",
"web_applications/scanning_system_web_app_info.h", "web_applications/scanning_system_web_app_info.h",
"web_applications/system_web_app_install_utils.cc", "web_applications/system_web_app_install_utils.cc",
......
...@@ -30,5 +30,5 @@ IN_PROC_BROWSER_TEST_P(PrintManagementAppIntegrationTest, ...@@ -30,5 +30,5 @@ IN_PROC_BROWSER_TEST_P(PrintManagementAppIntegrationTest,
web_app::SystemAppType::PRINT_MANAGEMENT, url, "Print Jobs")); web_app::SystemAppType::PRINT_MANAGEMENT, url, "Print Jobs"));
} }
INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_MANIFEST_INSTALL_P( INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_WEB_APP_INFO_INSTALL_P(
PrintManagementAppIntegrationTest); PrintManagementAppIntegrationTest);
// 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/print_management_web_app_info.h"
#include <memory>
#include "chrome/browser/chromeos/web_applications/system_web_app_install_utils.h"
#include "chrome/common/web_application_info.h"
#include "chromeos/components/print_management/url_constants.h"
#include "chromeos/grit/chromeos_print_management_resources.h"
#include "chromeos/strings/grit/chromeos_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
std::unique_ptr<WebApplicationInfo> CreateWebAppInfoForPrintManagementApp() {
std::unique_ptr<WebApplicationInfo> info =
std::make_unique<WebApplicationInfo>();
info->start_url = GURL(chromeos::kChromeUIPrintManagementAppUrl);
info->scope = GURL(chromeos::kChromeUIPrintManagementAppUrl);
info->title = l10n_util::GetStringUTF16(IDS_PRINT_MANAGEMENT_APP_NAME);
web_app::CreateIconInfoForSystemWebApp(
info->start_url,
{{"print_management_192.png", 192, IDR_PRINT_MANAGEMENT_ICON}}, *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_PRINT_MANAGEMENT_WEB_APP_INFO_H_
#define CHROME_BROWSER_CHROMEOS_WEB_APPLICATIONS_PRINT_MANAGEMENT_WEB_APP_INFO_H_
#include <memory>
struct WebApplicationInfo;
// Returns a WebApplicationInfo used to install the app.
std::unique_ptr<WebApplicationInfo> CreateWebAppInfoForPrintManagementApp();
#endif // CHROME_BROWSER_CHROMEOS_WEB_APPLICATIONS_PRINT_MANAGEMENT_WEB_APP_INFO_H_
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#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/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/print_management_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"
#include "chrome/browser/chromeos/web_applications/terminal_system_web_app_info.h" #include "chrome/browser/chromeos/web_applications/terminal_system_web_app_info.h"
...@@ -178,10 +179,10 @@ base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() { ...@@ -178,10 +179,10 @@ base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() {
if (SystemWebAppManager::IsAppEnabled(SystemAppType::PRINT_MANAGEMENT)) { if (SystemWebAppManager::IsAppEnabled(SystemAppType::PRINT_MANAGEMENT)) {
infos.emplace( infos.emplace(
std::piecewise_construct, SystemAppType::PRINT_MANAGEMENT,
std::forward_as_tuple(SystemAppType::PRINT_MANAGEMENT), SystemAppInfo(
std::forward_as_tuple("PrintManagement", "PrintManagement", GURL("chrome://print-management/pwa.html"),
GURL("chrome://print-management/pwa.html"))); base::BindRepeating(&CreateWebAppInfoForPrintManagementApp)));
infos.at(SystemAppType::PRINT_MANAGEMENT).show_in_launcher = false; infos.at(SystemAppType::PRINT_MANAGEMENT).show_in_launcher = false;
infos.at(SystemAppType::PRINT_MANAGEMENT).minimum_window_size = {600, 320}; infos.at(SystemAppType::PRINT_MANAGEMENT).minimum_window_size = {600, 320};
} }
......
...@@ -134,9 +134,6 @@ PrintManagementUI::PrintManagementUI( ...@@ -134,9 +134,6 @@ PrintManagementUI::PrintManagementUI(
IDR_PRINTING_MANAGER_MOJO_LITE_JS); IDR_PRINTING_MANAGER_MOJO_LITE_JS);
AddPrintManagementStrings(html_source.get()); AddPrintManagementStrings(html_source.get());
web_app::SetManifestRequestFilter(html_source.get(),
IDR_PRINT_MANAGEMENT_MANIFEST,
IDS_PRINT_MANAGEMENT_APP_NAME);
content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
html_source.release()); html_source.release());
......
{
"name": "$i18nRaw{name}",
"short_name": "$i18nRaw{name}",
"start_url": "/",
"display": "standalone",
"theme_color": "#ffffff",
"background_color": "#ffffff",
"scope": "./",
"icons": [
{
"src": "printing_app_icon.svg",
"sizes": "192x192",
"type": "image/svg"
}
]
}
\ No newline at end of file
...@@ -20,10 +20,8 @@ ...@@ -20,10 +20,8 @@
<include name="IDR_PRINT_MANAGEMENT_FONTS_CSS_JS" file="${root_gen_dir}/chromeos/components/print_management/resources/print_management_fonts_css.js" use_base_dir="false" type="BINDATA"/> <include name="IDR_PRINT_MANAGEMENT_FONTS_CSS_JS" file="${root_gen_dir}/chromeos/components/print_management/resources/print_management_fonts_css.js" use_base_dir="false" type="BINDATA"/>
<include name="IDR_PRINT_MANAGEMENT_SHARED_CSS_JS" file="${root_gen_dir}/chromeos/components/print_management/resources/print_management_shared_css.js" use_base_dir="false" type="BINDATA"/> <include name="IDR_PRINT_MANAGEMENT_SHARED_CSS_JS" file="${root_gen_dir}/chromeos/components/print_management/resources/print_management_shared_css.js" use_base_dir="false" type="BINDATA"/>
<include name="IDR_PRINT_MANAGEMENT_PRINT_JOB_CLEAR_HISTORY_DIALOG_JS" file="${root_gen_dir}/chromeos/components/print_management/resources/print_job_clear_history_dialog.js" use_base_dir="false" type="BINDATA"/> <include name="IDR_PRINT_MANAGEMENT_PRINT_JOB_CLEAR_HISTORY_DIALOG_JS" file="${root_gen_dir}/chromeos/components/print_management/resources/print_job_clear_history_dialog.js" use_base_dir="false" type="BINDATA"/>
<include name="IDR_PRINT_MANAGEMENT_MANIFEST" file="manifest.json" type="BINDATA"/> <include name="IDR_PRINT_MANAGEMENT_ICON" file="print_management_192.png" type="BINDATA"/>
<include name="IDR_PRINT_MANAGEMENT_ICON" file="printing_app_icon.svg" type="BINDATA"/>
<include name="IDR_PRINTING_MANAGER_MOJO_LITE_JS" file="${root_gen_dir}/chromeos/components/print_management/mojom/printing_manager.mojom-lite.js" use_base_dir="false" type="BINDATA" /> <include name="IDR_PRINTING_MANAGER_MOJO_LITE_JS" file="${root_gen_dir}/chromeos/components/print_management/mojom/printing_manager.mojom-lite.js" use_base_dir="false" type="BINDATA" />
<include name="IDR_PRINT_MANAGEMENT_PWA_HTML" file="pwa.html" type="BINDATA" />
</includes> </includes>
<structures> <structures>
......
<svg width="192" height="192" viewBox="0 0 192 192" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="96" cy="95.9998" r="88" fill="#5F6368"/>
<path d="M150 73.0003C150 68.5821 146.418 65.0003 142 65.0003L50 65.0003C45.5817 65.0003 42 68.5821 42 73.0003L42 125C42 129.419 45.5817 133 50 133L142 133C146.418 133 150 129.419 150 125L150 73.0003Z" fill="#AECBFA"/>
<rect x="58" y="103" width="76" height="16" rx="2" fill="#5F6368"/>
<path d="M65 48.0002C65 46.8956 65.8954 46.0002 67 46.0002H125C126.105 46.0002 127 46.8956 127 48.0002V65.0001H65V48.0002Z" fill="white"/>
<path d="M65 110H127V142C127 143.104 126.105 144 125 144H67C65.8954 144 65 143.104 65 142V110Z" fill="white"/>
<rect x="75" y="130" width="42" height="4" rx="2" fill="#5F6368"/>
<rect x="75" y="120" width="42" height="4" rx="2" fill="#5F6368"/>
<circle cx="128" cy="88.9997" r="6" fill="#1A73E8"/>
<circle cx="96" cy="96" r="88" fill="#5F6368"/>
<path d="M156 70.8642C156 65.9686 152.031 62 147.136 62L44.8642 62C39.9686 62 36 65.9686 36 70.8642L36 129.136C36 134.031 39.9686 138 44.8642 138L147.136 138C152.031 138 156 134.031 156 129.136L156 70.8642Z" fill="#4285F4"/>
<rect x="54" y="104" width="84" height="18" rx="2.21605" fill="#5F6368"/>
<path d="M62 43.216C62 41.9922 62.9922 41 64.216 41H127.784C129.008 41 130 41.9922 130 43.216V62.0525H62V43.216Z" fill="white"/>
<path d="M62 112H130V147.784C130 149.008 129.008 150 127.784 150H64.216C62.9922 150 62 149.008 62 147.784V112Z" fill="white"/>
<rect x="73" y="134" width="46" height="4" rx="2" fill="#5F6368"/>
<rect x="73" y="122" width="46" height="4" rx="2" fill="#5F6368"/>
<circle cx="132" cy="88" r="6" fill="#80F9F9"/>
</svg>
\ No newline at end of file
<!-- 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. -->
<!-- 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