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

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: Push updates to inspector when windows are added, destroyed or reorganized 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
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 void enable(ui::devtools::protocol::ErrorString* error) override {} 26 void disable(ui::devtools::protocol::ErrorString* error) override;
25 void disable(ui::devtools::protocol::ErrorString* error) override {}
26 void getDocument( 27 void getDocument(
27 ui::devtools::protocol::ErrorString* error, 28 ui::devtools::protocol::ErrorString* error,
28 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override; 29 std::unique_ptr<ui::devtools::protocol::DOM::Node>* out_root) override;
29 30
31 // WindowObserver
32 void OnWindowTreeChanging(WmWindow* window,
33 const TreeChangeParams& params) override;
34
30 private: 35 private:
36 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildTreeForWindow(
37 WmWindow* window);
31 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildInitialTree(); 38 std::unique_ptr<ui::devtools::protocol::DOM::Node> BuildInitialTree();
39 void AddWindowNode(WmWindow* window, WmWindow* parent);
40 void RemoveWindowNode(WmWindow* window);
41 void AddObserverToRootWindows();
42 void RemoveObserverFromRootWindows();
43 void Reset();
32 44
33 ash::WmShell* shell_; 45 ash::WmShell* shell_;
34 46
47 typedef std::unordered_map<WmWindow*, int> WindowToNodeIdMap;
sadrul 2016/11/02 02:04:36 Use 'using WindowToNodeIdMap = ...';
Sarmad Hashmi 2016/11/03 01:42:18 Done.
48 WindowToNodeIdMap window_to_node_id_map_;
49
35 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent); 50 DISALLOW_COPY_AND_ASSIGN(AshDevToolsDOMAgent);
36 }; 51 };
37 52
38 } // namespace devtools 53 } // namespace devtools
39 } // namespace ash 54 } // namespace ash
40 55
41 #endif // ASH_COMMON_DEVTOOLS_ASH_DEVTOOLS_DOM_AGENT_H_ 56 #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') | ash/common/devtools/ash_devtools_dom_agent.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698