Commit fc25b1c0 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

Add feature for AppShimMultiProfile

Also rename the RemoteCocoa flag to be kAppShimRemoteCocoa. Scope this
flag to only control RemoteCocoa (the actual app shim is still created),
since that has been more helpful in debugging. Also disable the app
shim menu when RemoteCocoa is enabled.

Bug: 982024
Change-Id: I4a083d4aae892e05e942d5ca5f6252ccca44ca8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1775265
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693344}
parent 4adccecd
......@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "chrome/browser/apps/app_shim/app_shim_host_bootstrap_mac.h"
#include "chrome/browser/apps/app_shim/app_shim_host_mac.h"
#include "chrome/common/chrome_features.h"
#include "components/remote_cocoa/browser/application_host.h"
#include "components/remote_cocoa/common/application.mojom.h"
#include "content/public/browser/browser_thread.h"
......@@ -31,7 +32,8 @@ AppShimHost::AppShimHost(AppShimHost::Client* client,
launch_weak_factory_(this) {
// Create the interfaces used to host windows, so that browser windows may be
// created before the host process finishes launching.
if (uses_remote_views_) {
if (uses_remote_views_ &&
base::FeatureList::IsEnabled(features::kAppShimRemoteCocoa)) {
// Create the interface that will be used by views::NativeWidgetMac to
// create NSWindows hosted in the app shim process.
remote_cocoa::mojom::ApplicationAssociatedRequest views_application_request;
......
......@@ -41,7 +41,6 @@
#include "chrome/browser/web_applications/components/web_app_helpers.h"
#include "chrome/browser/web_applications/components/web_app_shortcut_mac.h"
#include "chrome/browser/web_applications/extensions/web_app_extension_shortcut.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_metrics.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
......@@ -59,7 +58,6 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/common/constants.h"
#include "ui/base/cocoa/focus_window_set.h"
#include "ui/base/ui_base_features.h"
using extensions::AppWindow;
using extensions::AppWindowRegistry;
......@@ -411,8 +409,6 @@ AppShimHost* ExtensionAppShimHandler::FindOrCreateHost(
}
AppShimHost* ExtensionAppShimHandler::GetHostForBrowser(Browser* browser) {
if (!features::HostWindowsInAppShimProcess())
return nullptr;
Profile* profile = Profile::FromBrowserContext(browser->profile());
const Extension* extension =
apps::ExtensionAppShimHandler::MaybeGetAppForBrowser(browser);
......
......@@ -415,7 +415,9 @@ extensions::AppWindowRegistry::AppWindowList GetAppWindowsForNSWindow(
id window = [notification object];
// Ignore is_browser: if a window becomes main that does not belong to an
// extension or browser, treat it the same as switching to a browser.
if (const Extension* extension = GetExtensionForNSWindow(window))
const Extension* extension = GetExtensionForNSWindow(window);
// Do not install the App menu for bookmark apps (which includes PWAs).
if (extension && !extension->from_bookmark())
[self appBecameMain:extension];
else
[self chromeBecameMain];
......
......@@ -34,6 +34,16 @@ const base::Feature kApkWebAppInstalls{"ApkWebAppInstalls",
#endif // defined(OS_CHROMEOS)
#if defined(OS_MACOSX)
// Enable the new multi-profile-aware app shim mode.
// TODO(https://crbug.com/982024): Delete this flag when feature is complete.
const base::Feature kAppShimMultiProfile{"AppShimMultiProfile",
base::FEATURE_DISABLED_BY_DEFAULT};
// Can be used to disable RemoteCocoa (hosting NSWindows for apps in the app
// process). For debugging purposes only.
const base::Feature kAppShimRemoteCocoa{"AppShimRemoteCocoa",
base::FEATURE_ENABLED_BY_DEFAULT};
// Enables the "this OS is obsolete" infobar on Mac 10.9.
// TODO(ellyjones): Remove this after the last 10.9 release.
const base::Feature kShow10_9ObsoleteInfobar{"Show109ObsoleteInfobar",
......
......@@ -37,6 +37,10 @@ extern const base::Feature kApkWebAppInstalls;
#if defined(OS_MACOSX)
COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kAppShimMultiProfile;
COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kAppShimRemoteCocoa;
COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kShow10_9ObsoleteInfobar;
COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kViewsTaskManager;
#endif // defined(OS_MACOSX)
......
......@@ -140,17 +140,6 @@ bool IsAutomaticUiAdjustmentsForTouchEnabled() {
#endif
}
#if defined(OS_MACOSX)
// When enabled, the NSWindows for apps will be created in the app's process,
// and will forward input to the browser process.
const base::Feature kHostWindowsInAppShimProcess{
"HostWindowsInAppShimProcess", base::FEATURE_ENABLED_BY_DEFAULT};
bool HostWindowsInAppShimProcess() {
return base::FeatureList::IsEnabled(kHostWindowsInAppShimProcess);
}
#endif // defined(OS_MACOSX)
const base::Feature kEnableOzoneDrmMojo = {"OzoneDrmMojo",
base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -75,15 +75,6 @@ COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsFormControlsRefreshEnabled();
COMPONENT_EXPORT(UI_BASE_FEATURES)
bool IsAutomaticUiAdjustmentsForTouchEnabled();
#if defined(OS_MACOSX)
COMPONENT_EXPORT(UI_BASE_FEATURES)
extern const base::Feature kHostWindowsInAppShimProcess;
// Returns true if the NSWindows for apps will be created in the app's process,
// and will forward input to the browser process.
COMPONENT_EXPORT(UI_BASE_FEATURES) bool HostWindowsInAppShimProcess();
#endif // defined(OS_MACOSX)
// Use mojo communication in the drm platform instead of paramtraits. Remove
// this switch (and associated code) when the drm platform always uses mojo
// communication.
......
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