15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// found in the LICENSE file.
45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#ifndef EXTENSIONS_BROWSER_API_ACTIVITY_MONITOR_H_
65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define EXTENSIONS_BROWSER_API_ACTIVITY_MONITOR_H_
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include <string>
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace base {
135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ListValue;
145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace extensions {
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// ApiActivityMonitor is used to monitor extension API event dispatch and API
195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// function calls. An embedder can use this interface to log low-level extension
205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// activity.
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ApiActivityMonitor {
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public:
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Called when an API event is dispatched to an extension.
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void OnApiEventDispatched(const std::string& extension_id,
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                    const std::string& event_name,
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                    scoped_ptr<base::ListValue> event_args) = 0;
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Called when an extension calls an API function.
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void OnApiFunctionCalled(const std::string& extension_id,
305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                   const std::string& api_name,
315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                   scoped_ptr<base::ListValue> args) = 0;
325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) protected:
345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual ~ApiActivityMonitor() {}
355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)};
365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}  // namespace extensions
385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif  // EXTENSIONS_BROWSER_API_ACTIVITY_MONITOR_H_
40