| 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 #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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 if (!renderview) | 104 if (!renderview) |
| 105 return NULL; // this can happen as a tab is closing. | 105 return NULL; // this can happen as a tab is closing. |
| 106 | 106 |
| 107 WebDocument document = renderview->GetWebView()->mainFrame()->document(); | 107 WebDocument document = renderview->GetWebView()->mainFrame()->document(); |
| 108 GURL url = document.url(); | 108 GURL url = document.url(); |
| 109 const ExtensionSet* extensions = extension_dispatcher_->extensions(); | 109 const ExtensionSet* extensions = extension_dispatcher_->extensions(); |
| 110 if (!extensions->ExtensionBindingsAllowed( | 110 if (!extensions->ExtensionBindingsAllowed( |
| 111 ExtensionURLInfo(document.securityOrigin(), url))) | 111 ExtensionURLInfo(document.securityOrigin(), url))) |
| 112 return NULL; | 112 return NULL; |
| 113 | 113 |
| 114 return extensions->GetByURL( | 114 return extensions->GetExtensionOrAppByURL( |
| 115 ExtensionURLInfo(document.securityOrigin(), url)); | 115 ExtensionURLInfo(document.securityOrigin(), url)); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool ChromeV8Extension::CheckCurrentContextAccessToExtensionAPI( | 118 bool ChromeV8Extension::CheckCurrentContextAccessToExtensionAPI( |
| 119 const std::string& function_name) const { | 119 const std::string& function_name) const { |
| 120 ChromeV8Context* context = | 120 ChromeV8Context* context = |
| 121 extension_dispatcher_->v8_context_set().GetCurrent(); | 121 extension_dispatcher_->v8_context_set().GetCurrent(); |
| 122 if (!context) { | 122 if (!context) { |
| 123 DLOG(ERROR) << "Not in a v8::Context"; | 123 DLOG(ERROR) << "Not in a v8::Context"; |
| 124 return false; | 124 return false; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 if (args.Length() < 1) | 203 if (args.Length() < 1) |
| 204 return v8::Undefined(); | 204 return v8::Undefined(); |
| 205 | 205 |
| 206 std::vector<std::string> components; | 206 std::vector<std::string> components; |
| 207 for (int i = 0; i < args.Length(); ++i) | 207 for (int i = 0; i < args.Length(); ++i) |
| 208 components.push_back(*v8::String::Utf8Value(args[i]->ToString())); | 208 components.push_back(*v8::String::Utf8Value(args[i]->ToString())); |
| 209 | 209 |
| 210 LOG(ERROR) << JoinString(components, ','); | 210 LOG(ERROR) << JoinString(components, ','); |
| 211 return v8::Undefined(); | 211 return v8::Undefined(); |
| 212 } | 212 } |
| OLD | NEW |