| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_TEST_CHROMEDRIVER_DOM_TRACKER_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_DOM_TRACKER_H_ |
| 6 #define CHROME_TEST_CHROMEDRIVER_DOM_TRACKER_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_DOM_TRACKER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "chrome/test/chromedriver/devtools_client.h" |
| 13 #include "chrome/test/chromedriver/devtools_event_listener.h" | 14 #include "chrome/test/chromedriver/devtools_event_listener.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class DictionaryValue; | 17 class DictionaryValue; |
| 17 class Value; | 18 class Value; |
| 18 } | 19 } |
| 19 | 20 |
| 20 class Status; | 21 class Status; |
| 21 | 22 |
| 22 // Tracks the state of the DOM and execution context creation. | 23 // Tracks the state of the DOM and execution context creation. |
| 23 class DomTracker : public DevToolsEventListener { | 24 class DomTracker : public DevToolsEventListener { |
| 24 public: | 25 public: |
| 25 DomTracker(); | 26 explicit DomTracker(DevToolsClient* client); |
| 26 virtual ~DomTracker(); | 27 virtual ~DomTracker(); |
| 27 | 28 |
| 29 Status Init(); |
| 28 Status GetFrameIdForNode(int node_id, std::string* frame_id); | 30 Status GetFrameIdForNode(int node_id, std::string* frame_id); |
| 29 | 31 |
| 30 // Overridden from DevToolsEventListener: | 32 // Overridden from DevToolsEventListener: |
| 31 virtual void OnEvent(const std::string& method, | 33 virtual void OnEvent(const std::string& method, |
| 32 const base::DictionaryValue& params) OVERRIDE; | 34 const base::DictionaryValue& params) OVERRIDE; |
| 33 | 35 |
| 34 private: | 36 private: |
| 37 DevToolsClient* client_; |
| 35 bool ProcessNodeList(const base::Value* nodes); | 38 bool ProcessNodeList(const base::Value* nodes); |
| 36 bool ProcessNode(const base::Value* node); | 39 bool ProcessNode(const base::Value* node); |
| 37 | 40 |
| 38 std::map<int, std::string> node_to_frame_map_; | 41 std::map<int, std::string> node_to_frame_map_; |
| 39 | 42 |
| 40 DISALLOW_COPY_AND_ASSIGN(DomTracker); | 43 DISALLOW_COPY_AND_ASSIGN(DomTracker); |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 #endif // CHROME_TEST_CHROMEDRIVER_DOM_TRACKER_H_ | 46 #endif // CHROME_TEST_CHROMEDRIVER_DOM_TRACKER_H_ |
| OLD | NEW |