Fix memory leak in Sync FakeServerEntity
[chromium-blink-merge.git] / extensions / browser / script_execution_observer.h
blob4edd99533ec5b0ba83eb5c35359e54757c180026
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_
8 #include <map>
9 #include <set>
10 #include <string>
12 class GURL;
14 namespace content {
15 class WebContents;
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 {
23 public:
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. This may be an empty set
31 // if the script has no path associated with it (e.g. in the case of
32 // tabs.executeScript).
33 virtual void OnScriptsExecuted(
34 const content::WebContents* web_contents,
35 const ExecutingScriptsMap& executing_scripts_map,
36 const GURL& on_url) = 0;
38 protected:
39 virtual ~ScriptExecutionObserver();
42 } // namespace extensions
44 #endif // EXTENSIONS_BROWSER_SCRIPT_EXECUTION_OBSERVER_H_