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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "chrome/common/extensions/background_info.h" | 14 #include "chrome/common/extensions/background_info.h" |
15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
16 #include "chrome/common/extensions/extension_messages.h" | 16 #include "chrome/common/extensions/extension_messages.h" |
17 #include "chrome/common/extensions/extension_set.h" | 17 #include "chrome/common/extensions/extension_set.h" |
18 #include "chrome/common/extensions/value_counter.h" | 18 #include "chrome/common/extensions/value_counter.h" |
19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
20 #include "chrome/common/view_type.h" | |
21 #include "chrome/renderer/extensions/chrome_v8_context.h" | 20 #include "chrome/renderer/extensions/chrome_v8_context.h" |
22 #include "chrome/renderer/extensions/chrome_v8_context_set.h" | 21 #include "chrome/renderer/extensions/chrome_v8_context_set.h" |
23 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 22 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
24 #include "chrome/renderer/extensions/dispatcher.h" | 23 #include "chrome/renderer/extensions/dispatcher.h" |
25 #include "chrome/renderer/extensions/event_bindings.h" | 24 #include "chrome/renderer/extensions/event_bindings.h" |
26 #include "chrome/renderer/extensions/extension_helper.h" | 25 #include "chrome/renderer/extensions/extension_helper.h" |
27 #include "chrome/renderer/extensions/user_script_slave.h" | 26 #include "chrome/renderer/extensions/user_script_slave.h" |
28 #include "content/public/renderer/render_thread.h" | 27 #include "content/public/renderer/render_thread.h" |
29 #include "content/public/renderer/v8_value_converter.h" | 28 #include "content/public/renderer/v8_value_converter.h" |
30 #include "extensions/common/event_filter.h" | 29 #include "extensions/common/event_filter.h" |
30 #include "extensions/common/view_type.h" | |
31 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
32 #include "grit/renderer_resources.h" | 32 #include "grit/renderer_resources.h" |
33 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" | 33 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" |
34 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" | 34 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" |
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
39 #include "v8/include/v8.h" | 39 #include "v8/include/v8.h" |
40 | 40 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 return info; | 312 return info; |
313 } | 313 } |
314 | 314 |
315 private: | 315 private: |
316 static bool IsLazyBackgroundPage(content::RenderView* render_view, | 316 static bool IsLazyBackgroundPage(content::RenderView* render_view, |
317 const Extension* extension) { | 317 const Extension* extension) { |
318 if (!render_view) | 318 if (!render_view) |
319 return false; | 319 return false; |
320 ExtensionHelper* helper = ExtensionHelper::Get(render_view); | 320 ExtensionHelper* helper = ExtensionHelper::Get(render_view); |
321 return (extension && BackgroundInfo::HasLazyBackgroundPage(extension) && | 321 return (extension && BackgroundInfo::HasLazyBackgroundPage(extension) && |
322 helper->view_type() == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); | 322 helper->view_type() == |
323 extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); | |
Yoyo Zhou
2013/04/01 17:36:51
''
| |
323 } | 324 } |
324 | 325 |
325 static scoped_ptr<EventMatcher> ParseEventMatcher( | 326 static scoped_ptr<EventMatcher> ParseEventMatcher( |
326 base::DictionaryValue* filter_dict) { | 327 base::DictionaryValue* filter_dict) { |
327 return scoped_ptr<EventMatcher>(new EventMatcher( | 328 return scoped_ptr<EventMatcher>(new EventMatcher( |
328 scoped_ptr<base::DictionaryValue>(filter_dict->DeepCopy()))); | 329 scoped_ptr<base::DictionaryValue>(filter_dict->DeepCopy()))); |
329 } | 330 } |
330 }; | 331 }; |
331 | 332 |
332 } // namespace | 333 } // namespace |
333 | 334 |
334 // static | 335 // static |
335 ChromeV8Extension* EventBindings::Create(Dispatcher* dispatcher, | 336 ChromeV8Extension* EventBindings::Create(Dispatcher* dispatcher, |
336 v8::Handle<v8::Context> context) { | 337 v8::Handle<v8::Context> context) { |
337 return new ExtensionImpl(dispatcher, context); | 338 return new ExtensionImpl(dispatcher, context); |
338 } | 339 } |
339 | 340 |
340 } // namespace extensions | 341 } // namespace extensions |
OLD | NEW |