summaryrefslogtreecommitdiffstats
path: root/chrome/common/automation_events.h
blob: 44c723202e0903d5b8aced1111aadc76a6ba7da5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_COMMON_AUTOMATION_EVENTS_H_
#define CHROME_COMMON_AUTOMATION_EVENTS_H_

#include <string>
#include <vector>

#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"

// A request to evaluate a script in a given frame.
struct ScriptEvaluationRequest {
  ScriptEvaluationRequest();
  ScriptEvaluationRequest(const std::string& script,
                          const std::string& frame_xpath);
  ~ScriptEvaluationRequest();

  std::string script;
  std::string frame_xpath;
};

// An extension to a normal mouse event that includes data for determining the
// location of the mouse event.
struct AutomationMouseEvent {
  AutomationMouseEvent();
  ~AutomationMouseEvent();

  WebKit::WebMouseEvent mouse_event;

  // A list of scripts that when evaluated returns a coordinate for the event.
  // The scripts are chained together in that the output for one script
  // provides the input for the next. Each script must result in exactly one
  // JavaScript object. This object will be passed to the next script
  // as arguments[0]. The only exceptions to this are the first script, which
  // is passed null. The last script should result in a single JavaScript
  // object with integer 'x' and 'y' properties.
  // If empty, the coordinates in the normal mouse event are used.
  std::vector<ScriptEvaluationRequest> location_script_chain;
};

#endif  // CHROME_COMMON_AUTOMATION_EVENTS_H_