OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/renderer/extensions/event_bindings.h" | 5 #include "chrome/renderer/extensions/event_bindings.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
32 #include "v8/include/v8.h" | 32 #include "v8/include/v8.h" |
33 | 33 |
34 using WebKit::WebFrame; | 34 using WebKit::WebFrame; |
35 using WebKit::WebSecurityOrigin; | 35 using WebKit::WebSecurityOrigin; |
36 using WebKit::WebURL; | 36 using WebKit::WebURL; |
37 using content::RenderThread; | 37 using content::RenderThread; |
| 38 using extensions::Extension; |
38 | 39 |
39 namespace { | 40 namespace { |
40 | 41 |
41 // A map of event names to the number of contexts listening to that event. | 42 // A map of event names to the number of contexts listening to that event. |
42 // We notify the browser about event listeners when we transition between 0 | 43 // We notify the browser about event listeners when we transition between 0 |
43 // and 1. | 44 // and 1. |
44 typedef std::map<std::string, int> EventListenerCounts; | 45 typedef std::map<std::string, int> EventListenerCounts; |
45 | 46 |
46 // A map of extension IDs to listener counts for that extension. | 47 // A map of extension IDs to listener counts for that extension. |
47 base::LazyInstance<std::map<std::string, EventListenerCounts> > | 48 base::LazyInstance<std::map<std::string, EventListenerCounts> > |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return (extension && extension->has_lazy_background_page() && | 146 return (extension && extension->has_lazy_background_page() && |
146 helper->view_type() == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); | 147 helper->view_type() == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); |
147 } | 148 } |
148 }; | 149 }; |
149 | 150 |
150 } // namespace | 151 } // namespace |
151 | 152 |
152 ChromeV8Extension* EventBindings::Get(ExtensionDispatcher* dispatcher) { | 153 ChromeV8Extension* EventBindings::Get(ExtensionDispatcher* dispatcher) { |
153 return new ExtensionImpl(dispatcher); | 154 return new ExtensionImpl(dispatcher); |
154 } | 155 } |
OLD | NEW |