OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/extensions/extension_set.h" | 10 #include "chrome/common/extensions/extension_set.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 v8::Local<v8::Object> global = context->Global(); | 48 v8::Local<v8::Object> global = context->Global(); |
49 v8::Local<v8::Value> hidden = global->GetHiddenValue( | 49 v8::Local<v8::Value> hidden = global->GetHiddenValue( |
50 v8::String::New(kChromeHidden)); | 50 v8::String::New(kChromeHidden)); |
51 | 51 |
52 if (hidden.IsEmpty() || hidden->IsUndefined()) { | 52 if (hidden.IsEmpty() || hidden->IsUndefined()) { |
53 hidden = v8::Object::New(); | 53 hidden = v8::Object::New(); |
54 global->SetHiddenValue(v8::String::New(kChromeHidden), hidden); | 54 global->SetHiddenValue(v8::String::New(kChromeHidden), hidden); |
55 | 55 |
56 #ifndef NDEBUG | 56 #ifndef NDEBUG |
57 // Tell schema_generated_bindings.js to validate callbacks and events | 57 // Tell schema_generated_bindings.js to validate callbacks and events |
58 // against their schema definitions in api/extension_api.json. | 58 // against their schema definitions in api/. |
Aaron Boodman
2011/12/07 23:30:35
can just remove " in api/"
koz (OOO until 15th September)
2011/12/09 19:24:18
Done.
| |
59 v8::Local<v8::Object>::Cast(hidden) | 59 v8::Local<v8::Object>::Cast(hidden) |
60 ->Set(v8::String::New(kValidateCallbacks), v8::True()); | 60 ->Set(v8::String::New(kValidateCallbacks), v8::True()); |
61 #endif | 61 #endif |
62 } | 62 } |
63 | 63 |
64 DCHECK(hidden->IsObject()); | 64 DCHECK(hidden->IsObject()); |
65 return v8::Local<v8::Object>::Cast(hidden); | 65 return v8::Local<v8::Object>::Cast(hidden); |
66 } | 66 } |
67 | 67 |
68 v8::Handle<v8::Value> ChromeV8Context::GetChromeHidden() const { | 68 v8::Handle<v8::Value> ChromeV8Context::GetChromeHidden() const { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 argv[0] = v8::String::New(extension_id_.c_str()); | 118 argv[0] = v8::String::New(extension_id_.c_str()); |
119 argv[1] = v8::Boolean::New(is_extension_process); | 119 argv[1] = v8::Boolean::New(is_extension_process); |
120 argv[2] = v8::Boolean::New(is_incognito_process); | 120 argv[2] = v8::Boolean::New(is_incognito_process); |
121 CallChromeHiddenMethod("dispatchOnLoad", arraysize(argv), argv, NULL); | 121 CallChromeHiddenMethod("dispatchOnLoad", arraysize(argv), argv, NULL); |
122 } | 122 } |
123 | 123 |
124 void ChromeV8Context::DispatchOnUnloadEvent() const { | 124 void ChromeV8Context::DispatchOnUnloadEvent() const { |
125 v8::HandleScope handle_scope; | 125 v8::HandleScope handle_scope; |
126 CallChromeHiddenMethod("dispatchOnUnload", 0, NULL, NULL); | 126 CallChromeHiddenMethod("dispatchOnUnload", 0, NULL, NULL); |
127 } | 127 } |
OLD | NEW |