Commit fe5e9c2a authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

Migrate remaining preinstalled web apps from Chrome OS JSON to C++

This CL is a follow up to
https://chromium-review.googlesource.com/c/chromium/src/+/2524809/
where the remaining default installed Chrome apps are migrated over to
preinstalled web apps:
 - Gmail
 - Google Docs
 - Google Drive
 - Google Sheets
 - Google Slides
 - YouTube

This copies the JSON configs in
https://chrome-internal.googlesource.com/chromeos/overlays/chromeos-overlay/+/master/chromeos-base/chromeos-default-apps/files/web_apps/docs.json
to C++ in the Chrome binary. The JSON configs will be removed
in a follow up CL to avoid data duplication in multiple
locations and formats.

The icons used by these default apps are stored in an internal
repository: https://chrome-internal.googlesource.com/chrome/components/default_apps/+/refs/heads/main

Bug: 1104692
Change-Id: I51ea68b0d1a9c0d25e1edfb4fc5b3557643b562e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2525886Reviewed-by: default avatarcalamity <calamity@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarGlen Robertson <glenrob@chromium.org>
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827716}
parent 550f9f68
...@@ -185,14 +185,18 @@ if (!is_android) { ...@@ -185,14 +185,18 @@ if (!is_android) {
output_dir = "$root_gen_dir/chrome" output_dir = "$root_gen_dir/chrome"
} }
grit("preinstalled_web_apps_resources") { if (is_chrome_branded) {
source = "preinstalled_web_apps/resources.grd" grit("preinstalled_web_apps_resources") {
defines = chrome_grit_defines source = "preinstalled_web_apps/resources.grd"
outputs = [ defines = chrome_grit_defines
"grit/preinstalled_web_apps_resources.h", outputs = [
"preinstalled_web_apps_resources.pak", "grit/preinstalled_web_apps_resources.h",
] "grit/preinstalled_web_apps_resources_map.cc",
output_dir = "$root_gen_dir/chrome" "grit/preinstalled_web_apps_resources_map.h",
"preinstalled_web_apps_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
} }
} }
......
...@@ -7,15 +7,18 @@ ...@@ -7,15 +7,18 @@
{ {
"blpcfgokakmgnkcojhhkbfbldkacnbeo" : { "blpcfgokakmgnkcojhhkbfbldkacnbeo" : {
"external_crx": "youtube.crx", "external_crx": "youtube.crx",
"external_version": "4.2.5" "external_version": "4.2.5",
"web_app_migration_flag": "MigrateDefaultChromeAppToWebAppsNonGSuite"
}, },
"pjkljhegncpnkpknbcohdijeoejaedia" : { "pjkljhegncpnkpknbcohdijeoejaedia" : {
"external_crx": "gmail.crx", "external_crx": "gmail.crx",
"external_version": "7" "external_version": "7",
"web_app_migration_flag": "MigrateDefaultChromeAppToWebAppsGSuite"
}, },
"apdfllckaahabafndbhieahigkjlhalf" : { "apdfllckaahabafndbhieahigkjlhalf" : {
"external_crx": "drive.crx", "external_crx": "drive.crx",
"external_version": "6.2" "external_version": "6.2",
"web_app_migration_flag": "MigrateDefaultChromeAppToWebAppsGSuite"
}, },
"aohghmighlieiainnegkcijnfilokake" : { "aohghmighlieiainnegkcijnfilokake" : {
"external_crx": "docs.crx", "external_crx": "docs.crx",
...@@ -24,11 +27,13 @@ ...@@ -24,11 +27,13 @@
}, },
// Google Sheets // Google Sheets
"aapocclcgogkmnckokdopfmhonfmgoek" : { "aapocclcgogkmnckokdopfmhonfmgoek" : {
"external_update_url": "https://clients2.google.com/service/update2/crx" "external_update_url": "https://clients2.google.com/service/update2/crx",
"web_app_migration_flag": "MigrateDefaultChromeAppToWebAppsGSuite"
}, },
// Google Slides // Google Slides
"felcaaldnbdncclmgdcncolpebgiejap" : { "felcaaldnbdncclmgdcncolpebgiejap" : {
"external_update_url": "https://clients2.google.com/service/update2/crx" "external_update_url": "https://clients2.google.com/service/update2/crx",
"web_app_migration_flag": "MigrateDefaultChromeAppToWebAppsGSuite"
}, },
// Drive extension // Drive extension
"ghbmnnjooekpmoecnnnilnnbdlolhkhi" : { "ghbmnnjooekpmoecnnnilnnbdlolhkhi" : {
......
...@@ -4,10 +4,20 @@ ...@@ -4,10 +4,20 @@
<output filename="grit/preinstalled_web_apps_resources.h" type="rc_header"> <output filename="grit/preinstalled_web_apps_resources.h" type="rc_header">
<emit emit_type='prepend'></emit> <emit emit_type='prepend'></emit>
</output> </output>
<output filename="grit/preinstalled_web_apps_resources_map.cc"
type="resource_file_map_source" />
<output filename="grit/preinstalled_web_apps_resources_map.h"
type="resource_map_header" />
<output filename="preinstalled_web_apps_resources.pak" type="data_package" /> <output filename="preinstalled_web_apps_resources.pak" type="data_package" />
</outputs> </outputs>
<release seq="1"> <release seq="1">
<includes> <includes>
<include name="IDR_PREINSTALLED_WEB_APPS_GOOGLE_DOCS_ICON_192_PNG" file="internal/google_docs_192.png" type="BINDATA" />
<include name="IDR_PREINSTALLED_WEB_APPS_GOOGLE_DRIVE_ICON_192_PNG" file="internal/google_drive_192.png" type="BINDATA" />
<include name="IDR_PREINSTALLED_WEB_APPS_GOOGLE_SHEETS_ICON_192_PNG" file="internal/google_sheets_192.png" type="BINDATA" />
<include name="IDR_PREINSTALLED_WEB_APPS_GOOGLE_SLIDES_ICON_192_PNG" file="internal/google_slides_192.png" type="BINDATA" />
<include name="IDR_PREINSTALLED_WEB_APPS_GMAIL_ICON_192_PNG" file="internal/gmail_192.png" type="BINDATA" />
<include name="IDR_PREINSTALLED_WEB_APPS_YOUTUBE_ICON_192_PNG" file="internal/youtube_192.png" type="BINDATA" />
</includes> </includes>
</release> </release>
</grit> </grit>
...@@ -24,8 +24,12 @@ ...@@ -24,8 +24,12 @@
#include "content/public/test/test_launcher.h" #include "content/public/test/test_launcher.h"
#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry.h"
#include "extensions/browser/test_extension_registry_observer.h" #include "extensions/browser/test_extension_registry_observer.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
using ::testing::Pair;
using ::testing::UnorderedElementsAre;
namespace web_app { namespace web_app {
class ExternalWebAppManagerBrowserTest class ExternalWebAppManagerBrowserTest
...@@ -490,9 +494,6 @@ IN_PROC_BROWSER_TEST_F(ExternalWebAppManagerBrowserTest, PreinstalledWebApps) { ...@@ -490,9 +494,6 @@ IN_PROC_BROWSER_TEST_F(ExternalWebAppManagerBrowserTest, PreinstalledWebApps) {
base::AutoReset<bool> scope = base::AutoReset<bool> scope =
SetExternalAppInstallFeatureAlwaysEnabledForTesting(); SetExternalAppInstallFeatureAlwaysEnabledForTesting();
constexpr std::array<const char*, 1> kExpectedInstallUrls = {
"https://docs.google.com/document/installwebapp?usp=chrome_default",
};
base::RunLoop run_loop; base::RunLoop run_loop;
WebAppProvider::Get(browser()->profile()) WebAppProvider::Get(browser()->profile())
...@@ -500,12 +501,27 @@ IN_PROC_BROWSER_TEST_F(ExternalWebAppManagerBrowserTest, PreinstalledWebApps) { ...@@ -500,12 +501,27 @@ IN_PROC_BROWSER_TEST_F(ExternalWebAppManagerBrowserTest, PreinstalledWebApps) {
.LoadAndSynchronizeForTesting(base::BindLambdaForTesting( .LoadAndSynchronizeForTesting(base::BindLambdaForTesting(
[&](std::map<GURL, InstallResultCode> install_results, [&](std::map<GURL, InstallResultCode> install_results,
std::map<GURL, bool> uninstall_results) { std::map<GURL, bool> uninstall_results) {
EXPECT_EQ(install_results.size(), kExpectedInstallUrls.size()); EXPECT_THAT(
for (const char* install_url : kExpectedInstallUrls) { install_results,
EXPECT_TRUE(base::Contains(install_results, GURL(install_url))) UnorderedElementsAre(
<< install_url; Pair(GURL("https://docs.google.com/document/"
} "installwebapp?usp=chrome_default"),
InstallResultCode::kSuccessOfflineOnlyInstall),
Pair(GURL("https://docs.google.com/presentation/"
"installwebapp?usp=chrome_default"),
InstallResultCode::kSuccessOfflineOnlyInstall),
Pair(GURL("https://docs.google.com/spreadsheets/"
"installwebapp?usp=chrome_default"),
InstallResultCode::kSuccessOfflineOnlyInstall),
Pair(GURL("https://drive.google.com/drive/"
"installwebapp?usp=chrome_default"),
InstallResultCode::kSuccessOfflineOnlyInstall),
Pair(GURL("https://mail.google.com/mail/"
"installwebapp?usp=chrome_default"),
InstallResultCode::kSuccessOfflineOnlyInstall),
Pair(GURL("https://www.youtube.com/s/notifications/"
"manifest/cr_install.html"),
InstallResultCode::kSuccessOfflineOnlyInstall)));
EXPECT_EQ(uninstall_results.size(), 0u); EXPECT_EQ(uninstall_results.size(), 0u);
run_loop.Quit(); run_loop.Quit();
})); }));
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/browser/buildflags.gni")
source_set("preinstalled_web_apps") { source_set("preinstalled_web_apps") {
sources = [ sources = [
"google_docs.cc",
"google_docs.h",
"preinstalled_web_app_utils.cc", "preinstalled_web_app_utils.cc",
"preinstalled_web_app_utils.h", "preinstalled_web_app_utils.h",
"preinstalled_web_apps.cc", "preinstalled_web_apps.cc",
...@@ -13,9 +13,29 @@ source_set("preinstalled_web_apps") { ...@@ -13,9 +13,29 @@ source_set("preinstalled_web_apps") {
] ]
deps = [ deps = [
"//base",
"//build:branding_buildflags", "//build:branding_buildflags",
"//chrome/browser/resources:preinstalled_web_apps_resources",
"//chrome/browser/web_applications/components", "//chrome/browser/web_applications/components",
"//chrome/common", "//skia",
"//ui/base",
] ]
if (is_chrome_branded) {
sources += [
"gmail.cc",
"gmail.h",
"google_docs.cc",
"google_docs.h",
"google_drive.cc",
"google_drive.h",
"google_sheets.cc",
"google_sheets.h",
"google_slides.cc",
"google_slides.h",
"youtube.cc",
"youtube.h",
]
deps += [ "//chrome/browser/resources:preinstalled_web_apps_resources" ]
}
} }
// 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/web_applications/preinstalled_web_apps/gmail.h"
#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/web_applications/components/external_app_install_features.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_app_utils.h"
#include "chrome/grit/preinstalled_web_apps_resources.h"
namespace web_app {
ExternalInstallOptions GetConfigForGmail() {
ExternalInstallOptions options(
/*install_url=*/GURL(
"https://mail.google.com/mail/installwebapp?usp=chrome_default"),
/*user_display_mode=*/DisplayMode::kBrowser,
/*install_source=*/ExternalInstallSource::kExternalDefault);
options.user_type_allowlist = {"unmanaged", "managed", "child"};
options.gate_on_feature = kMigrateDefaultChromeAppToWebAppsGSuite.name;
options.uninstall_and_replace.push_back("pjkljhegncpnkpknbcohdijeoejaedia");
options.load_and_await_service_worker_registration = false;
options.only_use_app_info_factory = true;
options.app_info_factory = base::BindRepeating([]() {
auto info = std::make_unique<WebApplicationInfo>();
info->title = base::UTF8ToUTF16("Gmail");
info->start_url = GURL("https://mail.google.com/?usp=installed_webapp");
info->scope = GURL("https://mail.google.com/");
info->display_mode = DisplayMode::kBrowser;
info->icon_bitmaps_any =
LoadBundledIcons({IDR_PREINSTALLED_WEB_APPS_GMAIL_ICON_192_PNG});
return info;
});
return options;
}
} // namespace web_app
// 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_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GMAIL_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GMAIL_H_
#include "chrome/browser/web_applications/components/external_install_options.h"
namespace web_app {
ExternalInstallOptions GetConfigForGmail();
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GMAIL_H_
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/web_applications/components/external_app_install_features.h"
#include "chrome/browser/web_applications/components/web_application_info.h" #include "chrome/browser/web_applications/components/web_application_info.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_app_utils.h" #include "chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_app_utils.h"
#include "chrome/grit/preinstalled_web_apps_resources.h" #include "chrome/grit/preinstalled_web_apps_resources.h"
...@@ -20,14 +21,10 @@ ExternalInstallOptions GetConfigForGoogleDocs() { ...@@ -20,14 +21,10 @@ ExternalInstallOptions GetConfigForGoogleDocs() {
/*install_source=*/ExternalInstallSource::kExternalDefault); /*install_source=*/ExternalInstallSource::kExternalDefault);
options.user_type_allowlist = {"unmanaged", "managed", "child"}; options.user_type_allowlist = {"unmanaged", "managed", "child"};
options.gate_on_feature = "MigrateDefaultChromeAppToWebAppsGSuite"; options.gate_on_feature = kMigrateDefaultChromeAppToWebAppsGSuite.name;
options.uninstall_and_replace.push_back("aohghmighlieiainnegkcijnfilokake"); options.uninstall_and_replace.push_back("aohghmighlieiainnegkcijnfilokake");
options.load_and_await_service_worker_registration = false; options.load_and_await_service_worker_registration = false;
#if !defined(OS_CHROMEOS)
options.only_use_app_info_factory = true; options.only_use_app_info_factory = true;
#endif // !defined(OS_CHROMEOS)
options.app_info_factory = base::BindRepeating([]() { options.app_info_factory = base::BindRepeating([]() {
auto info = std::make_unique<WebApplicationInfo>(); auto info = std::make_unique<WebApplicationInfo>();
info->title = base::UTF8ToUTF16("Docs"); info->title = base::UTF8ToUTF16("Docs");
...@@ -35,7 +32,8 @@ ExternalInstallOptions GetConfigForGoogleDocs() { ...@@ -35,7 +32,8 @@ ExternalInstallOptions GetConfigForGoogleDocs() {
GURL("https://docs.google.com/document/?usp=installed_webapp"); GURL("https://docs.google.com/document/?usp=installed_webapp");
info->scope = GURL("https://docs.google.com/document/"); info->scope = GURL("https://docs.google.com/document/");
info->display_mode = DisplayMode::kBrowser; info->display_mode = DisplayMode::kBrowser;
// TODO(crbug.com/1147692): Use Google Docs icon. info->icon_bitmaps_any =
LoadBundledIcons({IDR_PREINSTALLED_WEB_APPS_GOOGLE_DOCS_ICON_192_PNG});
return info; 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.
#include "chrome/browser/web_applications/preinstalled_web_apps/google_drive.h"
#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/web_applications/components/external_app_install_features.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_app_utils.h"
#include "chrome/grit/preinstalled_web_apps_resources.h"
namespace web_app {
ExternalInstallOptions GetConfigForGoogleDrive() {
ExternalInstallOptions options(
/*install_url=*/GURL(
"https://drive.google.com/drive/installwebapp?usp=chrome_default"),
/*user_display_mode=*/DisplayMode::kBrowser,
/*install_source=*/ExternalInstallSource::kExternalDefault);
options.user_type_allowlist = {"unmanaged", "managed", "child"};
options.gate_on_feature = kMigrateDefaultChromeAppToWebAppsGSuite.name;
options.uninstall_and_replace.push_back("apdfllckaahabafndbhieahigkjlhalf");
options.load_and_await_service_worker_registration = false;
options.only_use_app_info_factory = true;
options.app_info_factory = base::BindRepeating([]() {
auto info = std::make_unique<WebApplicationInfo>();
info->title = base::UTF8ToUTF16("Google Drive");
info->start_url =
GURL("https://drive.google.com/?usp=installed_webapp&lfhs=2");
info->scope = GURL("https://drive.google.com/");
info->display_mode = DisplayMode::kStandalone;
info->icon_bitmaps_any =
LoadBundledIcons({IDR_PREINSTALLED_WEB_APPS_GOOGLE_DRIVE_ICON_192_PNG});
return info;
});
return options;
}
} // namespace web_app
// 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_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_DRIVE_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_DRIVE_H_
#include "chrome/browser/web_applications/components/external_install_options.h"
namespace web_app {
ExternalInstallOptions GetConfigForGoogleDrive();
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_DRIVE_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/web_applications/preinstalled_web_apps/google_sheets.h"
#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/web_applications/components/external_app_install_features.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_app_utils.h"
#include "chrome/grit/preinstalled_web_apps_resources.h"
namespace web_app {
ExternalInstallOptions GetConfigForGoogleSheets() {
ExternalInstallOptions options(
/*install_url=*/GURL("https://docs.google.com/spreadsheets/"
"installwebapp?usp=chrome_default"),
/*user_display_mode=*/DisplayMode::kBrowser,
/*install_source=*/ExternalInstallSource::kExternalDefault);
options.user_type_allowlist = {"unmanaged", "managed", "child"};
options.gate_on_feature = kMigrateDefaultChromeAppToWebAppsGSuite.name;
options.uninstall_and_replace.push_back("felcaaldnbdncclmgdcncolpebgiejap");
options.load_and_await_service_worker_registration = false;
options.only_use_app_info_factory = true;
options.app_info_factory = base::BindRepeating([]() {
auto info = std::make_unique<WebApplicationInfo>();
info->title = base::UTF8ToUTF16("Sheets");
info->start_url =
GURL("https://docs.google.com/spreadsheets/?usp=installed_webapp");
info->scope = GURL("https://docs.google.com/spreadsheets/");
info->display_mode = DisplayMode::kBrowser;
info->icon_bitmaps_any = LoadBundledIcons(
{IDR_PREINSTALLED_WEB_APPS_GOOGLE_SHEETS_ICON_192_PNG});
return info;
});
return options;
}
} // namespace web_app
// 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_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_SHEETS_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_SHEETS_H_
#include "chrome/browser/web_applications/components/external_install_options.h"
namespace web_app {
ExternalInstallOptions GetConfigForGoogleSheets();
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_SHEETS_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/web_applications/preinstalled_web_apps/google_slides.h"
#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/web_applications/components/external_app_install_features.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_app_utils.h"
#include "chrome/grit/preinstalled_web_apps_resources.h"
namespace web_app {
ExternalInstallOptions GetConfigForGoogleSlides() {
ExternalInstallOptions options(
/*install_url=*/GURL("https://docs.google.com/presentation/"
"installwebapp?usp=chrome_default"),
/*user_display_mode=*/DisplayMode::kBrowser,
/*install_source=*/ExternalInstallSource::kExternalDefault);
options.user_type_allowlist = {"unmanaged", "managed", "child"};
options.gate_on_feature = kMigrateDefaultChromeAppToWebAppsGSuite.name;
options.uninstall_and_replace.push_back("aapocclcgogkmnckokdopfmhonfmgoek");
options.load_and_await_service_worker_registration = false;
options.only_use_app_info_factory = true;
options.app_info_factory = base::BindRepeating([]() {
auto info = std::make_unique<WebApplicationInfo>();
info->title = base::UTF8ToUTF16("Slides");
info->start_url =
GURL("https://docs.google.com/presentation/?usp=installed_webapp");
info->scope = GURL("https://docs.google.com/presentation/");
info->display_mode = DisplayMode::kBrowser;
info->icon_bitmaps_any = LoadBundledIcons(
{IDR_PREINSTALLED_WEB_APPS_GOOGLE_SLIDES_ICON_192_PNG});
return info;
});
return options;
}
} // namespace web_app
// 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_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_SLIDES_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_SLIDES_H_
#include "chrome/browser/web_applications/components/external_install_options.h"
namespace web_app {
ExternalInstallOptions GetConfigForGoogleSlides();
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_GOOGLE_SLIDES_H_
...@@ -8,7 +8,15 @@ ...@@ -8,7 +8,15 @@
#include "build/branding_buildflags.h" #include "build/branding_buildflags.h"
#include "chrome/browser/web_applications/components/external_app_install_features.h" #include "chrome/browser/web_applications/components/external_app_install_features.h"
#include "chrome/browser/web_applications/components/web_app_constants.h" #include "chrome/browser/web_applications/components/web_app_constants.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chrome/browser/web_applications/preinstalled_web_apps/gmail.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/google_docs.h" #include "chrome/browser/web_applications/preinstalled_web_apps/google_docs.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/google_drive.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/google_sheets.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/google_slides.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/youtube.h"
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
namespace web_app { namespace web_app {
namespace { namespace {
...@@ -20,10 +28,7 @@ std::vector<ExternalInstallOptions> GetPreinstalledAppData() { ...@@ -20,10 +28,7 @@ std::vector<ExternalInstallOptions> GetPreinstalledAppData() {
if (g_preinstalled_app_data_for_testing) if (g_preinstalled_app_data_for_testing)
return *g_preinstalled_app_data_for_testing; return *g_preinstalled_app_data_for_testing;
#if !BUILDFLAG(GOOGLE_CHROME_BRANDING) #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return {};
#endif
// TODO(crbug.com/1104692): Replace these C++ configs with JSON configs like // TODO(crbug.com/1104692): Replace these C++ configs with JSON configs like
// those seen in: chrome/test/data/web_app_default_apps/good_json // those seen in: chrome/test/data/web_app_default_apps/good_json
// This requires: // This requires:
...@@ -34,8 +39,18 @@ std::vector<ExternalInstallOptions> GetPreinstalledAppData() { ...@@ -34,8 +39,18 @@ std::vector<ExternalInstallOptions> GetPreinstalledAppData() {
// - Ensure that these resources are correctly installed by our Chrome // - Ensure that these resources are correctly installed by our Chrome
// installers on every desktop platform. // installers on every desktop platform.
return { return {
// clang-format off
GetConfigForGmail(),
GetConfigForGoogleDocs(), GetConfigForGoogleDocs(),
GetConfigForGoogleDrive(),
GetConfigForGoogleSheets(),
GetConfigForGoogleSlides(),
GetConfigForYouTube(),
// clang-format on
}; };
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
return {};
} }
} // namespace } // namespace
......
// 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/web_applications/preinstalled_web_apps/youtube.h"
#include "base/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/web_applications/components/external_app_install_features.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
#include "chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_app_utils.h"
#include "chrome/grit/preinstalled_web_apps_resources.h"
namespace web_app {
ExternalInstallOptions GetConfigForYouTube() {
ExternalInstallOptions options(
/*install_url=*/GURL(
"https://www.youtube.com/s/notifications/manifest/cr_install.html"),
/*user_display_mode=*/DisplayMode::kBrowser,
/*install_source=*/ExternalInstallSource::kExternalDefault);
options.user_type_allowlist = {"unmanaged", "managed"};
options.gate_on_feature = kMigrateDefaultChromeAppToWebAppsNonGSuite.name;
options.uninstall_and_replace.push_back("blpcfgokakmgnkcojhhkbfbldkacnbeo");
options.disable_if_tablet_form_factor = true;
options.load_and_await_service_worker_registration = false;
options.only_use_app_info_factory = true;
options.app_info_factory = base::BindRepeating([]() {
auto info = std::make_unique<WebApplicationInfo>();
info->title = base::UTF8ToUTF16("YouTube");
info->start_url = GURL("https://www.youtube.com/?feature=ytca");
info->scope = GURL("https://www.youtube.com/");
info->display_mode = DisplayMode::kMinimalUi;
info->icon_bitmaps_any =
LoadBundledIcons({IDR_PREINSTALLED_WEB_APPS_YOUTUBE_ICON_192_PNG});
return info;
});
return options;
}
} // namespace web_app
// 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_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_YOUTUBE_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_YOUTUBE_H_
#include "chrome/browser/web_applications/components/external_install_options.h"
namespace web_app {
ExternalInstallOptions GetConfigForYouTube();
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_PREINSTALLED_WEB_APPS_YOUTUBE_H_
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