Commit d9607a19 authored by Oleh Lamzin's avatar Oleh Lamzin Committed by Commit Bot

[Telemetry SWX] Add web app info

Add web app info for Telemetry Extension and stop using deprecated
install URL for Telemetry Extension.

Fixed: 1120208
Change-Id: I5d71049a685930ff3f139af46c51e36e7e194a09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2375351Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Reviewed-by: default avatarJiewei Qian  <qjw@chromium.org>
Commit-Queue: Oleh Lamzin <lamzin@google.com>
Cr-Commit-Position: refs/heads/master@{#802176}
parent 56b2cd4a
...@@ -2819,11 +2819,15 @@ source_set("chromeos") { ...@@ -2819,11 +2819,15 @@ source_set("chromeos") {
if (!is_official_build) { if (!is_official_build) {
deps += [ deps += [
"//chromeos/components/sample_system_web_app_ui:sample_system_web_app_ui", "//chromeos/components/sample_system_web_app_ui:sample_system_web_app_ui",
"//chromeos/components/telemetry_extension_ui",
"//chromeos/resources:sample_system_web_app_resources_grit", "//chromeos/resources:sample_system_web_app_resources_grit",
"//chromeos/resources:telemetry_extension_resources",
] ]
sources += [ sources += [
"web_applications/sample_system_web_app_info.cc", "web_applications/sample_system_web_app_info.cc",
"web_applications/sample_system_web_app_info.h", "web_applications/sample_system_web_app_info.h",
"web_applications/telemetry_extension_web_app_info.cc",
"web_applications/telemetry_extension_web_app_info.h",
] ]
} }
......
// 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/telemetry_extension_web_app_info.h"
#include <memory>
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chromeos/web_applications/system_web_app_install_utils.h"
#include "chrome/common/web_application_info.h"
#include "chromeos/components/telemetry_extension_ui/url_constants.h"
#include "chromeos/grit/chromeos_telemetry_extension_resources.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom.h"
std::unique_ptr<WebApplicationInfo> CreateWebAppInfoForTelemetryExtension() {
auto info = std::make_unique<WebApplicationInfo>();
info->app_url = GURL(chromeos::kChromeUITelemetryExtensionURL);
info->scope = GURL(chromeos::kChromeUITelemetryExtensionURL);
info->title = base::UTF8ToUTF16("Telemetry Extension");
web_app::CreateIconInfoForSystemWebApp(info->app_url, "app_icon_96.png", 96,
IDR_TELEMETRY_EXTENSION_ICON_96,
*info);
info->theme_color = 0xFF4285F4;
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_TELEMETRY_EXTENSION_WEB_APP_INFO_H_
#define CHROME_BROWSER_CHROMEOS_WEB_APPLICATIONS_TELEMETRY_EXTENSION_WEB_APP_INFO_H_
#include <memory>
#if defined(OFFICIAL_BUILD)
#error Telemetry Extension should only be included in unofficial builds.
#endif
struct WebApplicationInfo;
// Return a WebApplicationInfo used to install the app.
std::unique_ptr<WebApplicationInfo> CreateWebAppInfoForTelemetryExtension();
#endif // CHROME_BROWSER_CHROMEOS_WEB_APPLICATIONS_TELEMETRY_EXTENSION_WEB_APP_INFO_H_
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#if !defined(OFFICIAL_BUILD) #if !defined(OFFICIAL_BUILD)
#include "chrome/browser/chromeos/web_applications/sample_system_web_app_info.h" #include "chrome/browser/chromeos/web_applications/sample_system_web_app_info.h"
#include "chrome/browser/chromeos/web_applications/telemetry_extension_web_app_info.h"
#endif // !defined(OFFICIAL_BUILD) #endif // !defined(OFFICIAL_BUILD)
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
...@@ -172,9 +173,11 @@ base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() { ...@@ -172,9 +173,11 @@ base::flat_map<SystemAppType, SystemAppInfo> CreateSystemWebApps() {
#if !defined(OFFICIAL_BUILD) #if !defined(OFFICIAL_BUILD)
if (SystemWebAppManager::IsAppEnabled(SystemAppType::TELEMETRY)) { if (SystemWebAppManager::IsAppEnabled(SystemAppType::TELEMETRY)) {
infos.emplace(SystemAppType::TELEMETRY, infos.emplace(
SystemAppInfo("Telemetry", SystemAppType::TELEMETRY,
GURL("chrome://telemetry-extension/pwa.html"))); SystemAppInfo(
"Telemetry", GURL("chrome://telemetry-extension"),
base::BindRepeating(&CreateWebAppInfoForTelemetryExtension)));
} }
infos.emplace( infos.emplace(
......
...@@ -1127,10 +1127,7 @@ class SystemWebAppManagerUpgradeBrowserTest ...@@ -1127,10 +1127,7 @@ class SystemWebAppManagerUpgradeBrowserTest
#if defined(OFFICIAL_BUILD) #if defined(OFFICIAL_BUILD)
return 8; return 8;
#else #else
// TODO(http://crbug.com/1120208): Telemetry isn't available for install return 10;
// unless its flag is enabled. So it's not included here. Update this after
// Telemetry is available for install without a flag.
return 9;
#endif // defined(OFFICIAL_BUILD) #endif // defined(OFFICIAL_BUILD)
} }
......
{
"name": "Telemetry Extension",
"short_name": "Telemetry Extension",
"start_url": "/",
"display": "standalone",
"theme_color": "#4285F4",
"background_color": "#ffffff",
"scope": "./",
"icons": [
{
"src": "app_icon_96.png",
"sizes": "96x96",
"type": "image/png"
}
]
}
\ 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">
...@@ -15,9 +15,7 @@ ...@@ -15,9 +15,7 @@
<if expr="telemetry_extension == true"> <if expr="telemetry_extension == true">
<!-- Privileged app host contents. --> <!-- Privileged app host contents. -->
<include name="IDR_TELEMETRY_EXTENSION_INDEX_HTML" file="index.html" type="BINDATA" /> <include name="IDR_TELEMETRY_EXTENSION_INDEX_HTML" file="index.html" type="BINDATA" />
<include name="IDR_TELEMETRY_EXTENSION_PWA_HTML" file="pwa.html" type="BINDATA" /> <include name="IDR_TELEMETRY_EXTENSION_ICON_96" file="app_icon_96.png" type="BINDATA" />
<include name="IDR_TELEMETRY_EXTENSION_MANIFEST" file="manifest.json" type="BINDATA" compress="gzip" />
<include name="IDR_TELEMETRY_EXTENSION_ICON_96" file="app_icon_96.png" type="BINDATA" compress="gzip" />
<include name="IDR_TELEMETRY_EXTENSION_TRUSTED_SCRIPTS_JS" file="trusted_scripts.js" flattenhtml="true" type="BINDATA" compress="gzip" /> <include name="IDR_TELEMETRY_EXTENSION_TRUSTED_SCRIPTS_JS" file="trusted_scripts.js" flattenhtml="true" type="BINDATA" compress="gzip" />
<include name="IDR_TELEMETRY_EXTENSION_DIAGNOSTICS_SERVICE_MOJO_LITE_JS" file="${root_gen_dir}/chromeos/components/telemetry_extension_ui/mojom/diagnostics_service.mojom-lite.js" compress="gzip" use_base_dir="false" type="BINDATA" /> <include name="IDR_TELEMETRY_EXTENSION_DIAGNOSTICS_SERVICE_MOJO_LITE_JS" file="${root_gen_dir}/chromeos/components/telemetry_extension_ui/mojom/diagnostics_service.mojom-lite.js" compress="gzip" use_base_dir="false" type="BINDATA" />
<include name="IDR_TELEMETRY_EXTENSION_PROBE_SERVICE_MOJO_LITE_JS" file="${root_gen_dir}/chromeos/components/telemetry_extension_ui/mojom/probe_service.mojom-lite.js" compress="gzip" use_base_dir="false" type="BINDATA" /> <include name="IDR_TELEMETRY_EXTENSION_PROBE_SERVICE_MOJO_LITE_JS" file="${root_gen_dir}/chromeos/components/telemetry_extension_ui/mojom/probe_service.mojom-lite.js" compress="gzip" use_base_dir="false" type="BINDATA" />
......
...@@ -30,9 +30,6 @@ CreateTrustedTelemetryExtensionDataSource() { ...@@ -30,9 +30,6 @@ CreateTrustedTelemetryExtensionDataSource() {
content::WebUIDataSource::Create(kChromeUITelemetryExtensionHost)); content::WebUIDataSource::Create(kChromeUITelemetryExtensionHost));
trusted_source->AddResourcePath("", IDR_TELEMETRY_EXTENSION_INDEX_HTML); trusted_source->AddResourcePath("", IDR_TELEMETRY_EXTENSION_INDEX_HTML);
trusted_source->AddResourcePath("pwa.html", IDR_TELEMETRY_EXTENSION_PWA_HTML);
trusted_source->AddResourcePath("manifest.json",
IDR_TELEMETRY_EXTENSION_MANIFEST);
trusted_source->AddResourcePath("app_icon_96.png", trusted_source->AddResourcePath("app_icon_96.png",
IDR_TELEMETRY_EXTENSION_ICON_96); IDR_TELEMETRY_EXTENSION_ICON_96);
trusted_source->AddResourcePath("trusted_scripts.js", trusted_source->AddResourcePath("trusted_scripts.js",
......
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