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/+/2525886
Reviewed-by: calamity <[email protected]>
Reviewed-by: Devlin <[email protected]>
Reviewed-by: Glen Robertson <[email protected]>
Commit-Queue: Alan Cutter <[email protected]>
Cr-Commit-Position: refs/heads/master@{#827716}
diff --git a/chrome/browser/resources/BUILD.gn b/chrome/browser/resources/BUILD.gn
index e14877f4..3f71c2a 100644
--- a/chrome/browser/resources/BUILD.gn
+++ b/chrome/browser/resources/BUILD.gn
@@ -185,14 +185,18 @@
output_dir = "$root_gen_dir/chrome"
}
- grit("preinstalled_web_apps_resources") {
- source = "preinstalled_web_apps/resources.grd"
- defines = chrome_grit_defines
- outputs = [
- "grit/preinstalled_web_apps_resources.h",
- "preinstalled_web_apps_resources.pak",
- ]
- output_dir = "$root_gen_dir/chrome"
+ if (is_chrome_branded) {
+ grit("preinstalled_web_apps_resources") {
+ source = "preinstalled_web_apps/resources.grd"
+ defines = chrome_grit_defines
+ outputs = [
+ "grit/preinstalled_web_apps_resources.h",
+ "grit/preinstalled_web_apps_resources_map.cc",
+ "grit/preinstalled_web_apps_resources_map.h",
+ "preinstalled_web_apps_resources.pak",
+ ]
+ output_dir = "$root_gen_dir/chrome"
+ }
}
}
diff --git a/chrome/browser/resources/default_apps/external_extensions.json b/chrome/browser/resources/default_apps/external_extensions.json
index 15f137a..baffd91 100644
--- a/chrome/browser/resources/default_apps/external_extensions.json
+++ b/chrome/browser/resources/default_apps/external_extensions.json
@@ -7,15 +7,18 @@
{
"blpcfgokakmgnkcojhhkbfbldkacnbeo" : {
"external_crx": "youtube.crx",
- "external_version": "4.2.5"
+ "external_version": "4.2.5",
+ "web_app_migration_flag": "MigrateDefaultChromeAppToWebAppsNonGSuite"
},
"pjkljhegncpnkpknbcohdijeoejaedia" : {
"external_crx": "gmail.crx",
- "external_version": "7"
+ "external_version": "7",
+ "web_app_migration_flag": "MigrateDefaultChromeAppToWebAppsGSuite"
},
"apdfllckaahabafndbhieahigkjlhalf" : {
"external_crx": "drive.crx",
- "external_version": "6.2"
+ "external_version": "6.2",
+ "web_app_migration_flag": "MigrateDefaultChromeAppToWebAppsGSuite"
},
"aohghmighlieiainnegkcijnfilokake" : {
"external_crx": "docs.crx",
@@ -24,11 +27,13 @@
},
// Google Sheets
"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
"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
"ghbmnnjooekpmoecnnnilnnbdlolhkhi" : {
diff --git a/chrome/browser/resources/preinstalled_web_apps/resources.grd b/chrome/browser/resources/preinstalled_web_apps/resources.grd
index 23a0b65..d595e961 100644
--- a/chrome/browser/resources/preinstalled_web_apps/resources.grd
+++ b/chrome/browser/resources/preinstalled_web_apps/resources.grd
@@ -4,10 +4,20 @@
<output filename="grit/preinstalled_web_apps_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</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" />
</outputs>
<release seq="1">
<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>
</release>
</grit>
diff --git a/chrome/browser/web_applications/external_web_app_manager_browsertest.cc b/chrome/browser/web_applications/external_web_app_manager_browsertest.cc
index 87906d9a..1ada9264 100644
--- a/chrome/browser/web_applications/external_web_app_manager_browsertest.cc
+++ b/chrome/browser/web_applications/external_web_app_manager_browsertest.cc
@@ -24,8 +24,12 @@
#include "content/public/test/test_launcher.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/test_extension_registry_observer.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+using ::testing::Pair;
+using ::testing::UnorderedElementsAre;
+
namespace web_app {
class ExternalWebAppManagerBrowserTest
@@ -490,9 +494,6 @@
base::AutoReset<bool> scope =
SetExternalAppInstallFeatureAlwaysEnabledForTesting();
- constexpr std::array<const char*, 1> kExpectedInstallUrls = {
- "https://docs.google.com/document/installwebapp?usp=chrome_default",
- };
base::RunLoop run_loop;
WebAppProvider::Get(browser()->profile())
@@ -500,12 +501,27 @@
.LoadAndSynchronizeForTesting(base::BindLambdaForTesting(
[&](std::map<GURL, InstallResultCode> install_results,
std::map<GURL, bool> uninstall_results) {
- EXPECT_EQ(install_results.size(), kExpectedInstallUrls.size());
- for (const char* install_url : kExpectedInstallUrls) {
- EXPECT_TRUE(base::Contains(install_results, GURL(install_url)))
- << install_url;
- }
-
+ EXPECT_THAT(
+ install_results,
+ UnorderedElementsAre(
+ 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);
run_loop.Quit();
}));
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/BUILD.gn b/chrome/browser/web_applications/preinstalled_web_apps/BUILD.gn
index 5914a814..afcd815 100644
--- a/chrome/browser/web_applications/preinstalled_web_apps/BUILD.gn
+++ b/chrome/browser/web_applications/preinstalled_web_apps/BUILD.gn
@@ -2,10 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//chrome/browser/buildflags.gni")
+
source_set("preinstalled_web_apps") {
sources = [
- "google_docs.cc",
- "google_docs.h",
"preinstalled_web_app_utils.cc",
"preinstalled_web_app_utils.h",
"preinstalled_web_apps.cc",
@@ -13,9 +13,29 @@
]
deps = [
+ "//base",
"//build:branding_buildflags",
- "//chrome/browser/resources:preinstalled_web_apps_resources",
"//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" ]
+ }
}
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/gmail.cc b/chrome/browser/web_applications/preinstalled_web_apps/gmail.cc
new file mode 100644
index 0000000..eb584d84
--- /dev/null
+++ b/chrome/browser/web_applications/preinstalled_web_apps/gmail.cc
@@ -0,0 +1,42 @@
+// 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
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/gmail.h b/chrome/browser/web_applications/preinstalled_web_apps/gmail.h
new file mode 100644
index 0000000..d2e07b5
--- /dev/null
+++ b/chrome/browser/web_applications/preinstalled_web_apps/gmail.h
@@ -0,0 +1,16 @@
+// 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_
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/google_docs.cc b/chrome/browser/web_applications/preinstalled_web_apps/google_docs.cc
index 89cb4e81..c27ad1f 100644
--- a/chrome/browser/web_applications/preinstalled_web_apps/google_docs.cc
+++ b/chrome/browser/web_applications/preinstalled_web_apps/google_docs.cc
@@ -6,6 +6,7 @@
#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"
@@ -20,14 +21,10 @@
/*install_source=*/ExternalInstallSource::kExternalDefault);
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.load_and_await_service_worker_registration = false;
-
-#if !defined(OS_CHROMEOS)
options.only_use_app_info_factory = true;
-#endif // !defined(OS_CHROMEOS)
-
options.app_info_factory = base::BindRepeating([]() {
auto info = std::make_unique<WebApplicationInfo>();
info->title = base::UTF8ToUTF16("Docs");
@@ -35,7 +32,8 @@
GURL("https://docs.google.com/document/?usp=installed_webapp");
info->scope = GURL("https://docs.google.com/document/");
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;
});
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/google_drive.cc b/chrome/browser/web_applications/preinstalled_web_apps/google_drive.cc
new file mode 100644
index 0000000..6f32a63
--- /dev/null
+++ b/chrome/browser/web_applications/preinstalled_web_apps/google_drive.cc
@@ -0,0 +1,43 @@
+// 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
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/google_drive.h b/chrome/browser/web_applications/preinstalled_web_apps/google_drive.h
new file mode 100644
index 0000000..061ffe5
--- /dev/null
+++ b/chrome/browser/web_applications/preinstalled_web_apps/google_drive.h
@@ -0,0 +1,16 @@
+// 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_
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/google_sheets.cc b/chrome/browser/web_applications/preinstalled_web_apps/google_sheets.cc
new file mode 100644
index 0000000..92879d2
--- /dev/null
+++ b/chrome/browser/web_applications/preinstalled_web_apps/google_sheets.cc
@@ -0,0 +1,43 @@
+// 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
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/google_sheets.h b/chrome/browser/web_applications/preinstalled_web_apps/google_sheets.h
new file mode 100644
index 0000000..cda218e
--- /dev/null
+++ b/chrome/browser/web_applications/preinstalled_web_apps/google_sheets.h
@@ -0,0 +1,16 @@
+// 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_
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/google_slides.cc b/chrome/browser/web_applications/preinstalled_web_apps/google_slides.cc
new file mode 100644
index 0000000..da766d8
--- /dev/null
+++ b/chrome/browser/web_applications/preinstalled_web_apps/google_slides.cc
@@ -0,0 +1,43 @@
+// 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
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/google_slides.h b/chrome/browser/web_applications/preinstalled_web_apps/google_slides.h
new file mode 100644
index 0000000..eb058436
--- /dev/null
+++ b/chrome/browser/web_applications/preinstalled_web_apps/google_slides.h
@@ -0,0 +1,16 @@
+// 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_
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc b/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc
index 97e2267..5cb02b14 100644
--- a/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc
+++ b/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc
@@ -8,7 +8,15 @@
#include "build/branding_buildflags.h"
#include "chrome/browser/web_applications/components/external_app_install_features.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_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 {
@@ -20,10 +28,7 @@
if (g_preinstalled_app_data_for_testing)
return *g_preinstalled_app_data_for_testing;
-#if !BUILDFLAG(GOOGLE_CHROME_BRANDING)
- return {};
-#endif
-
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// TODO(crbug.com/1104692): Replace these C++ configs with JSON configs like
// those seen in: chrome/test/data/web_app_default_apps/good_json
// This requires:
@@ -34,8 +39,18 @@
// - Ensure that these resources are correctly installed by our Chrome
// installers on every desktop platform.
return {
+ // clang-format off
+ GetConfigForGmail(),
GetConfigForGoogleDocs(),
+ GetConfigForGoogleDrive(),
+ GetConfigForGoogleSheets(),
+ GetConfigForGoogleSlides(),
+ GetConfigForYouTube(),
+ // clang-format on
};
+#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
+
+ return {};
}
} // namespace
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/youtube.cc b/chrome/browser/web_applications/preinstalled_web_apps/youtube.cc
new file mode 100644
index 0000000..ac979b18
--- /dev/null
+++ b/chrome/browser/web_applications/preinstalled_web_apps/youtube.cc
@@ -0,0 +1,43 @@
+// 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
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/youtube.h b/chrome/browser/web_applications/preinstalled_web_apps/youtube.h
new file mode 100644
index 0000000..f9d725f
--- /dev/null
+++ b/chrome/browser/web_applications/preinstalled_web_apps/youtube.h
@@ -0,0 +1,16 @@
+// 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_