summaryrefslogtreecommitdiffstats
path: root/components/dom_distiller/content/distiller_javascript_utils.h
blob: b80a6ce5149514d09bd484304ff559ac7b2e18a8 (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
// Copyright 2015 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 COMPONENTS_DOM_DISTILLER_CONTENT_DISTILLER_JAVASCRIPT_UTILS_H_
#define COMPONENTS_DOM_DISTILLER_CONTENT_DISTILLER_JAVASCRIPT_UTILS_H_

#include <string>

#include "content/public/browser/render_frame_host.h"

namespace dom_distiller {

// Set the world for JavaScript to execute in. This can only be called once.
void SetDistillerJavaScriptWorldId(const int id);

bool DistillerJavaScriptWorldIdIsSet();

// Execute JavaScript in an isolated world.
void RunIsolatedJavaScript(
    content::RenderFrameHost* render_frame_host,
    const std::string& buffer,
    const content::RenderFrameHost::JavaScriptResultCallback& callback);

// Same as above without a callback.
void RunIsolatedJavaScript(content::RenderFrameHost* render_frame_host,
                           const std::string& buffer);

}  // namespace dom_distiller

#endif  // COMPONENTS_DOM_DISTILLER_CONTENT_DISTILLER_JAVASCRIPT_UTILS_H_