Chromium Code Reviews| Index: ash/mus/sysui_application.cc |
| diff --git a/ash/mus/sysui_application.cc b/ash/mus/sysui_application.cc |
| index 15339110cf731197f368915793d501dcf820dff9..094e8d19f83d97ddab61418c80d07ce3219ab115 100644 |
| --- a/ash/mus/sysui_application.cc |
| +++ b/ash/mus/sysui_application.cc |
| @@ -98,10 +98,24 @@ class NativeWidgetFactory { |
| static_cast<int32_t>(container)); |
| } |
| } |
| + |
| + // AshInit installs a stub implementation of ui::ContextFactory, so that the |
| + // AshWindowTreeHost instances created do not actually show anything to the |
| + // user. However, when creating a views::Widget instance, the |
| + // WindowManagerConnection creates a WindowTreeHostMus instance, which |
| + // creates a ui::Compositor, and it needs a real ui::ContextFactory |
| + // implementation. So, unset the context-factory here temporarily when |
| + // creating NativeWidgetMus. But restore the stub instance afterwards, so |
| + // that it is used when new AshWindowTreeHost instances are created (e.g. |
| + // when a new monitor is attached). |
| + ui::ContextFactory* factory = aura::Env::GetInstance()->context_factory(); |
| + aura::Env::GetInstance()->set_context_factory(nullptr); |
| views::NativeWidgetMus* native_widget = |
|
sky
2016/02/10 17:27:43
I think this code (and NativeWidgetMus too) shows
sadrul
2016/02/10 17:29:35
Agree. I started looking at that, but decided to u
|
| static_cast<views::NativeWidgetMus*>( |
| views::WindowManagerConnection::Get()->CreateNativeWidgetMus( |
| properties, params, delegate)); |
| + aura::Env::GetInstance()->set_context_factory(factory); |
| + |
| // TODO: Set the correct display id here. |
| InitRootWindowSettings(native_widget->GetRootWindow())->display_id = |
| Shell::GetInstance() |
| @@ -157,9 +171,6 @@ class AshInit { |
| ash::Shell::GetInstance()->CreateShelf(); |
| ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( |
| ash::user::LOGGED_IN_USER); |
| - // Reset the context factory, so that NativeWidgetMus installs the context |
| - // factory for the views::Widgets correctly. |
| - aura::Env::GetInstance()->set_context_factory(nullptr); |
| ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
| SetupWallpaper(SkColorSetARGB(255, 0, 255, 0)); |