OLD | NEW |
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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" | 10 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" |
11 #include "chrome/browser/ui/views/chrome_views_delegate.h" | 11 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
12 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 12 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
13 #include "chrome/browser/ui/views/ime_driver/ime_driver_mus.h" | 13 #include "chrome/browser/ui/views/ime_driver/ime_driver_mus.h" |
14 #include "components/constrained_window/constrained_window_views.h" | 14 #include "components/constrained_window/constrained_window_views.h" |
15 | 15 |
16 #if defined(USE_AURA) | 16 #if defined(USE_AURA) |
17 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 18 #include "components/ui_devtools/devtools_server.h" |
| 19 #include "components/ui_devtools/views/ui_devtools_css_agent.h" |
| 20 #include "components/ui_devtools/views/ui_devtools_dom_agent.h" |
18 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/common/service_manager_connection.h" | 22 #include "content/public/common/service_manager_connection.h" |
20 #include "services/service_manager/public/cpp/connector.h" | 23 #include "services/service_manager/public/cpp/connector.h" |
21 #include "services/service_manager/runner/common/client_util.h" | 24 #include "services/service_manager/runner/common/client_util.h" |
22 #include "services/ui/public/cpp/gpu/gpu.h" // nogncheck | 25 #include "services/ui/public/cpp/gpu/gpu.h" // nogncheck |
23 #include "services/ui/public/cpp/input_devices/input_device_client.h" | 26 #include "services/ui/public/cpp/input_devices/input_device_client.h" |
24 #include "services/ui/public/interfaces/constants.mojom.h" | 27 #include "services/ui/public/interfaces/constants.mojom.h" |
25 #include "services/ui/public/interfaces/input_devices/input_device_server.mojom.
h" | 28 #include "services/ui/public/interfaces/input_devices/input_device_server.mojom.
h" |
26 #include "ui/display/screen.h" | 29 #include "ui/display/screen.h" |
27 #include "ui/views/mus/mus_client.h" | 30 #include "ui/views/mus/mus_client.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // ui::MaterialDesignController::Intialize() having already been called. | 98 // ui::MaterialDesignController::Intialize() having already been called. |
96 if (!views::LayoutProvider::Get()) | 99 if (!views::LayoutProvider::Get()) |
97 layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider(); | 100 layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider(); |
98 } | 101 } |
99 | 102 |
100 void ChromeBrowserMainExtraPartsViews::PreProfileInit() { | 103 void ChromeBrowserMainExtraPartsViews::PreProfileInit() { |
101 #if defined(USE_AURA) | 104 #if defined(USE_AURA) |
102 // IME driver must be available at login screen, so initialize before profile. | 105 // IME driver must be available at login screen, so initialize before profile. |
103 if (service_manager::ServiceManagerIsRemote()) | 106 if (service_manager::ServiceManagerIsRemote()) |
104 IMEDriver::Register(); | 107 IMEDriver::Register(); |
| 108 |
| 109 // Start devtools server |
| 110 devtools_server_ = ui_devtools::UiDevToolsServer::Create(nullptr); |
| 111 if (devtools_server_) { |
| 112 auto dom_backend = base::MakeUnique<ui_devtools::UIDevToolsDOMAgent>(); |
| 113 auto css_backend = |
| 114 base::MakeUnique<ui_devtools::UIDevToolsCSSAgent>(dom_backend.get()); |
| 115 auto devtools_client = base::MakeUnique<ui_devtools::UiDevToolsClient>( |
| 116 "UiDevToolsClient", devtools_server_.get()); |
| 117 devtools_client->AddAgent(std::move(dom_backend)); |
| 118 devtools_client->AddAgent(std::move(css_backend)); |
| 119 devtools_server_->AttachClient(std::move(devtools_client)); |
| 120 } |
105 #endif | 121 #endif |
106 | 122 |
107 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 123 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
108 // On the Linux desktop, we want to prevent the user from logging in as root, | 124 // On the Linux desktop, we want to prevent the user from logging in as root, |
109 // so that we don't destroy the profile. Now that we have some minimal ui | 125 // so that we don't destroy the profile. Now that we have some minimal ui |
110 // initialized, check to see if we're running as root and bail if we are. | 126 // initialized, check to see if we're running as root and bail if we are. |
111 if (geteuid() != 0) | 127 if (geteuid() != 0) |
112 return; | 128 return; |
113 | 129 |
114 // Allow running inside an unprivileged user namespace. In that case, the | 130 // Allow running inside an unprivileged user namespace. In that case, the |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 173 |
158 // WMState is owned as a member, so don't have MusClient create it. | 174 // WMState is owned as a member, so don't have MusClient create it. |
159 const bool create_wm_state = false; | 175 const bool create_wm_state = false; |
160 mus_client_ = base::MakeUnique<views::MusClient>( | 176 mus_client_ = base::MakeUnique<views::MusClient>( |
161 connection->GetConnector(), service_manager::Identity(), | 177 connection->GetConnector(), service_manager::Identity(), |
162 content::BrowserThread::GetTaskRunnerForThread( | 178 content::BrowserThread::GetTaskRunnerForThread( |
163 content::BrowserThread::IO), | 179 content::BrowserThread::IO), |
164 create_wm_state); | 180 create_wm_state); |
165 #endif // defined(USE_AURA) | 181 #endif // defined(USE_AURA) |
166 } | 182 } |
OLD | NEW |