diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-06 10:03:41 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-06 10:03:41 +0000 |
commit | b32260f92786a8d3f7adef89dda53e044806f00c (patch) | |
tree | d42fa50c63221170a498f952cd8364d58701b7c1 /extensions/browser/api_activity_monitor.h | |
parent | bce0aaf723befbf7c69d3492964c71bd8dbbd87e (diff) | |
download | chromium_src-b32260f92786a8d3f7adef89dda53e044806f00c.zip chromium_src-b32260f92786a8d3f7adef89dda53e044806f00c.tar.gz chromium_src-b32260f92786a8d3f7adef89dda53e044806f00c.tar.bz2 |
Add ApiActivityMonitor to decouple ActivityLog from low-level extensions code
* Introduce ApiActivityMonitor interface and make ActivityLog implement it
* Use it to replace EventRouter's one-off EventDispatchObserver, which was
kind of ugly.
* Use it for function call notifications from ExtensionFunctionDispatcher
This allows app_shell to use ExtensionFunctionDispatcher without an
ActivityLog and gets us another step closer to moving EFD into src/extensions.
BUG=332986,339595
TEST=browser_tests Extension*
Review URL: https://codereview.chromium.org/155183002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249324 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/browser/api_activity_monitor.h')
-rw-r--r-- | extensions/browser/api_activity_monitor.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/extensions/browser/api_activity_monitor.h b/extensions/browser/api_activity_monitor.h new file mode 100644 index 0000000..b8f0cc3 --- /dev/null +++ b/extensions/browser/api_activity_monitor.h @@ -0,0 +1,39 @@ +// Copyright 2014 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 EXTENSIONS_BROWSER_API_ACTIVITY_MONITOR_H_ +#define EXTENSIONS_BROWSER_API_ACTIVITY_MONITOR_H_ + +#include <string> + +#include "base/memory/scoped_ptr.h" + +namespace base { +class ListValue; +} + +namespace extensions { + +// ApiActivityMonitor is used to monitor extension API event dispatch and API +// function calls. An embedder can use this interface to log low-level extension +// activity. +class ApiActivityMonitor { + public: + // Called when an API event is dispatched to an extension. + virtual void OnApiEventDispatched(const std::string& extension_id, + const std::string& event_name, + scoped_ptr<base::ListValue> event_args) = 0; + + // Called when an extension calls an API function. + virtual void OnApiFunctionCalled(const std::string& extension_id, + const std::string& api_name, + scoped_ptr<base::ListValue> args) = 0; + + protected: + virtual ~ApiActivityMonitor() {} +}; + +} // namespace extensions + +#endif // EXTENSIONS_BROWSER_API_ACTIVITY_MONITOR_H_ |