| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 if (value.IsEmpty() || !value->IsFunction()) { | 123 if (value.IsEmpty() || !value->IsFunction()) { |
| 124 VLOG(1) << "Could not execute chrome hidden method: " << function_name; | 124 VLOG(1) << "Could not execute chrome hidden method: " << function_name; |
| 125 return false; | 125 return false; |
| 126 } | 126 } |
| 127 | 127 |
| 128 TRACE_EVENT1("v8", "v8.callChromeHiddenMethod", | 128 TRACE_EVENT1("v8", "v8.callChromeHiddenMethod", |
| 129 "function_name", function_name); | 129 "function_name", function_name); |
| 130 | 130 |
| 131 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); |
| 131 v8::Handle<v8::Value> result_temp = | 132 v8::Handle<v8::Value> result_temp = |
| 132 v8::Local<v8::Function>::Cast(value)->Call(v8::Object::New(), argc, argv); | 133 web_frame_->callFunctionEvenIfScriptDisabled(function, |
| 134 v8::Object::New(), |
| 135 argc, |
| 136 argv); |
| 133 if (result) | 137 if (result) |
| 134 *result = result_temp; | 138 *result = result_temp; |
| 139 |
| 135 return true; | 140 return true; |
| 136 } | 141 } |
| 137 | 142 |
| 138 void ChromeV8Context::DispatchOnLoadEvent(bool is_extension_process, | 143 void ChromeV8Context::DispatchOnLoadEvent(bool is_extension_process, |
| 139 bool is_incognito_process, | 144 bool is_incognito_process, |
| 140 int manifest_version) const { | 145 int manifest_version) const { |
| 141 v8::HandleScope handle_scope; | 146 v8::HandleScope handle_scope; |
| 142 v8::Handle<v8::Value> argv[4]; | 147 v8::Handle<v8::Value> argv[4]; |
| 143 argv[0] = v8::String::New(extension_id_.c_str()); | 148 argv[0] = v8::String::New(extension_id_.c_str()); |
| 144 argv[1] = v8::Boolean::New(is_extension_process); | 149 argv[1] = v8::Boolean::New(is_extension_process); |
| 145 argv[2] = v8::Boolean::New(is_incognito_process); | 150 argv[2] = v8::Boolean::New(is_incognito_process); |
| 146 argv[3] = v8::Integer::New(manifest_version); | 151 argv[3] = v8::Integer::New(manifest_version); |
| 147 CallChromeHiddenMethod("dispatchOnLoad", arraysize(argv), argv, NULL); | 152 CallChromeHiddenMethod("dispatchOnLoad", arraysize(argv), argv, NULL); |
| 148 } | 153 } |
| 149 | 154 |
| 150 void ChromeV8Context::DispatchOnUnloadEvent() const { | 155 void ChromeV8Context::DispatchOnUnloadEvent() const { |
| 151 v8::HandleScope handle_scope; | 156 v8::HandleScope handle_scope; |
| 152 CallChromeHiddenMethod("dispatchOnUnload", 0, NULL, NULL); | 157 CallChromeHiddenMethod("dispatchOnUnload", 0, NULL, NULL); |
| 153 } | 158 } |
| OLD | NEW |