Commit 0741e800 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

Add a feature flag to create app windows in the AppShim process

This feature is to allow the creation of NSWindows in the app shim
process instead of the Chrome browser process.

AppShim instances will inherit the behavior of whatever Chrome
instance they attach to.

If the Chrome instance has this feature enabled, then it will send
messages to the AppShim telling it to establish connections to
create windows.

Bug: 821651
Change-Id: Ieaef0f8c61fc93e6c187a8c5e4e21c9ff2a740eb
Reviewed-on: https://chromium-review.googlesource.com/965268
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543856}
parent b8e7c2d9
......@@ -43,6 +43,7 @@
#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;
......@@ -98,6 +99,11 @@ bool FocusHostedAppWindows(std::set<Browser*>& browsers) {
if (browsers.empty())
return false;
// If the NSWindows for the app are in the app shim process, then don't steal
// focus from the app shim.
if (features::HostWindowsInAppShimProcess())
return true;
std::set<gfx::NativeWindow> native_windows;
for (const Browser* browser : browsers)
native_windows.insert(browser->window()->GetNativeWindow());
......
......@@ -76,7 +76,17 @@ bool IsMusEnabled() {
#endif
}
#if defined(OS_MACOSX) && BUILDFLAG(MAC_VIEWS_BROWSER)
#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_DISABLED_BY_DEFAULT};
bool HostWindowsInAppShimProcess() {
return base::FeatureList::IsEnabled(kHostWindowsInAppShimProcess);
}
#if BUILDFLAG(MAC_VIEWS_BROWSER)
// Causes Views browser builds to use Views browser windows by default rather
// than Cocoa browser windows.
const base::Feature kViewsBrowserWindows{"ViewsBrowserWindows",
......@@ -87,6 +97,7 @@ const base::Feature kViewsBrowserWindows{"ViewsBrowserWindows",
bool IsViewsBrowserCocoa() {
return !base::FeatureList::IsEnabled(kViewsBrowserWindows);
}
#endif // defined(OS_MACOSX) && BUILDFLAG(MAC_VIEWS_BROWSER)
#endif // BUILDFLAG(MAC_VIEWS_BROWSER)
#endif // defined(OS_MACOSX)
} // namespace features
......@@ -41,13 +41,19 @@ UI_BASE_EXPORT extern const base::Feature kMus;
// TODO(sky): rename this to IsWindowServiceEnabled().
UI_BASE_EXPORT bool IsMusEnabled();
#if defined(OS_MACOSX) && BUILDFLAG(MAC_VIEWS_BROWSER)
#if defined(OS_MACOSX)
// Returns true if the NSWindows for apps will be created in the app's process,
// and will forward input to the browser process.
UI_BASE_EXPORT bool HostWindowsInAppShimProcess();
#if BUILDFLAG(MAC_VIEWS_BROWSER)
UI_BASE_EXPORT extern const base::Feature kViewsBrowserWindows;
// Returns whether a Views-capable browser build should use the Cocoa browser
// UI.
UI_BASE_EXPORT bool IsViewsBrowserCocoa();
#endif // defined(OS_MACOSX) && BUILDFLAG(MAC_VIEWS_BROWSER)
#endif // BUILDFLAG(MAC_VIEWS_BROWSER)
#endif // defined(OS_MACOSX)
} // namespace features
......
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