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_context.h" | 5 #include "chrome/renderer/extensions/chrome_v8_context.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
88 | 88 |
89 v8::Handle<v8::Object> global = v8_context()->Global(); | 89 v8::Handle<v8::Object> global = v8_context()->Global(); |
90 if (!web_frame_) | 90 if (!web_frame_) |
91 return handle_scope.Escape(function->Call(global, argc, argv)); | 91 return handle_scope.Escape(function->Call(global, argc, argv)); |
92 return handle_scope.Escape( | 92 return handle_scope.Escape( |
93 v8::Local<v8::Value>(web_frame_->callFunctionEvenIfScriptDisabled( | 93 v8::Local<v8::Value>(web_frame_->callFunctionEvenIfScriptDisabled( |
94 function, global, argc, argv))); | 94 function, global, argc, argv))); |
95 } | 95 } |
96 | 96 |
97 bool ChromeV8Context::IsAnyFeatureAvailableToContext( | 97 bool ChromeV8Context::IsAnyFeatureAvailableToContext(const Feature& api) { |
98 const std::string& api_name) { | |
99 return ExtensionAPI::GetSharedInstance()->IsAnyFeatureAvailableToContext( | 98 return ExtensionAPI::GetSharedInstance()->IsAnyFeatureAvailableToContext( |
100 api_name, | 99 api, |
101 extension_.get(), | 100 extension_.get(), |
102 context_type_, | 101 context_type_, |
103 UserScriptSlave::GetDataSourceURLForFrame(web_frame_)); | 102 UserScriptSlave::GetDataSourceURLForFrame(web_frame_)); |
104 } | 103 } |
105 | 104 |
106 Feature::Availability ChromeV8Context::GetAvailability( | 105 Feature::Availability ChromeV8Context::GetAvailability( |
107 const std::string& api_name) { | 106 const std::string& api_name) { |
108 return ExtensionAPI::GetSharedInstance()->IsAvailable(api_name, | 107 return ExtensionAPI::GetSharedInstance()->IsAvailable(api_name, |
109 extension_.get(), | 108 extension_.get(), |
110 context_type_, | 109 context_type_, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // string if a validation error has occured. | 153 // string if a validation error has occured. |
155 if (DCHECK_IS_ON()) { | 154 if (DCHECK_IS_ON()) { |
156 if (!retval.IsEmpty() && !retval->IsUndefined()) { | 155 if (!retval.IsEmpty() && !retval->IsUndefined()) { |
157 std::string error = *v8::String::Utf8Value(retval); | 156 std::string error = *v8::String::Utf8Value(retval); |
158 DCHECK(false) << error; | 157 DCHECK(false) << error; |
159 } | 158 } |
160 } | 159 } |
161 } | 160 } |
162 | 161 |
163 } // namespace extensions | 162 } // namespace extensions |
OLD | NEW |