diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-31 22:01:30 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-31 22:01:30 +0000 |
commit | a9bd72a75a6702df07087bf77049735a45a8861e (patch) | |
tree | 5fb257027218c5ddf8e95bcfd4941b523a93d9e8 /chrome/browser/extensions/extension_io_event_router.h | |
parent | d9ca776c4b5443df5ffa55d53735016cfa92cb11 (diff) | |
download | chromium_src-a9bd72a75a6702df07087bf77049735a45a8861e.zip chromium_src-a9bd72a75a6702df07087bf77049735a45a8861e.tar.gz chromium_src-a9bd72a75a6702df07087bf77049735a45a8861e.tar.bz2 |
First steps towards webRequest extension API.
Only an asynchronous version of onBeforeRequest is implement, with
limited data being passed.
BUG=60101
TEST=no
Review URL: http://codereview.chromium.org/6288014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73196 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_io_event_router.h')
-rwxr-xr-x | chrome/browser/extensions/extension_io_event_router.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_io_event_router.h b/chrome/browser/extensions/extension_io_event_router.h new file mode 100755 index 0000000..1a27890 --- /dev/null +++ b/chrome/browser/extensions/extension_io_event_router.h @@ -0,0 +1,40 @@ +// Copyright (c) 2011 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_EXTENSION_IO_EVENT_ROUTER_H_ +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_IO_EVENT_ROUTER_H_ +#pragma once + +#include <string> + +#include "base/ref_counted.h" + +class Profile; + +// For now, this just forwards events from the IO thread to the +// ExtensionEventRouter on the UI thread. +// TODO(mpcomplete): eventually I want this to have its own copy of the event +// listeners so it can bypass the jump to the UI thread. +class ExtensionIOEventRouter + : public base::RefCountedThreadSafe<ExtensionIOEventRouter> { + public: + explicit ExtensionIOEventRouter(Profile* profile); + ~ExtensionIOEventRouter(); + + void DestroyingProfile() { profile_ = NULL; } + + // Dispatch the named event to every extension listening to that event. + void DispatchEvent(const std::string& event_name, + const std::string& event_args) const; + + private: + Profile* profile_; + + void DispatchEventOnUIThread(const std::string& event_name, + const std::string& event_args) const; + + DISALLOW_COPY_AND_ASSIGN(ExtensionIOEventRouter); +}; + +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_IO_EVENT_ROUTER_H_ |