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