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
3 // found in the LICENSE file.
5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_GEOLOCATION_OVERRIDE_MANAGER_H_
6 #define CHROME_TEST_CHROMEDRIVER_CHROME_GEOLOCATION_OVERRIDE_MANAGER_H_
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"
16 class DictionaryValue;
23 // Overrides the geolocation, if requested, for the duration of the
24 // given |DevToolsClient|'s lifetime.
25 class GeolocationOverrideManager : public DevToolsEventListener {
27 explicit GeolocationOverrideManager(DevToolsClient* client);
28 virtual ~GeolocationOverrideManager();
30 Status OverrideGeolocation(const Geoposition& geoposition);
32 // Overridden from DevToolsEventListener:
33 virtual Status OnConnected(DevToolsClient* client) OVERRIDE;
34 virtual Status OnEvent(DevToolsClient* client,
35 const std::string& method,
36 const base::DictionaryValue& params) OVERRIDE;
39 Status ApplyOverrideIfNeeded();
41 DevToolsClient* client_;
42 scoped_ptr<Geoposition> overridden_geoposition_;
44 DISALLOW_COPY_AND_ASSIGN(GeolocationOverrideManager);
47 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_GEOLOCATION_OVERRIDE_MANAGER_H_