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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 argc, | 147 argc, |
148 argv); | 148 argv); |
149 if (result) | 149 if (result) |
150 *result = result_temp; | 150 *result = result_temp; |
151 | 151 |
152 return true; | 152 return true; |
153 } | 153 } |
154 | 154 |
155 Feature::Availability ChromeV8Context::GetAvailability( | 155 Feature::Availability ChromeV8Context::GetAvailability( |
156 const std::string& api_name) { | 156 const std::string& api_name) { |
157 return GetAvailabilityInternal(api_name, extension_); | |
158 } | |
159 | |
160 Feature::Availability ChromeV8Context::GetAvailabilityForContext( | |
161 const std::string& api_name) { | |
162 return GetAvailabilityInternal(api_name, NULL); | |
163 } | |
164 | |
165 Feature::Availability ChromeV8Context::GetAvailabilityInternal( | |
166 const std::string& api_name, | |
167 const Extension* extension) { | |
168 return ExtensionAPI::GetSharedInstance()->IsAvailable( | 157 return ExtensionAPI::GetSharedInstance()->IsAvailable( |
169 api_name, | 158 api_name, |
170 extension, | 159 extension_, |
171 context_type_, | 160 context_type_, |
172 UserScriptSlave::GetDataSourceURLForFrame(web_frame_)); | 161 UserScriptSlave::GetDataSourceURLForFrame(web_frame_)); |
173 } | 162 } |
174 | 163 |
175 void ChromeV8Context::DispatchOnLoadEvent(bool is_incognito_process, | 164 void ChromeV8Context::DispatchOnLoadEvent(bool is_incognito_process, |
176 int manifest_version) { | 165 int manifest_version) { |
177 v8::HandleScope handle_scope; | 166 v8::HandleScope handle_scope; |
178 v8::Handle<v8::Value> argv[] = { | 167 v8::Handle<v8::Value> argv[] = { |
179 v8::String::New(GetExtensionID().c_str()), | 168 v8::String::New(GetExtensionID().c_str()), |
180 v8::String::New(GetContextTypeDescription().c_str()), | 169 v8::String::New(GetContextTypeDescription().c_str()), |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // string if a validation error has occured. | 217 // string if a validation error has occured. |
229 if (DCHECK_IS_ON()) { | 218 if (DCHECK_IS_ON()) { |
230 if (!retval.IsEmpty() && !retval->IsUndefined()) { | 219 if (!retval.IsEmpty() && !retval->IsUndefined()) { |
231 std::string error = *v8::String::AsciiValue(retval); | 220 std::string error = *v8::String::AsciiValue(retval); |
232 DCHECK(false) << error; | 221 DCHECK(false) << error; |
233 } | 222 } |
234 } | 223 } |
235 } | 224 } |
236 | 225 |
237 } // namespace extensions | 226 } // namespace extensions |
OLD | NEW |