Commit 2914df72 authored by sadrul's avatar sadrul Committed by Commit bot

views/mus: Fix showing menu in chrome in mus.

For menus in chrome-in-mus, we attempt to create a Widget hosted in a native
window. For desktop builds, this means we attempt to host in a HWND or an
X11 window created by DesktopNativeWidgetAura. But for mus, we want to use
NativeWidgetMus. To do this, use the native-widget factory first if it's
available.

BUG=none

Review URL: https://codereview.chromium.org/1460003004

Cr-Commit-Position: refs/heads/master@{#361151}
parent 8db59418
......@@ -75,6 +75,10 @@ namespace ui {
class WindowResizeHelperMac;
}
namespace views {
class WindowManagerConnection;
}
namespace base {
namespace android {
......@@ -220,6 +224,7 @@ class BASE_EXPORT ThreadRestrictions {
friend class ::NativeBackendKWallet; // http://crbug.com/125331
#if !defined(OFFICIAL_BUILD)
friend class content::SoftwareOutputDeviceMus; // Interim non-production code
friend class views::WindowManagerConnection;
#endif
// END USAGE THAT NEEDS TO BE FIXED.
......
......@@ -64,7 +64,6 @@
#include "chrome/browser/ui/ash/ash_util.h"
#endif
// Helpers --------------------------------------------------------------------
namespace {
......@@ -354,6 +353,11 @@ void ChromeViewsDelegate::OnBeforeWidgetInit(
}
}
#endif // OS_WIN
if (!use_non_toplevel_window && !native_widget_factory().is_null()) {
params->native_widget = native_widget_factory().Run(*params, delegate);
return;
}
#endif // USE_AURA
#if defined(OS_CHROMEOS)
......
......@@ -6,6 +6,7 @@
#include "base/lazy_instance.h"
#include "base/threading/thread_local.h"
#include "base/threading/thread_restrictions.h"
#include "components/mus/public/cpp/window_tree_connection.h"
#include "components/mus/public/interfaces/window_tree.mojom.h"
#include "mojo/application/public/cpp/application_connection.h"
......@@ -111,6 +112,8 @@ mus::Window* WindowManagerConnection::NewWindow(
window_manager_->OpenWindow(
window_tree_client.Pass(),
mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(properties));
base::ThreadRestrictions::ScopedAllowWait allow_wait;
mus::WindowTreeConnection* window_tree_connection =
mus::WindowTreeConnection::Create(
this, window_tree_client_request.Pass(),
......
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