Roll src/third_party/WebKit bf18a82:a9cee16 (svn 185297:185304)
[chromium-blink-merge.git] / chrome / test / chromedriver / chrome / mobile_emulation_override_manager.h
blob6acd60382e07301d93ac1e4d3db1eb579d989fdc
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
3 // found in the LICENSE file.
5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_MOBILE_EMULATION_OVERRIDE_MANAGER_H_
6 #define CHROME_TEST_CHROMEDRIVER_CHROME_MOBILE_EMULATION_OVERRIDE_MANAGER_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/test/chromedriver/chrome/devtools_event_listener.h"
15 namespace base {
16 class DictionaryValue;
19 struct BrowserInfo;
20 class DevToolsClient;
21 struct DeviceMetrics;
22 class Status;
24 // Overrides the device metrics, if requested, for the duration of the
25 // given |DevToolsClient|'s lifetime.
26 class MobileEmulationOverrideManager : public DevToolsEventListener {
27 public:
28 MobileEmulationOverrideManager(DevToolsClient* client,
29 const DeviceMetrics* device_metrics,
30 const BrowserInfo* browser_info);
31 ~MobileEmulationOverrideManager() override;
33 // Overridden from DevToolsEventListener:
34 Status OnConnected(DevToolsClient* client) override;
35 Status OnEvent(DevToolsClient* client,
36 const std::string& method,
37 const base::DictionaryValue& params) override;
39 private:
40 Status ApplyOverrideIfNeeded();
42 DevToolsClient* client_;
43 const DeviceMetrics* overridden_device_metrics_;
44 const BrowserInfo* browser_info_;
46 DISALLOW_COPY_AND_ASSIGN(MobileEmulationOverrideManager);
49 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_MOBILE_EMULATION_OVERRIDE_MANAGER_H_