blob: 11f72b7740125c0c780a43a1feddcb238055559b [file] [log] [blame]
[email protected]766a7082012-02-03 23:39:151// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
[email protected]766a7082012-02-03 23:39:155#ifndef CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_
6#define CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_
initial.commit09911bf2008-07-26 23:55:297
avi1023d012015-12-25 02:39:148#include <stdint.h>
9
10#include "base/macros.h"
[email protected]cfa856d62014-02-22 07:58:4011#include "content/public/renderer/render_frame_observer.h"
[email protected]caa8dc042014-01-13 12:07:5812#include "gin/wrappable.h"
initial.commit09911bf2008-07-26 23:55:2913
[email protected]caa8dc042014-01-13 12:07:5814namespace blink {
lukaszadf18ba762017-06-09 22:24:3015class WebLocalFrame;
[email protected]caa8dc042014-01-13 12:07:5816}
17
18namespace gin {
19class Arguments;
20}
21
[email protected]9a292e22012-10-22 15:19:3122namespace content {
23
[email protected]cfa856d62014-02-22 07:58:4024class RenderFrame;
[email protected]480116e7c2014-01-13 12:10:0425
Lukasz Anforowiczd2daf02a2017-09-05 20:20:5426// Provides implementation of window.domAutomationController javascript object.
27// Javascript can call domAutomationController.send(...) to send arbitrary data
28// to the browser. On the browser side, the data is received via one of the
29// following:
30// - Product code:
31// - Explicit handlers of FrameHostMsg_DomOperationResponse IPC
32// - Test code:
33// - DOMMessageQueue class
34// - ExecuteScriptAndExtractInt/Bool/String functions
[email protected]480116e7c2014-01-13 12:10:0435class DomAutomationController : public gin::Wrappable<DomAutomationController>,
[email protected]cfa856d62014-02-22 07:58:4036 public RenderFrameObserver {
initial.commit09911bf2008-07-26 23:55:2937 public:
[email protected]caa8dc042014-01-13 12:07:5838 static gin::WrapperInfo kWrapperInfo;
39
lukaszadf18ba762017-06-09 22:24:3040 static void Install(RenderFrame* render_frame, blink::WebLocalFrame* frame);
initial.commit09911bf2008-07-26 23:55:2941
42 // Makes the renderer send a javascript value to the app.
[email protected]caa8dc042014-01-13 12:07:5843 // The value to be sent can be either of type String,
avi1023d012015-12-25 02:39:1444 // Number (double casted to int32_t) or Boolean. Any other type or no
[email protected]caa8dc042014-01-13 12:07:5845 // argument at all is ignored.
[email protected]480116e7c2014-01-13 12:10:0446 bool SendMsg(const gin::Arguments& args);
initial.commit09911bf2008-07-26 23:55:2947
initial.commit09911bf2008-07-26 23:55:2948 private:
[email protected]cfa856d62014-02-22 07:58:4049 explicit DomAutomationController(RenderFrame* render_view);
dcheng6d18e402014-10-21 12:32:5250 ~DomAutomationController() override;
initial.commit09911bf2008-07-26 23:55:2951
[email protected]caa8dc042014-01-13 12:07:5852 // gin::WrappableBase
dcheng6d18e402014-10-21 12:32:5253 gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
mohan.reddyee0b42a2014-10-08 04:53:1454 v8::Isolate* isolate) override;
[email protected]caa8dc042014-01-13 12:07:5855
xing.xuc5c7ef892016-09-01 01:19:3056 // RenderFrameObserver
dcheng6d18e402014-10-21 12:32:5257 void OnDestruct() override;
mdjones28f36942015-09-24 00:48:2258 void DidCreateScriptContext(v8::Local<v8::Context> context,
mdjones28f36942015-09-24 00:48:2259 int world_id) override;
[email protected]caa8dc042014-01-13 12:07:5860
[email protected]caa8dc042014-01-13 12:07:5861 DISALLOW_COPY_AND_ASSIGN(DomAutomationController);
initial.commit09911bf2008-07-26 23:55:2962};
63
[email protected]9a292e22012-10-22 15:19:3164} // namespace content
65
[email protected]766a7082012-02-03 23:39:1566#endif // CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_