OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_FORWARDER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_FORWARDER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_FORWARDER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_FORWARDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 const std::string& event_name, | 46 const std::string& event_name, |
47 const std::string& event_args, | 47 const std::string& event_args, |
48 const GURL& event_url); | 48 const GURL& event_url); |
49 | 49 |
50 // Calls | 50 // Calls |
51 // DispatchEventToRenderers(event_name, event_args, | 51 // DispatchEventToRenderers(event_name, event_args, |
52 // use_profile_to_restrict_events ? profile : NULL, event_url) | 52 // use_profile_to_restrict_events ? profile : NULL, event_url) |
53 // on |profile|'s ExtensionEventRouter. May be called on any thread. | 53 // on |profile|'s ExtensionEventRouter. May be called on any thread. |
54 void DispatchEventToRenderers(const std::string& event_name, | 54 void DispatchEventToRenderers(const std::string& event_name, |
55 const std::string& event_args, | 55 const std::string& event_args, |
56 ProfileId profile_id, | 56 void* profile, |
57 bool use_profile_to_restrict_events, | 57 bool use_profile_to_restrict_events, |
58 const GURL& event_url); | 58 const GURL& event_url); |
59 | 59 |
60 // Calls | 60 // Calls |
61 // DispatchEventToExtension(extension_id, event_name, event_args, | 61 // DispatchEventToExtension(extension_id, event_name, event_args, |
62 // use_profile_to_restrict_events ? profile : NULL, event_url) | 62 // use_profile_to_restrict_events ? profile : NULL, event_url) |
63 // on |profile|'s ExtensionEventRouter. May be called on any thread. | 63 // on |profile|'s ExtensionEventRouter. May be called on any thread. |
64 void DispatchEventToExtension(const std::string& extension_id, | 64 void DispatchEventToExtension(const std::string& extension_id, |
65 const std::string& event_name, | 65 const std::string& event_name, |
66 const std::string& event_args, | 66 const std::string& event_args, |
67 ProfileId profile_id, | 67 void* profile, |
68 bool use_profile_to_restrict_events, | 68 bool use_profile_to_restrict_events, |
69 const GURL& event_url); | 69 const GURL& event_url); |
70 | 70 |
71 protected: | 71 protected: |
72 // Protected for testing. | 72 // Protected for testing. |
73 virtual ~ExtensionEventRouterForwarder(); | 73 virtual ~ExtensionEventRouterForwarder(); |
74 | 74 |
75 // Helper function for {Broadcast,Dispatch}EventTo{Extension,Renderers}. | 75 // Helper function for {Broadcast,Dispatch}EventTo{Extension,Renderers}. |
76 // Virtual for testing. | 76 // Virtual for testing. |
77 virtual void HandleEvent(const std::string& extension_id, | 77 virtual void HandleEvent(const std::string& extension_id, |
78 const std::string& event_name, | 78 const std::string& event_name, |
79 const std::string& event_args, | 79 const std::string& event_args, |
80 ProfileId profile_id, | 80 void* profile, |
81 bool use_profile_to_restrict_events, | 81 bool use_profile_to_restrict_events, |
82 const GURL& event_url); | 82 const GURL& event_url); |
83 | 83 |
84 // Calls DispatchEventToRenderers or DispatchEventToExtension (depending on | 84 // Calls DispatchEventToRenderers or DispatchEventToExtension (depending on |
85 // whether extension_id == "" or not) of |profile|'s ExtensionEventRouter. | 85 // whether extension_id == "" or not) of |profile|'s ExtensionEventRouter. |
86 // |profile| may never be NULL. | 86 // |profile| may never be NULL. |
87 // Virtual for testing. | 87 // Virtual for testing. |
88 virtual void CallExtensionEventRouter(Profile* profile, | 88 virtual void CallExtensionEventRouter(Profile* profile, |
89 const std::string& extension_id, | 89 const std::string& extension_id, |
90 const std::string& event_name, | 90 const std::string& event_name, |
91 const std::string& event_args, | 91 const std::string& event_args, |
92 Profile* restrict_to_profile, | 92 Profile* restrict_to_profile, |
93 const GURL& event_url); | 93 const GURL& event_url); |
94 | 94 |
95 private: | 95 private: |
96 friend class base::RefCountedThreadSafe<ExtensionEventRouterForwarder>; | 96 friend class base::RefCountedThreadSafe<ExtensionEventRouterForwarder>; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(ExtensionEventRouterForwarder); | 98 DISALLOW_COPY_AND_ASSIGN(ExtensionEventRouterForwarder); |
99 }; | 99 }; |
100 | 100 |
101 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_FORWARDER_H_ | 101 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_FORWARDER_H_ |
OLD | NEW |