0

iwa: Cleaning usage of kIsolatedWebApps

kIsolatedWebApps should not be used as IWAs may be enabled by enterprise
policy or by the flag. By checking just kIsolatedWebApps we don't allow
to use the IWA in Managed guest session.

AreIsolatedWebAppsEnabled() should be used in the browser process or
switches::kEnableIsolatedWebAppsInRenderer in a renderer process.

Bug: b/289356220
Change-Id: Ie5397d409e3679224ac1c4fa4bd9435e0404a18b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4701372
Reviewed-by: Chase Phillips <cmp@chromium.org>
Reviewed-by: Ovidio Ruiz-Henríquez <odejesush@chromium.org>
Commit-Queue: Oleksandr Peletskyi <peletskyi@google.com>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1173431}
This commit is contained in:
Oleksandr Peletskyi
2023-07-21 11:58:14 +00:00
committed by Chromium LUCI CQ
parent 0d035aa14e
commit a9cd440788
2 changed files with 6 additions and 2 deletions
chrome/browser/web_applications
extensions/renderer

@ -39,6 +39,7 @@
#include "chrome/browser/web_applications/web_app_translation_manager.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "chrome/common/chrome_features.h"
#include "content/public/browser/isolated_web_apps_policy.h"
#include "content/public/browser/storage_partition_config.h"
#include "content/public/common/content_features.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
@ -886,7 +887,7 @@ int WebAppRegistrar::CountUserInstalledNotLocallyInstalledApps() const {
std::vector<content::StoragePartitionConfig>
WebAppRegistrar::GetIsolatedWebAppStoragePartitionConfigs(
const AppId& isolated_web_app_id) const {
if (!base::FeatureList::IsEnabled(features::kIsolatedWebApps)) {
if (!content::IsolatedWebAppsPolicy::AreIsolatedWebAppsEnabled(profile_)) {
return {};
}

@ -4,15 +4,18 @@
#include "extensions/renderer/renderer_context_data.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "third_party/blink/public/web/blink.h"
namespace extensions {
// static
bool RendererContextData::IsIsolatedWebAppContextAndEnabled() {
return base::FeatureList::IsEnabled(features::kIsolatedWebApps) &&
return base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableIsolatedWebAppsInRenderer) &&
blink::IsIsolatedContext();
}