OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_CHROME_DEVTOOLS_HTTP_CLIENT_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_DEVTOOLS_HTTP_CLIENT_H_ |
6 #define CHROME_TEST_CHROMEDRIVER_CHROME_DEVTOOLS_HTTP_CLIENT_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_CHROME_DEVTOOLS_HTTP_CLIENT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 std::vector<WebViewInfo> views_info; | 72 std::vector<WebViewInfo> views_info; |
73 }; | 73 }; |
74 | 74 |
75 class DevToolsHttpClient { | 75 class DevToolsHttpClient { |
76 public: | 76 public: |
77 DevToolsHttpClient(const NetAddress& address, | 77 DevToolsHttpClient(const NetAddress& address, |
78 scoped_refptr<URLRequestContextGetter> context_getter, | 78 scoped_refptr<URLRequestContextGetter> context_getter, |
79 const SyncWebSocketFactory& socket_factory, | 79 const SyncWebSocketFactory& socket_factory, |
80 std::unique_ptr<DeviceMetrics> device_metrics, | 80 std::unique_ptr<DeviceMetrics> device_metrics, |
81 std::unique_ptr<std::set<WebViewInfo::Type>> window_types, | 81 std::unique_ptr<std::set<WebViewInfo::Type>> window_types, |
82 std::string page_load_strategy); | 82 std::string page_load_strategy, |
| 83 std::string user_agent); |
83 ~DevToolsHttpClient(); | 84 ~DevToolsHttpClient(); |
84 | 85 |
85 Status Init(const base::TimeDelta& timeout); | 86 Status Init(const base::TimeDelta& timeout); |
86 | 87 |
87 Status GetWebViewsInfo(WebViewsInfo* views_info); | 88 Status GetWebViewsInfo(WebViewsInfo* views_info); |
88 | 89 |
89 std::unique_ptr<DevToolsClient> CreateClient(const std::string& id); | 90 std::unique_ptr<DevToolsClient> CreateClient(const std::string& id); |
90 | 91 |
91 Status CloseWebView(const std::string& id); | 92 Status CloseWebView(const std::string& id); |
92 | 93 |
93 Status ActivateWebView(const std::string& id); | 94 Status ActivateWebView(const std::string& id); |
94 | 95 |
95 const BrowserInfo* browser_info(); | 96 const BrowserInfo* browser_info(); |
96 const DeviceMetrics* device_metrics(); | 97 const DeviceMetrics* device_metrics(); |
97 bool IsBrowserWindow(const WebViewInfo& view) const; | 98 bool IsBrowserWindow(const WebViewInfo& view) const; |
| 99 const std::string& user_agent() const; |
98 | 100 |
99 private: | 101 private: |
100 Status CloseFrontends(const std::string& for_client_id); | 102 Status CloseFrontends(const std::string& for_client_id); |
101 bool FetchUrlAndLog(const std::string& url, | 103 bool FetchUrlAndLog(const std::string& url, |
102 URLRequestContextGetter* getter, | 104 URLRequestContextGetter* getter, |
103 std::string* response); | 105 std::string* response); |
104 | 106 |
105 scoped_refptr<URLRequestContextGetter> context_getter_; | 107 scoped_refptr<URLRequestContextGetter> context_getter_; |
106 SyncWebSocketFactory socket_factory_; | 108 SyncWebSocketFactory socket_factory_; |
107 std::string server_url_; | 109 std::string server_url_; |
108 std::string web_socket_url_prefix_; | 110 std::string web_socket_url_prefix_; |
109 BrowserInfo browser_info_; | 111 BrowserInfo browser_info_; |
110 std::unique_ptr<DeviceMetrics> device_metrics_; | 112 std::unique_ptr<DeviceMetrics> device_metrics_; |
111 std::unique_ptr<std::set<WebViewInfo::Type>> window_types_; | 113 std::unique_ptr<std::set<WebViewInfo::Type>> window_types_; |
112 std::string page_load_strategy_; | 114 std::string page_load_strategy_; |
| 115 std::string user_agent_; |
113 | 116 |
114 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpClient); | 117 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpClient); |
115 }; | 118 }; |
116 | 119 |
117 Status ParseType(const std::string& data, WebViewInfo::Type* type); | 120 Status ParseType(const std::string& data, WebViewInfo::Type* type); |
118 | 121 |
119 namespace internal { | 122 namespace internal { |
120 Status ParseWebViewsInfo(const std::string& data, WebViewsInfo* views_info); | 123 Status ParseWebViewsInfo(const std::string& data, WebViewsInfo* views_info); |
121 } // namespace internal | 124 } // namespace internal |
122 | 125 |
123 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_DEVTOOLS_HTTP_CLIENT_H_ | 126 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_DEVTOOLS_HTTP_CLIENT_H_ |
OLD | NEW |