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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 ChromeV8Extension::~ChromeV8Extension() { | 56 ChromeV8Extension::~ChromeV8Extension() { |
57 g_instances.Get().erase(this); | 57 g_instances.Get().erase(this); |
58 } | 58 } |
59 | 59 |
60 // static | 60 // static |
61 const ChromeV8Extension::InstanceSet& ChromeV8Extension::GetAll() { | 61 const ChromeV8Extension::InstanceSet& ChromeV8Extension::GetAll() { |
62 return g_instances.Get(); | 62 return g_instances.Get(); |
63 } | 63 } |
64 | 64 |
65 const Extension* ChromeV8Extension::GetExtensionForCurrentRenderView() const { | 65 const extensions::Extension* |
| 66 ChromeV8Extension::GetExtensionForCurrentRenderView() const { |
66 content::RenderView* renderview = GetCurrentRenderView(); | 67 content::RenderView* renderview = GetCurrentRenderView(); |
67 if (!renderview) | 68 if (!renderview) |
68 return NULL; // this can happen as a tab is closing. | 69 return NULL; // this can happen as a tab is closing. |
69 | 70 |
70 WebDocument document = renderview->GetWebView()->mainFrame()->document(); | 71 WebDocument document = renderview->GetWebView()->mainFrame()->document(); |
71 GURL url = document.url(); | 72 GURL url = document.url(); |
72 const ExtensionSet* extensions = extension_dispatcher_->extensions(); | 73 const ExtensionSet* extensions = extension_dispatcher_->extensions(); |
73 if (!extensions->ExtensionBindingsAllowed( | 74 if (!extensions->ExtensionBindingsAllowed( |
74 ExtensionURLInfo(document.securityOrigin(), url))) | 75 ExtensionURLInfo(document.securityOrigin(), url))) |
75 return NULL; | 76 return NULL; |
76 | 77 |
77 return extensions->GetExtensionOrAppByURL( | 78 return extensions->GetExtensionOrAppByURL( |
78 ExtensionURLInfo(document.securityOrigin(), url)); | 79 ExtensionURLInfo(document.securityOrigin(), url)); |
79 } | 80 } |
OLD | NEW |