| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MOBILE_EMULATION_OVERRIDE_MANAGER_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_MOBILE_EMULATION_OVERRIDE_MANAGER_H_ |
| 6 #define CHROME_TEST_CHROMEDRIVER_CHROME_MOBILE_EMULATION_OVERRIDE_MANAGER_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_CHROME_MOBILE_EMULATION_OVERRIDE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h" | 13 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class DictionaryValue; | 16 class DictionaryValue; |
| 17 } | 17 } |
| 18 | 18 |
| 19 class DevToolsClient; | 19 class DevToolsClient; |
| 20 struct DeviceMetrics; | 20 struct DeviceMetrics; |
| 21 class Status; | 21 class Status; |
| 22 | 22 |
| 23 // Overrides the device metrics, if requested, for the duration of the | 23 // Overrides the device metrics, if requested, for the duration of the |
| 24 // given |DevToolsClient|'s lifetime. | 24 // given |DevToolsClient|'s lifetime. |
| 25 class MobileEmulationOverrideManager : public DevToolsEventListener { | 25 class MobileEmulationOverrideManager : public DevToolsEventListener { |
| 26 public: | 26 public: |
| 27 MobileEmulationOverrideManager(DevToolsClient* client, | 27 MobileEmulationOverrideManager(DevToolsClient* client, |
| 28 const DeviceMetrics* device_metrics); | 28 const DeviceMetrics* device_metrics, |
| 29 std::string user_agent); |
| 29 ~MobileEmulationOverrideManager() override; | 30 ~MobileEmulationOverrideManager() override; |
| 30 | 31 |
| 31 // Overridden from DevToolsEventListener: | 32 // Overridden from DevToolsEventListener: |
| 32 Status OnConnected(DevToolsClient* client) override; | 33 Status OnConnected(DevToolsClient* client) override; |
| 33 Status OnEvent(DevToolsClient* client, | 34 Status OnEvent(DevToolsClient* client, |
| 34 const std::string& method, | 35 const std::string& method, |
| 35 const base::DictionaryValue& params) override; | 36 const base::DictionaryValue& params) override; |
| 36 | 37 |
| 37 bool IsEmulatingTouch(); | 38 bool IsEmulatingTouch(); |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 Status ApplyOverrideIfNeeded(); | 41 Status ApplyOverrideIfNeeded(); |
| 41 | 42 |
| 42 DevToolsClient* client_; | 43 DevToolsClient* client_; |
| 43 const DeviceMetrics* overridden_device_metrics_; | 44 const DeviceMetrics* overridden_device_metrics_; |
| 45 const std::string overridden_user_agent_; |
| 44 | 46 |
| 45 DISALLOW_COPY_AND_ASSIGN(MobileEmulationOverrideManager); | 47 DISALLOW_COPY_AND_ASSIGN(MobileEmulationOverrideManager); |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_MOBILE_EMULATION_OVERRIDE_MANAGER_H_ | 50 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_MOBILE_EMULATION_OVERRIDE_MANAGER_H_ |
| OLD | NEW |