Chromium Code Reviews| Index: ash/common/wm_shell.cc |
| diff --git a/ash/common/wm_shell.cc b/ash/common/wm_shell.cc |
| index ff23fb22180d11e66848a40277edb767f96be958..7537e6eccb113103ab06500b8cc5ce5d9e6b06c5 100644 |
| --- a/ash/common/wm_shell.cc |
| +++ b/ash/common/wm_shell.cc |
| @@ -9,6 +9,7 @@ |
| #include "ash/common/accelerators/accelerator_controller.h" |
| #include "ash/common/accelerators/ash_focus_manager_factory.h" |
| #include "ash/common/accessibility_delegate.h" |
| +#include "ash/common/devtools/devtools_client_backend.h" |
| #include "ash/common/focus_cycler.h" |
| #include "ash/common/keyboard/keyboard_ui.h" |
| #include "ash/common/new_window_delegate.h" |
| @@ -37,9 +38,11 @@ |
| #include "ash/common/wm_root_window_controller.h" |
| #include "ash/common/wm_window.h" |
| #include "base/bind.h" |
| +#include "base/command_line.h" |
| #include "base/logging.h" |
| #include "base/memory/ptr_util.h" |
| #include "ui/app_list/presenter/app_list_presenter.h" |
| +#include "ui/devtools/switches.h" |
| #include "ui/display/display.h" |
| #include "ui/views/focus/focus_manager_factory.h" |
| @@ -84,6 +87,27 @@ void WmShell::Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool) { |
| new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); |
| wallpaper_controller_.reset(new WallpaperController(blocking_pool_)); |
| + |
| + // Start devtools server |
| + bool remote_debugging_ = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + ui::devtools::kEnableUiDevTools); |
| + if (remote_debugging_) { |
| + int port; |
| + base::StringToInt( |
| + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| + ui::devtools::kEnableUiDevTools), |
| + &port); |
| + devtools_server_.reset(new ui::devtools::UiDevToolsServer()); |
| + // TODO(mhashmi): Remove port + 1 when UiDevToolsServer becomes a service, |
| + // this is to avoid mus/ash using the same port |
| + devtools_server_->Start("127.0.0.1", port + 1); |
| + std::unique_ptr<ui::devtools::protocol::DOM::Backend> backend( |
| + new ui::devtools::AshDevToolsBackend(this)); |
| + std::unique_ptr<ui::devtools::UiDevToolsClient> devtools_client( |
| + new ui::devtools::UiDevToolsClient("Ash", devtools_server_.get())); |
| + devtools_client->AddDOMBackend(std::move(backend)); |
| + devtools_server_->AttachClient(std::move(devtools_client)); |
| + } |
|
sadrul
2016/10/17 16:19:00
Can some of this code be moved into ui/devtools/?
Sarmad Hashmi
2016/10/17 19:11:48
This is a great idea. Done!
|
| } |
| void WmShell::Shutdown() { |