Index: chrome/browser/chrome_content_browser_client.cc |
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
index 4f0bf8e06a13e0812c4e0735fdfa0a73d1440560..86e97c4a1afe38a1b051110199bc2f93928be07e 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -246,6 +246,13 @@ |
#include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h" |
#endif |
+#if defined(USE_AURA) |
+#include "base/run_loop.h" |
+#include "content/public/common/mojo_shell_connection.h" |
+#include "services/shell/runner/common/client_util.h" |
+#include "ui/views/mus/window_manager_connection.h" |
+#endif |
+ |
#if defined(USE_ASH) |
#include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" |
#endif |
@@ -767,6 +774,10 @@ ChromeContentBrowserClient::ChromeContentBrowserClient() |
} |
ChromeContentBrowserClient::~ChromeContentBrowserClient() { |
+ // Attempting to destroy the WindowManagerConnection here results in a crash, |
+ // since the thread is shutting down and the AtExitManager is running the tear |
+ // down callbacks. So let it leak. |
+ window_manager_connection_.release(); |
for (int i = static_cast<int>(extra_parts_.size()) - 1; i >= 0; --i) |
delete extra_parts_[i]; |
extra_parts_.clear(); |
@@ -2857,6 +2868,19 @@ void ChromeContentBrowserClient::RegisterOutOfProcessMojoApplications( |
apps->insert(std::make_pair("mojo:media", |
base::ASCIIToUTF16("Media App"))); |
#endif |
+#if defined(USE_AURA) |
Ben Goodger (Google)
2016/08/05 23:01:21
this seems like a really arbitrary place to do thi
jam
2016/08/05 23:07:07
I was asking Sadrul if there are ways of doing thi
sadrul
2016/08/05 23:24:39
ChromeContentBrowserClient does create ChromeBrows
|
+ if (shell::ShellIsRemote()) { |
+ content::MojoShellConnection* connection = |
+ content::MojoShellConnection::GetForProcess(); |
+ // TODO(rockot): Remove the blocking wait for init. |
+ // http://crbug.com/594852. |
+ base::RunLoop wait_loop; |
+ connection->SetInitializeHandler(wait_loop.QuitClosure()); |
+ wait_loop.Run(); |
+ window_manager_connection_ = views::WindowManagerConnection::Create( |
+ connection->GetConnector(), connection->GetIdentity()); |
+ } |
+#endif |
} |
void ChromeContentBrowserClient::OpenURL( |