Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2275)

Unified Diff: ash/mus/sysui_application.cc

Issue 1679023007: ash/mash: Make sure the right context-factory is used for the views::Widgets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698