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

Side by Side Diff: ash/common/wm_shell.cc

Issue 2372843002: Add ash devtools client (Closed)
Patch Set: Add ash devtools client Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/common/wm_shell.h" 5 #include "ash/common/wm_shell.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/accelerators/accelerator_controller.h" 9 #include "ash/common/accelerators/accelerator_controller.h"
10 #include "ash/common/accelerators/ash_focus_manager_factory.h" 10 #include "ash/common/accelerators/ash_focus_manager_factory.h"
11 #include "ash/common/accessibility_delegate.h" 11 #include "ash/common/accessibility_delegate.h"
12 #include "ash/common/devtools/devtools_client_backend.h"
12 #include "ash/common/focus_cycler.h" 13 #include "ash/common/focus_cycler.h"
13 #include "ash/common/keyboard/keyboard_ui.h" 14 #include "ash/common/keyboard/keyboard_ui.h"
14 #include "ash/common/new_window_delegate.h" 15 #include "ash/common/new_window_delegate.h"
15 #include "ash/common/palette_delegate.h" 16 #include "ash/common/palette_delegate.h"
16 #include "ash/common/session/session_state_delegate.h" 17 #include "ash/common/session/session_state_delegate.h"
17 #include "ash/common/shelf/app_list_shelf_item_delegate.h" 18 #include "ash/common/shelf/app_list_shelf_item_delegate.h"
18 #include "ash/common/shelf/shelf_delegate.h" 19 #include "ash/common/shelf/shelf_delegate.h"
19 #include "ash/common/shelf/shelf_model.h" 20 #include "ash/common/shelf/shelf_model.h"
20 #include "ash/common/shelf/shelf_window_watcher.h" 21 #include "ash/common/shelf/shelf_window_watcher.h"
21 #include "ash/common/shell_delegate.h" 22 #include "ash/common/shell_delegate.h"
22 #include "ash/common/shell_window_ids.h" 23 #include "ash/common/shell_window_ids.h"
23 #include "ash/common/system/brightness_control_delegate.h" 24 #include "ash/common/system/brightness_control_delegate.h"
24 #include "ash/common/system/keyboard_brightness_control_delegate.h" 25 #include "ash/common/system/keyboard_brightness_control_delegate.h"
25 #include "ash/common/system/toast/toast_manager.h" 26 #include "ash/common/system/toast/toast_manager.h"
26 #include "ash/common/system/tray/system_tray_delegate.h" 27 #include "ash/common/system/tray/system_tray_delegate.h"
27 #include "ash/common/system/tray/system_tray_notifier.h" 28 #include "ash/common/system/tray/system_tray_notifier.h"
28 #include "ash/common/wallpaper/wallpaper_controller.h" 29 #include "ash/common/wallpaper/wallpaper_controller.h"
29 #include "ash/common/wallpaper/wallpaper_delegate.h" 30 #include "ash/common/wallpaper/wallpaper_delegate.h"
30 #include "ash/common/wm/immersive_context_ash.h" 31 #include "ash/common/wm/immersive_context_ash.h"
31 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 32 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
32 #include "ash/common/wm/mru_window_tracker.h" 33 #include "ash/common/wm/mru_window_tracker.h"
33 #include "ash/common/wm/overview/window_selector_controller.h" 34 #include "ash/common/wm/overview/window_selector_controller.h"
34 #include "ash/common/wm/root_window_finder.h" 35 #include "ash/common/wm/root_window_finder.h"
35 #include "ash/common/wm/system_modal_container_layout_manager.h" 36 #include "ash/common/wm/system_modal_container_layout_manager.h"
36 #include "ash/common/wm/window_cycle_controller.h" 37 #include "ash/common/wm/window_cycle_controller.h"
37 #include "ash/common/wm_root_window_controller.h" 38 #include "ash/common/wm_root_window_controller.h"
38 #include "ash/common/wm_window.h" 39 #include "ash/common/wm_window.h"
39 #include "base/bind.h" 40 #include "base/bind.h"
41 #include "base/command_line.h"
40 #include "base/logging.h" 42 #include "base/logging.h"
41 #include "base/memory/ptr_util.h" 43 #include "base/memory/ptr_util.h"
42 #include "ui/app_list/presenter/app_list_presenter.h" 44 #include "ui/app_list/presenter/app_list_presenter.h"
45 #include "ui/devtools/switches.h"
43 #include "ui/display/display.h" 46 #include "ui/display/display.h"
44 #include "ui/views/focus/focus_manager_factory.h" 47 #include "ui/views/focus/focus_manager_factory.h"
45 48
46 #if defined(OS_CHROMEOS) 49 #if defined(OS_CHROMEOS)
47 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h " 50 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h "
48 #include "ash/common/system/chromeos/keyboard_brightness_controller.h" 51 #include "ash/common/system/chromeos/keyboard_brightness_controller.h"
49 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" 52 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h"
50 #endif 53 #endif
51 54
52 namespace ash { 55 namespace ash {
(...skipping 24 matching lines...) Expand all
77 // Create the app list item in the shelf data model. 80 // Create the app list item in the shelf data model.
78 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get()); 81 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get());
79 82
80 // Install the custom factory early on so that views::FocusManagers for Tray, 83 // Install the custom factory early on so that views::FocusManagers for Tray,
81 // Shelf, and WallPaper could be created by the factory. 84 // Shelf, and WallPaper could be created by the factory.
82 views::FocusManagerFactory::Install(new AshFocusManagerFactory); 85 views::FocusManagerFactory::Install(new AshFocusManagerFactory);
83 86
84 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); 87 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate());
85 88
86 wallpaper_controller_.reset(new WallpaperController(blocking_pool_)); 89 wallpaper_controller_.reset(new WallpaperController(blocking_pool_));
90
91 // Start devtools server
92 bool remote_debugging_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
93 ui::devtools::kEnableUiDevTools);
94 if (remote_debugging_) {
95 int port;
96 base::StringToInt(
97 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
98 ui::devtools::kEnableUiDevTools),
99 &port);
100 devtools_server_.reset(new ui::devtools::UiDevToolsServer());
101 // TODO(mhashmi): Remove port + 1 when UiDevToolsServer becomes a service,
102 // this is to avoid mus/ash using the same port
103 devtools_server_->Start("127.0.0.1", port + 1);
104 std::unique_ptr<ui::devtools::protocol::DOM::Backend> backend(
105 new ui::devtools::AshDevToolsBackend(this));
106 std::unique_ptr<ui::devtools::UiDevToolsClient> devtools_client(
107 new ui::devtools::UiDevToolsClient("Ash", devtools_server_.get()));
108 devtools_client->AddDOMBackend(std::move(backend));
109 devtools_server_->AttachClient(std::move(devtools_client));
110 }
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!
87 } 111 }
88 112
89 void WmShell::Shutdown() { 113 void WmShell::Shutdown() {
90 // These members access WmShell in their destructors. 114 // These members access WmShell in their destructors.
91 wallpaper_controller_.reset(); 115 wallpaper_controller_.reset();
92 accessibility_delegate_.reset(); 116 accessibility_delegate_.reset();
93 117
94 // ShelfWindowWatcher has window observers and a pointer to the shelf model. 118 // ShelfWindowWatcher has window observers and a pointer to the shelf model.
95 shelf_window_watcher_.reset(); 119 shelf_window_watcher_.reset();
96 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC 120 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 void WmShell::DeleteToastManager() { 373 void WmShell::DeleteToastManager() {
350 toast_manager_.reset(); 374 toast_manager_.reset();
351 } 375 }
352 376
353 void WmShell::SetAcceleratorController( 377 void WmShell::SetAcceleratorController(
354 std::unique_ptr<AcceleratorController> accelerator_controller) { 378 std::unique_ptr<AcceleratorController> accelerator_controller) {
355 accelerator_controller_ = std::move(accelerator_controller); 379 accelerator_controller_ = std::move(accelerator_controller);
356 } 380 }
357 381
358 } // namespace ash 382 } // namespace ash
OLDNEW
« 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