Commit 1d652b91 authored by Jimmy Gong's avatar Jimmy Gong Committed by Commit Bot

Convert print job history app to SWA

- Future CL's will remove the app from the app drawer and launch
  the SWA from the printer settings page.
- Currently using a temporary icon, will replace once UI mocks
  are available.
- SWA is hidden behind a flag.

Bug: 1053704
Change-Id: I576f119df3ceea52fac54da8e1ed035fdc2d3a3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078783
Commit-Queue: jimmy gong <jimmyxgong@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748392}
parent 85941e84
// 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 "base/test/scoped_feature_list.h"
#include "chrome/browser/chromeos/web_applications/system_web_app_integration_test.h"
#include "chrome/browser/web_applications/system_web_app_manager.h"
#include "chromeos/components/print_management/url_constants.h"
#include "chromeos/constants/chromeos_features.h"
#include "testing/gtest/include/gtest/gtest.h"
class PrintManagementAppIntegrationTest : public SystemWebAppIntegrationTest {
public:
PrintManagementAppIntegrationTest() {
scoped_feature_list_.InitWithFeatures(
{chromeos::features::kPrintJobManagementApp}, {});
}
private:
base::test::ScopedFeatureList scoped_feature_list_;
};
// Test that the Print Management App installs and launches correctly. Runs some
// spot checks on the manifest.
IN_PROC_BROWSER_TEST_P(PrintManagementAppIntegrationTest,
PrintManagementAppInLauncher) {
const GURL url(chromeos::kChromeUIPrintManagementAppUrl);
EXPECT_NO_FATAL_FAILURE(ExpectSystemWebAppValid(
web_app::SystemAppType::PRINT_MANAGEMENT, url, "Print Management App"));
}
INSTANTIATE_TEST_SUITE_P(All,
PrintManagementAppIntegrationTest,
::testing::Values(web_app::ProviderType::kBookmarkApps,
web_app::ProviderType::kWebApps),
web_app::ProviderTypeParamToString);
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "chrome/browser/web_applications/system_web_app_manager.h" #include "chrome/browser/web_applications/system_web_app_manager.h"
#include <string> #include <string>
#include <tuple>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -118,6 +119,15 @@ base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() { ...@@ -118,6 +119,15 @@ base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() {
infos.at(SystemAppType::MEDIA).include_launch_directory = true; infos.at(SystemAppType::MEDIA).include_launch_directory = true;
} }
if (SystemWebAppManager::IsAppEnabled(SystemAppType::PRINT_MANAGEMENT)) {
infos.emplace(
std::piecewise_construct,
std::forward_as_tuple(SystemAppType::PRINT_MANAGEMENT),
std::forward_as_tuple("PrintManagement",
GURL("chrome://print-management/pwa.html")));
infos.at(SystemAppType::PRINT_MANAGEMENT).show_in_launcher = false;
}
#if !defined(OFFICIAL_BUILD) #if !defined(OFFICIAL_BUILD)
infos.emplace( infos.emplace(
SystemAppType::SAMPLE, SystemAppType::SAMPLE,
...@@ -184,6 +194,9 @@ bool SystemWebAppManager::IsAppEnabled(SystemAppType type) { ...@@ -184,6 +194,9 @@ bool SystemWebAppManager::IsAppEnabled(SystemAppType type) {
return base::FeatureList::IsEnabled(chromeos::features::kMediaApp); return base::FeatureList::IsEnabled(chromeos::features::kMediaApp);
case SystemAppType::HELP: case SystemAppType::HELP:
return base::FeatureList::IsEnabled(chromeos::features::kHelpAppV2); return base::FeatureList::IsEnabled(chromeos::features::kHelpAppV2);
case SystemAppType::PRINT_MANAGEMENT:
return base::FeatureList::IsEnabled(
chromeos::features::kPrintJobManagementApp);
#if !defined(OFFICIAL_BUILD) #if !defined(OFFICIAL_BUILD)
case SystemAppType::SAMPLE: case SystemAppType::SAMPLE:
NOTREACHED(); NOTREACHED();
......
...@@ -48,6 +48,7 @@ enum class SystemAppType { ...@@ -48,6 +48,7 @@ enum class SystemAppType {
TERMINAL, TERMINAL,
MEDIA, MEDIA,
HELP, HELP,
PRINT_MANAGEMENT,
#if !defined(OFFICIAL_BUILD) #if !defined(OFFICIAL_BUILD)
SAMPLE, SAMPLE,
#endif // !defined(OFFICIAL_BUILD) #endif // !defined(OFFICIAL_BUILD)
......
...@@ -2373,6 +2373,7 @@ if (!is_android) { ...@@ -2373,6 +2373,7 @@ if (!is_android) {
"../browser/chromeos/system/tray_accessibility_browsertest.cc", "../browser/chromeos/system/tray_accessibility_browsertest.cc",
"../browser/chromeos/web_applications/help_app_integration_browsertest.cc", "../browser/chromeos/web_applications/help_app_integration_browsertest.cc",
"../browser/chromeos/web_applications/media_app_integration_browsertest.cc", "../browser/chromeos/web_applications/media_app_integration_browsertest.cc",
"../browser/chromeos/web_applications/print_management_app_integration_browsertest.cc",
"../browser/chromeos/web_applications/system_web_app_integration_test.cc", "../browser/chromeos/web_applications/system_web_app_integration_test.cc",
"../browser/chromeos/web_applications/system_web_app_integration_test.h", "../browser/chromeos/web_applications/system_web_app_integration_test.h",
"../browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_web_request_service_browsertest.cc", "../browser/chromeos/wilco_dtc_supportd/wilco_dtc_supportd_web_request_service_browsertest.cc",
......
...@@ -25,6 +25,9 @@ PrintManagementUI::PrintManagementUI(content::WebUI* web_ui) ...@@ -25,6 +25,9 @@ PrintManagementUI::PrintManagementUI(content::WebUI* web_ui)
html_source->AddResourcePath("test_loader.js", IDR_WEBUI_JS_TEST_LOADER); html_source->AddResourcePath("test_loader.js", IDR_WEBUI_JS_TEST_LOADER);
html_source->AddResourcePath("test_loader.html", IDR_WEBUI_HTML_TEST_LOADER); html_source->AddResourcePath("test_loader.html", IDR_WEBUI_HTML_TEST_LOADER);
html_source->SetDefaultResource(IDR_PRINT_MANAGEMENT_INDEX_HTML); html_source->SetDefaultResource(IDR_PRINT_MANAGEMENT_INDEX_HTML);
html_source->AddResourcePath("pwa.html", IDR_PRINT_MANAGEMENT_PWA_HTML);
html_source->AddResourcePath("manifest.json", IDR_PRINT_MANAGEMENT_MANIFEST);
html_source->AddResourcePath("app_icon_192.png", IDR_PRINT_MANAGEMENT_ICON);
content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
html_source.release()); html_source.release());
......
{
"name": "Print Management App",
"short_name": "Print Management",
"start_url": "/",
"display": "standalone",
"theme_color": "#4285F4",
"background_color": "#ffffff",
"scope": "./",
"icons": [
{
"src": "app_icon_192.png",
"sizes": "192x192",
"type": "image/png"
}
]
}
\ No newline at end of file
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
<!-- Privileged app host contents. --> <!-- Privileged app host contents. -->
<include name="IDR_PRINT_MANAGEMENT_INDEX_HTML" file="index.html" type="BINDATA" compress="gzip" /> <include name="IDR_PRINT_MANAGEMENT_INDEX_HTML" file="index.html" type="BINDATA" compress="gzip" />
<include name="IDR_PRINT_MANAGEMENT_JS" file="${root_gen_dir}/chromeos/components/print_management/resources/print_management.js" use_base_dir="false" compress="gzip" type="BINDATA"/> <include name="IDR_PRINT_MANAGEMENT_JS" file="${root_gen_dir}/chromeos/components/print_management/resources/print_management.js" use_base_dir="false" compress="gzip" type="BINDATA"/>
<include name="IDR_PRINT_MANAGEMENT_MANIFEST" file="manifest.json" type="BINDATA" compress="gzip" />
<include name="IDR_PRINT_MANAGEMENT_ICON" file="app_icon_192.png" type="BINDATA" compress="gzip" />
<include name="IDR_PRINT_MANAGEMENT_PWA_HTML" file="pwa.html" type="BINDATA" compress="gzip" />
</includes> </includes>
</release> </release>
</grit> </grit>
\ 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">
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
namespace chromeos { namespace chromeos {
const char kChromeUIPrintManagementHost[] = "print-management"; const char kChromeUIPrintManagementHost[] = "print-management";
const char kChromeUIPrintManagementAppUrl[] = "chrome://print-management";
} // namespace chromeos } // namespace chromeos
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace chromeos { namespace chromeos {
extern const char kChromeUIPrintManagementHost[]; extern const char kChromeUIPrintManagementHost[];
extern const char kChromeUIPrintManagementAppUrl[];
} // namespace chromeos } // namespace chromeos
......
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