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

Unified Diff: ash/common/wm_shell.cc

Issue 2372843002: Add ash devtools client (Closed)
Patch Set: Add ash devtools client Created 4 years, 3 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
« ash/common/devtools/devtools_client_backend.cc ('K') | « ash/common/wm_shell.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« ash/common/devtools/devtools_client_backend.cc ('K') | « ash/common/wm_shell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698