1 // Copyright 2014 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 EXTENSIONS_BROWSER_SCRIPT_EXECUTION_OBSERVER_H_
6 #define EXTENSIONS_BROWSER_SCRIPT_EXECUTION_OBSERVER_H_
18 namespace extensions
{
20 // Observer base class for classes that need to be notified when content
21 // scripts and/or tabs.executeScript calls run on a page.
22 class ScriptExecutionObserver
{
24 // Map of extensions IDs to the executing script paths.
25 typedef std::map
<std::string
, std::set
<std::string
> > ExecutingScriptsMap
;
27 // Called when script(s) have executed on a page.
29 // |executing_scripts_map| contains all extensions that are executing
30 // scripts, mapped to the paths for those scripts. The paths may be an empty
31 // set if the script has no path associated with it (e.g. in the case of
32 // tabs.executeScript), but there will still be an entry for the extension.
33 virtual void OnScriptsExecuted(
34 const content::WebContents
* web_contents
,
35 const ExecutingScriptsMap
& executing_scripts_map
,
36 const GURL
& on_url
) = 0;
39 virtual ~ScriptExecutionObserver();
42 } // namespace extensions
44 #endif // EXTENSIONS_BROWSER_SCRIPT_EXECUTION_OBSERVER_H_