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/app_bindings.h" | 5 #include "chrome/renderer/extensions/app_bindings.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 if (!target_frame) { | 180 if (!target_frame) { |
181 return v8::ThrowException( | 181 return v8::ThrowException( |
182 v8::String::New("Could not find frame for specified object.")); | 182 v8::String::New("Could not find frame for specified object.")); |
183 } | 183 } |
184 | 184 |
185 return GetDetailsForFrameImpl(target_frame); | 185 return GetDetailsForFrameImpl(target_frame); |
186 } | 186 } |
187 | 187 |
188 v8::Handle<v8::Value> AppBindingsHandler::GetDetailsForFrameImpl( | 188 v8::Handle<v8::Value> AppBindingsHandler::GetDetailsForFrameImpl( |
189 WebFrame* frame) { | 189 WebFrame* frame) { |
190 const ::Extension* extension = | 190 const ::Extension* extension = dispatcher_->extensions()->GetByURL( |
191 dispatcher_->extensions()->GetByURL(frame->document().url()); | 191 ExtensionURLInfo(frame->document().securityOrigin(), |
| 192 frame->document().url())); |
192 if (!extension) | 193 if (!extension) |
193 return v8::Null(); | 194 return v8::Null(); |
194 | 195 |
195 scoped_ptr<DictionaryValue> manifest_copy( | 196 scoped_ptr<DictionaryValue> manifest_copy( |
196 extension->manifest_value()->DeepCopy()); | 197 extension->manifest_value()->DeepCopy()); |
197 manifest_copy->SetString("id", extension->id()); | 198 manifest_copy->SetString("id", extension->id()); |
198 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 199 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
199 return converter->ToV8Value(manifest_copy.get(), | 200 return converter->ToV8Value(manifest_copy.get(), |
200 frame->mainWorldScriptContext()); | 201 frame->mainWorldScriptContext()); |
201 } | 202 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 const std::string& channel_id, const std::string& error, int callback_id) { | 253 const std::string& channel_id, const std::string& error, int callback_id) { |
253 v8::HandleScope handle_scope; | 254 v8::HandleScope handle_scope; |
254 v8::Context::Scope context_scope(context_->v8_context()); | 255 v8::Context::Scope context_scope(context_->v8_context()); |
255 v8::Handle<v8::Value> argv[3]; | 256 v8::Handle<v8::Value> argv[3]; |
256 argv[0] = v8::String::New(channel_id.c_str()); | 257 argv[0] = v8::String::New(channel_id.c_str()); |
257 argv[1] = v8::String::New(error.c_str()); | 258 argv[1] = v8::String::New(error.c_str()); |
258 argv[2] = v8::Integer::New(callback_id); | 259 argv[2] = v8::Integer::New(callback_id); |
259 CHECK(context_->CallChromeHiddenMethod("app.onGetAppNotifyChannelResponse", | 260 CHECK(context_->CallChromeHiddenMethod("app.onGetAppNotifyChannelResponse", |
260 arraysize(argv), argv, NULL)); | 261 arraysize(argv), argv, NULL)); |
261 } | 262 } |
OLD | NEW |