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

Side by Side Diff: ash/common/devtools/ash_devtools_dom_agent.h

Issue 2466073003: Push updates to inspector when windows are added, destroyed or reorganized (Closed)
Patch Set: Document previous sibling id Created 4 years, 1 month 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
« no previous file with comments | « no previous file | ash/common/devtools/ash_devtools_dom_agent.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ 5 #ifndef ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_
6 #define ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ 6 #define ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_
7 7
8 #include "ash/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
9 #include "ash/common/wm_window_observer.h"
9 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
10 #include "components/ui_devtools/DOM.h" 11 #include "components/ui_devtools/DOM.h"
11 #include "components/ui_devtools/devtools_base_agent.h" 12 #include "components/ui_devtools/devtools_base_agent.h"
12 13
13 namespace ash { 14 namespace ash {
14 namespace devtools { 15 namespace devtools {
15 16
16 class ASH_EXPORT AshDevToolsDOMAgent 17 class ASH_EXPORT AshDevToolsDOMAgent
17 : public NON_EXPORTED_BASE(ui::devtools::UiDevToolsBaseAgent< 18 : public NON_EXPORTED_BASE(ui::devtools::UiDevToolsBaseAgent<
18 ui::devtools::protocol::DOM::Metainfo>) { 19 ui::devtools::protocol::DOM::Metainfo>),
20 public WmWindowObserver {
19 public: 21 public:
20 explicit AshDevToolsDOMAgent(ash::WmShell* shell); 22 explicit AshDevToolsDOMAgent(ash::WmShell* shell);
21 ~AshDevToolsDOMAgent() override; 23 ~AshDevToolsDOMAgent() override;
22 24
23 // DOM::Backend 25 // DOM::Backend
24 ui::devtools::protocol::Response enable() override;
25 ui::devtools::protocol::Response disable() override; 26 ui::devtools::protocol::Response disable() override;
26 ui::devtools::protocol::Response getDocument( 27 ui::devtools::protocol::Response getDocument(
27 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override; 28 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override;
28 29
30 // WindowObserver
31 void OnWindowDestroying(WmWindow* window) override;
32 void OnWindowTreeChanged(WmWindow* window,
33 const TreeChangeParams& params) override;
34 void OnWindowStackingChanged(WmWindow* window) override;
35
29 private: 36 private:
37 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForWindow(
38 WmWindow* window);
30 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildInitialTree(); 39 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildInitialTree();
40 void AddWindowNode(WmWindow* window);
41 void RemoveWindowNode(WmWindow* window, WmWindow* old_parent);
42 void RemoveObserverFromAllWindows();
43 void AddRootWindowObservers();
44 void Reset();
31 45
32 ash::WmShell* shell_; 46 ash::WmShell* shell_;
33 47
48 using WindowToNodeIdMap = std::unordered_map<WmWindow*, int>;
49 WindowToNodeIdMap window_to_node_id_map_;
50
34 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent); 51 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent);
35 }; 52 };
36 53
37 } // namespace devtools 54 } // namespace devtools
38 } // namespace ash 55 } // namespace ash
39 56
40 #endif // ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ 57 #endif // ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_
OLDNEW
« no previous file with comments | « no previous file | ash/common/devtools/ash_devtools_dom_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698