summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/script_executor_impl.h
blob: bf66cd482f3443441c33116fcd600f3ef67b2428 (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
// 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_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_IMPL_H_
#define CHROME_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_IMPL_H_
#pragma once

#include "chrome/browser/extensions/script_executor.h"

#include "base/compiler_specific.h"

namespace extensions {

// Standard implementation of ScriptExecutor which just sends an IPC to
// |web_contents_| to execute the script.
class ScriptExecutorImpl : public ScriptExecutor {
 public:
  explicit ScriptExecutorImpl(content::WebContents* web_contents);

  virtual ~ScriptExecutorImpl();

  virtual void ExecuteScript(const std::string& extension_id,
                             ScriptType script_type,
                             const std::string& code,
                             FrameScope frame_scope,
                             UserScript::RunLocation run_at,
                             WorldType world_type,
                             const ExecuteScriptCallback& callback) OVERRIDE;
 private:
  // The next value to use for request_id inExtensionMsg_ExecuteCode_Params.
  int next_request_id_;

  // The WebContents this is bound to.
  content::WebContents* web_contents_;
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_IMPL_H_