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

Side by Side Diff: chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc

Issue 2027093002: mus: Initialize WindowManagerConnection in chrome instead of in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" 5 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h"
6 6
7 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" 7 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
8 #include "chrome/browser/ui/views/chrome_views_delegate.h" 8 #include "chrome/browser/ui/views/chrome_views_delegate.h"
9 #include "components/constrained_window/constrained_window_views.h" 9 #include "components/constrained_window/constrained_window_views.h"
10 10
11 #if defined(USE_AURA) 11 #if defined(USE_AURA)
12 #include "ui/display/screen.h" 12 #include "ui/display/screen.h"
13 #include "ui/views/widget/desktop_aura/desktop_screen.h" 13 #include "ui/views/widget/desktop_aura/desktop_screen.h"
14 #include "ui/wm/core/wm_state.h" 14 #include "ui/wm/core/wm_state.h"
15 #endif 15 #endif
16 16
17 #if defined(USE_AURA) && defined(MOJO_SHELL_CLIENT)
18 #include "content/public/common/mojo_shell_connection.h"
19 #include "ui/views/mus/window_manager_connection.h"
20 #endif
21
17 ChromeBrowserMainExtraPartsViews::ChromeBrowserMainExtraPartsViews() { 22 ChromeBrowserMainExtraPartsViews::ChromeBrowserMainExtraPartsViews() {
18 } 23 }
19 24
20 ChromeBrowserMainExtraPartsViews::~ChromeBrowserMainExtraPartsViews() { 25 ChromeBrowserMainExtraPartsViews::~ChromeBrowserMainExtraPartsViews() {
21 constrained_window::SetConstrainedWindowViewsClient(nullptr); 26 constrained_window::SetConstrainedWindowViewsClient(nullptr);
22 } 27 }
23 28
24 void ChromeBrowserMainExtraPartsViews::ToolkitInitialized() { 29 void ChromeBrowserMainExtraPartsViews::ToolkitInitialized() {
25 // The delegate needs to be set before any UI is created so that windows 30 // The delegate needs to be set before any UI is created so that windows
26 // display the correct icon. 31 // display the correct icon.
27 if (!views::ViewsDelegate::GetInstance()) 32 if (!views::ViewsDelegate::GetInstance())
28 views_delegate_.reset(new ChromeViewsDelegate); 33 views_delegate_.reset(new ChromeViewsDelegate);
29 34
30 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); 35 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient());
31 36
32 #if defined(USE_AURA) 37 #if defined(USE_AURA)
33 wm_state_.reset(new wm::WMState); 38 wm_state_.reset(new wm::WMState);
34 #endif 39 #endif
35 } 40 }
36 41
37 void ChromeBrowserMainExtraPartsViews::PreCreateThreads() { 42 void ChromeBrowserMainExtraPartsViews::PreCreateThreads() {
38 #if defined(USE_AURA) && !defined(OS_CHROMEOS) 43 #if defined(USE_AURA) && !defined(OS_CHROMEOS)
39 display::Screen::SetScreenInstance(views::CreateDesktopScreen()); 44 display::Screen::SetScreenInstance(views::CreateDesktopScreen());
40 #endif 45 #endif
41 } 46 }
47
48 void ChromeBrowserMainExtraPartsViews::PreProfileInit() {
49 #if defined(USE_AURA) && defined(MOJO_SHELL_CLIENT)
50 content::MojoShellConnection* mojo_shell_connection =
51 content::MojoShellConnection::Get();
52 if (mojo_shell_connection && mojo_shell_connection->UsingExternalShell()) {
53 views::WindowManagerConnection::Create(
54 mojo_shell_connection->GetConnector(),
55 mojo_shell_connection->GetIdentity());
56 }
57 #endif
58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698