| 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_DEVTOOLS_CLIENT_IMPL_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_DEVTOOLS_CLIENT_IMPL_H_ |
| 6 #define CHROME_TEST_CHROMEDRIVER_DEVTOOLS_CLIENT_IMPL_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_DEVTOOLS_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "chrome/test/chromedriver/devtools_client.h" | 16 #include "chrome/test/chromedriver/devtools_client.h" |
| 16 #include "chrome/test/chromedriver/net/sync_websocket_factory.h" | 17 #include "chrome/test/chromedriver/net/sync_websocket_factory.h" |
| 17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 18 | 19 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 } // namespace internal | 46 } // namespace internal |
| 46 | 47 |
| 47 class DevToolsEventListener; | 48 class DevToolsEventListener; |
| 48 class Status; | 49 class Status; |
| 49 class SyncWebSocket; | 50 class SyncWebSocket; |
| 50 | 51 |
| 51 class DevToolsClientImpl : public DevToolsClient { | 52 class DevToolsClientImpl : public DevToolsClient { |
| 52 public: | 53 public: |
| 53 // Listener may be NULL. | |
| 54 DevToolsClientImpl(const SyncWebSocketFactory& factory, | 54 DevToolsClientImpl(const SyncWebSocketFactory& factory, |
| 55 const std::string& url); | 55 const std::string& url); |
| 56 | 56 |
| 57 typedef base::Callback<bool( | 57 typedef base::Callback<bool( |
| 58 const std::string&, | 58 const std::string&, |
| 59 int, | 59 int, |
| 60 internal::InspectorMessageType*, | 60 internal::InspectorMessageType*, |
| 61 internal::InspectorEvent*, | 61 internal::InspectorEvent*, |
| 62 internal::InspectorCommandResponse*)> ParserFunc; | 62 internal::InspectorCommandResponse*)> ParserFunc; |
| 63 DevToolsClientImpl(const SyncWebSocketFactory& factory, | 63 DevToolsClientImpl(const SyncWebSocketFactory& factory, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 89 int expected_id, | 89 int expected_id, |
| 90 internal::InspectorMessageType* type, | 90 internal::InspectorMessageType* type, |
| 91 internal::InspectorEvent* event, | 91 internal::InspectorEvent* event, |
| 92 internal::InspectorCommandResponse* response); | 92 internal::InspectorCommandResponse* response); |
| 93 virtual Status NotifyEventListeners(const std::string& method, | 93 virtual Status NotifyEventListeners(const std::string& method, |
| 94 const base::DictionaryValue& params); | 94 const base::DictionaryValue& params); |
| 95 scoped_ptr<SyncWebSocket> socket_; | 95 scoped_ptr<SyncWebSocket> socket_; |
| 96 GURL url_; | 96 GURL url_; |
| 97 ParserFunc parser_func_; | 97 ParserFunc parser_func_; |
| 98 std::list<DevToolsEventListener*> listeners_; | 98 std::list<DevToolsEventListener*> listeners_; |
| 99 typedef std::map<int, base::DictionaryValue*> ResponseMap; |
| 100 ResponseMap cmd_response_map_; |
| 99 bool connected_; | 101 bool connected_; |
| 100 int next_id_; | 102 int next_id_; |
| 101 | 103 |
| 102 DISALLOW_COPY_AND_ASSIGN(DevToolsClientImpl); | 104 DISALLOW_COPY_AND_ASSIGN(DevToolsClientImpl); |
| 103 }; | 105 }; |
| 104 | 106 |
| 105 namespace internal { | 107 namespace internal { |
| 106 | 108 |
| 107 bool ParseInspectorMessage( | 109 bool ParseInspectorMessage( |
| 108 const std::string& message, | 110 const std::string& message, |
| 109 int expected_id, | 111 int expected_id, |
| 110 InspectorMessageType* type, | 112 InspectorMessageType* type, |
| 111 InspectorEvent* event, | 113 InspectorEvent* event, |
| 112 InspectorCommandResponse* command_response); | 114 InspectorCommandResponse* command_response); |
| 113 | 115 |
| 114 } // namespace internal | 116 } // namespace internal |
| 115 | 117 |
| 116 #endif // CHROME_TEST_CHROMEDRIVER_DEVTOOLS_CLIENT_IMPL_H_ | 118 #endif // CHROME_TEST_CHROMEDRIVER_DEVTOOLS_CLIENT_IMPL_H_ |
| OLD | NEW |