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" |
11 #include "chrome/common/extensions/api/extension_api.h" | 11 #include "chrome/common/extensions/api/extension_api.h" |
| 12 #include "chrome/common/extensions/extension.h" |
12 #include "chrome/common/extensions/extension_set.h" | 13 #include "chrome/common/extensions/extension_set.h" |
13 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 14 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
14 #include "chrome/renderer/extensions/user_script_slave.h" | 15 #include "chrome/renderer/extensions/user_script_slave.h" |
15 #include "content/public/renderer/render_view.h" | 16 #include "content/public/renderer/render_view.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
18 #include "v8/include/v8.h" | 19 #include "v8/include/v8.h" |
19 | 20 |
20 using extensions::Feature; | 21 using extensions::Feature; |
21 | 22 |
(...skipping 15 matching lines...) Expand all Loading... |
37 case Feature::WEB_PAGE_CONTEXT: return "web page"; | 38 case Feature::WEB_PAGE_CONTEXT: return "web page"; |
38 } | 39 } |
39 NOTREACHED(); | 40 NOTREACHED(); |
40 return ""; | 41 return ""; |
41 } | 42 } |
42 | 43 |
43 } // namespace | 44 } // namespace |
44 | 45 |
45 ChromeV8Context::ChromeV8Context(v8::Handle<v8::Context> v8_context, | 46 ChromeV8Context::ChromeV8Context(v8::Handle<v8::Context> v8_context, |
46 WebKit::WebFrame* web_frame, | 47 WebKit::WebFrame* web_frame, |
47 const Extension* extension, | 48 const extensions::Extension* extension, |
48 Feature::Context context_type) | 49 Feature::Context context_type) |
49 : v8_context_(v8::Persistent<v8::Context>::New(v8_context)), | 50 : v8_context_(v8::Persistent<v8::Context>::New(v8_context)), |
50 web_frame_(web_frame), | 51 web_frame_(web_frame), |
51 extension_(extension), | 52 extension_(extension), |
52 context_type_(context_type) { | 53 context_type_(context_type) { |
53 VLOG(1) << "Created context:\n" | 54 VLOG(1) << "Created context:\n" |
54 << " extension id: " << GetExtensionID() << "\n" | 55 << " extension id: " << GetExtensionID() << "\n" |
55 << " frame: " << web_frame_ << "\n" | 56 << " frame: " << web_frame_ << "\n" |
56 << " context type: " << GetContextTypeDescription(context_type); | 57 << " context type: " << GetContextTypeDescription(context_type); |
57 } | 58 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 argv[1] = v8::Boolean::New(is_extension_process); | 173 argv[1] = v8::Boolean::New(is_extension_process); |
173 argv[2] = v8::Boolean::New(is_incognito_process); | 174 argv[2] = v8::Boolean::New(is_incognito_process); |
174 argv[3] = v8::Integer::New(manifest_version); | 175 argv[3] = v8::Integer::New(manifest_version); |
175 CallChromeHiddenMethod("dispatchOnLoad", arraysize(argv), argv, NULL); | 176 CallChromeHiddenMethod("dispatchOnLoad", arraysize(argv), argv, NULL); |
176 } | 177 } |
177 | 178 |
178 void ChromeV8Context::DispatchOnUnloadEvent() { | 179 void ChromeV8Context::DispatchOnUnloadEvent() { |
179 v8::HandleScope handle_scope; | 180 v8::HandleScope handle_scope; |
180 CallChromeHiddenMethod("dispatchOnUnload", 0, NULL, NULL); | 181 CallChromeHiddenMethod("dispatchOnUnload", 0, NULL, NULL); |
181 } | 182 } |
OLD | NEW |