| 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/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 argc, | 136 argc, |
| 137 argv); | 137 argv); |
| 138 if (result) | 138 if (result) |
| 139 *result = result_temp; | 139 *result = result_temp; |
| 140 | 140 |
| 141 return true; | 141 return true; |
| 142 } | 142 } |
| 143 | 143 |
| 144 const std::set<std::string>& ChromeV8Context::GetAvailableExtensionAPIs() { | 144 const std::set<std::string>& ChromeV8Context::GetAvailableExtensionAPIs() { |
| 145 if (!available_extension_apis_.get()) { | 145 if (!available_extension_apis_.get()) { |
| 146 available_extension_apis_ = | 146 available_extension_apis_.reset(new std::set<std::string>( |
| 147 ExtensionAPI::GetSharedInstance()->GetAPIsForContext( | 147 ExtensionAPI::GetSharedInstance()->GetAPIsForContext( |
| 148 context_type_, | 148 context_type_, |
| 149 extension_, | 149 extension_, |
| 150 UserScriptSlave::GetDataSourceURLForFrame( | 150 UserScriptSlave::GetDataSourceURLForFrame(web_frame_)))); |
| 151 web_frame_)).Pass(); | |
| 152 } | 151 } |
| 153 return *(available_extension_apis_.get()); | 152 return *(available_extension_apis_.get()); |
| 154 } | 153 } |
| 155 | 154 |
| 156 void ChromeV8Context::DispatchOnLoadEvent(bool is_incognito_process, | 155 void ChromeV8Context::DispatchOnLoadEvent(bool is_incognito_process, |
| 157 int manifest_version) { | 156 int manifest_version) { |
| 158 v8::HandleScope handle_scope; | 157 v8::HandleScope handle_scope; |
| 159 v8::Handle<v8::Value> argv[] = { | 158 v8::Handle<v8::Value> argv[] = { |
| 160 v8::String::New(GetExtensionID().c_str()), | 159 v8::String::New(GetExtensionID().c_str()), |
| 161 v8::String::New(GetContextTypeDescription().c_str()), | 160 v8::String::New(GetContextTypeDescription().c_str()), |
| (...skipping 14 matching lines...) Expand all Loading... |
| 176 case Feature::BLESSED_EXTENSION_CONTEXT: return "BLESSED_EXTENSION"; | 175 case Feature::BLESSED_EXTENSION_CONTEXT: return "BLESSED_EXTENSION"; |
| 177 case Feature::UNBLESSED_EXTENSION_CONTEXT: return "UNBLESSED_EXTENSION"; | 176 case Feature::UNBLESSED_EXTENSION_CONTEXT: return "UNBLESSED_EXTENSION"; |
| 178 case Feature::CONTENT_SCRIPT_CONTEXT: return "CONTENT_SCRIPT"; | 177 case Feature::CONTENT_SCRIPT_CONTEXT: return "CONTENT_SCRIPT"; |
| 179 case Feature::WEB_PAGE_CONTEXT: return "WEB_PAGE"; | 178 case Feature::WEB_PAGE_CONTEXT: return "WEB_PAGE"; |
| 180 } | 179 } |
| 181 NOTREACHED(); | 180 NOTREACHED(); |
| 182 return ""; | 181 return ""; |
| 183 } | 182 } |
| 184 | 183 |
| 185 } // namespace extensions | 184 } // namespace extensions |
| OLD | NEW |