Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: chrome/browser/extensions/extension_io_event_router.h

Issue 6598002: Make the ChromeNetworkDelegate use the ExtensionEventRouterForwarder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_IO_EVENT_ROUTER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_IO_EVENT_ROUTER_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/ref_counted.h"
12
13 class GURL;
14 class Profile;
15
16 // For now, this just forwards events from the IO thread to the
17 // ExtensionEventRouter on the UI thread.
18 // TODO(mpcomplete): eventually I want this to have its own copy of the event
19 // listeners so it can bypass the jump to the UI thread.
20 class ExtensionIOEventRouter
21 : public base::RefCountedThreadSafe<ExtensionIOEventRouter> {
22 public:
23 explicit ExtensionIOEventRouter(Profile* profile);
24 ~ExtensionIOEventRouter();
25
26 void DestroyingProfile() { profile_ = NULL; }
27
28 // Dispatch the named event to every extension listening to that event.
29 void DispatchEventToExtension(const std::string& extension_id,
30 const std::string& event_name,
31 const std::string& event_args) const;
32
33 // Same as above, except the event is sent to all extensions that have
34 // sufficient permissions.
35 void DispatchEventToRenderers(const std::string& event_name,
36 const std::string& event_args,
37 const GURL& event_url) const;
38
39 private:
40 void DispatchEventOnUIThread(const std::string& extension_id,
41 const std::string& event_name,
42 const std::string& event_args) const;
43
44 void DispatchEventToRenderersOnUIThread(
45 const std::string& event_name,
46 const std::string& event_args,
47 const GURL& event_url) const;
48
49 Profile* profile_;
50
51 DISALLOW_COPY_AND_ASSIGN(ExtensionIOEventRouter);
52 };
53
54 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_IO_EVENT_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698