| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 return true; | 153 return true; |
| 154 } | 154 } |
| 155 | 155 |
| 156 const std::set<std::string>& ChromeV8Context::GetAvailableExtensionAPIs() { | 156 const std::set<std::string>& ChromeV8Context::GetAvailableExtensionAPIs() { |
| 157 if (!available_extension_apis_.get()) { | 157 if (!available_extension_apis_.get()) { |
| 158 available_extension_apis_ = | 158 available_extension_apis_ = |
| 159 extensions::ExtensionAPI::GetSharedInstance()->GetAPIsForContext( | 159 extensions::ExtensionAPI::GetSharedInstance()->GetAPIsForContext( |
| 160 context_type_, | 160 context_type_, |
| 161 extension_, | 161 extension_, |
| 162 UserScriptSlave::GetDataSourceURLForFrame(web_frame_)).Pass(); | 162 extensions::UserScriptSlave::GetDataSourceURLForFrame( |
| 163 web_frame_)).Pass(); |
| 163 } | 164 } |
| 164 return *(available_extension_apis_.get()); | 165 return *(available_extension_apis_.get()); |
| 165 } | 166 } |
| 166 | 167 |
| 167 void ChromeV8Context::DispatchOnLoadEvent(bool is_incognito_process, | 168 void ChromeV8Context::DispatchOnLoadEvent(bool is_incognito_process, |
| 168 int manifest_version) { | 169 int manifest_version) { |
| 169 v8::HandleScope handle_scope; | 170 v8::HandleScope handle_scope; |
| 170 v8::Handle<v8::Value> argv[] = { | 171 v8::Handle<v8::Value> argv[] = { |
| 171 v8::String::New(GetExtensionID().c_str()), | 172 v8::String::New(GetExtensionID().c_str()), |
| 172 v8::String::New(GetContextTypeDescription(context_type_).c_str()), | 173 v8::String::New(GetContextTypeDescription(context_type_).c_str()), |
| 173 v8::Boolean::New(is_incognito_process), | 174 v8::Boolean::New(is_incognito_process), |
| 174 v8::Integer::New(manifest_version), | 175 v8::Integer::New(manifest_version), |
| 175 }; | 176 }; |
| 176 CallChromeHiddenMethod("dispatchOnLoad", arraysize(argv), argv, NULL); | 177 CallChromeHiddenMethod("dispatchOnLoad", arraysize(argv), argv, NULL); |
| 177 } | 178 } |
| 178 | 179 |
| 179 void ChromeV8Context::DispatchOnUnloadEvent() { | 180 void ChromeV8Context::DispatchOnUnloadEvent() { |
| 180 v8::HandleScope handle_scope; | 181 v8::HandleScope handle_scope; |
| 181 CallChromeHiddenMethod("dispatchOnUnload", 0, NULL, NULL); | 182 CallChromeHiddenMethod("dispatchOnUnload", 0, NULL, NULL); |
| 182 } | 183 } |
| OLD | NEW |