| 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/chrome_v8_extension.h" | 5 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 content::RenderView* renderview = content::RenderView::FromWebView(webview); | 46 content::RenderView* renderview = content::RenderView::FromWebView(webview); |
| 47 DCHECK(renderview) << "Encountered a WebView without a WebViewDelegate"; | 47 DCHECK(renderview) << "Encountered a WebView without a WebViewDelegate"; |
| 48 return renderview; | 48 return renderview; |
| 49 } | 49 } |
| 50 | 50 |
| 51 ChromeV8Extension::ChromeV8Extension(Dispatcher* dispatcher) | 51 ChromeV8Extension::ChromeV8Extension(Dispatcher* dispatcher) |
| 52 // TODO(svenpanne) It would be nice to remove the GetCurrent() call and use | 52 // TODO(svenpanne) It would be nice to remove the GetCurrent() call and use |
| 53 // an additional constructor parameter instead, but this would involve too | 53 // an additional constructor parameter instead, but this would involve too |
| 54 // many changes for now. | 54 // many changes for now. |
| 55 : NativeHandler(v8::Isolate::GetCurrent()), | 55 : ObjectBackedNativeHandler(v8::Isolate::GetCurrent()), |
| 56 dispatcher_(dispatcher) { | 56 dispatcher_(dispatcher) { |
| 57 g_instances.Get().insert(this); | 57 g_instances.Get().insert(this); |
| 58 } | 58 } |
| 59 | 59 |
| 60 ChromeV8Extension::~ChromeV8Extension() { | 60 ChromeV8Extension::~ChromeV8Extension() { |
| 61 g_instances.Get().erase(this); | 61 g_instances.Get().erase(this); |
| 62 } | 62 } |
| 63 | 63 |
| 64 // static | 64 // static |
| 65 const ChromeV8Extension::InstanceSet& ChromeV8Extension::GetAll() { | 65 const ChromeV8Extension::InstanceSet& ChromeV8Extension::GetAll() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 76 const ExtensionSet* extensions = dispatcher_->extensions(); | 76 const ExtensionSet* extensions = dispatcher_->extensions(); |
| 77 if (!extensions->ExtensionBindingsAllowed( | 77 if (!extensions->ExtensionBindingsAllowed( |
| 78 ExtensionURLInfo(document.securityOrigin(), url))) | 78 ExtensionURLInfo(document.securityOrigin(), url))) |
| 79 return NULL; | 79 return NULL; |
| 80 | 80 |
| 81 return extensions->GetExtensionOrAppByURL( | 81 return extensions->GetExtensionOrAppByURL( |
| 82 ExtensionURLInfo(document.securityOrigin(), url)); | 82 ExtensionURLInfo(document.securityOrigin(), url)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace extensions | 85 } // namespace extensions |
| OLD | NEW |