| 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) { |
| 157 return ExtensionAPI::GetSharedInstance()->IsAvailable( | 168 return ExtensionAPI::GetSharedInstance()->IsAvailable( |
| 158 api_name, | 169 api_name, |
| 159 extension_, | 170 extension, |
| 160 context_type_, | 171 context_type_, |
| 161 UserScriptSlave::GetDataSourceURLForFrame(web_frame_)); | 172 UserScriptSlave::GetDataSourceURLForFrame(web_frame_)); |
| 162 } | 173 } |
| 163 | 174 |
| 164 void ChromeV8Context::DispatchOnLoadEvent(bool is_incognito_process, | 175 void ChromeV8Context::DispatchOnLoadEvent(bool is_incognito_process, |
| 165 int manifest_version) { | 176 int manifest_version) { |
| 166 v8::HandleScope handle_scope; | 177 v8::HandleScope handle_scope; |
| 167 v8::Handle<v8::Value> argv[] = { | 178 v8::Handle<v8::Value> argv[] = { |
| 168 v8::String::New(GetExtensionID().c_str()), | 179 v8::String::New(GetExtensionID().c_str()), |
| 169 v8::String::New(GetContextTypeDescription().c_str()), | 180 v8::String::New(GetContextTypeDescription().c_str()), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // string if a validation error has occured. | 228 // string if a validation error has occured. |
| 218 if (DCHECK_IS_ON()) { | 229 if (DCHECK_IS_ON()) { |
| 219 if (!retval.IsEmpty() && !retval->IsUndefined()) { | 230 if (!retval.IsEmpty() && !retval->IsUndefined()) { |
| 220 std::string error = *v8::String::AsciiValue(retval); | 231 std::string error = *v8::String::AsciiValue(retval); |
| 221 DCHECK(false) << error; | 232 DCHECK(false) << error; |
| 222 } | 233 } |
| 223 } | 234 } |
| 224 } | 235 } |
| 225 | 236 |
| 226 } // namespace extensions | 237 } // namespace extensions |
| OLD | NEW |