Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/renderer/extensions/app_bindings.cc

Issue 8654001: Reland restrict extension features based on the extension type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/extensions/extension_messages.h" 13 #include "chrome/common/extensions/extension_messages.h"
14 #include "chrome/common/extensions/extension_set.h" 14 #include "chrome/common/extensions/extension_set.h"
15 #include "chrome/common/extensions/manifest.h"
15 #include "chrome/renderer/extensions/chrome_v8_context.h" 16 #include "chrome/renderer/extensions/chrome_v8_context.h"
16 #include "chrome/renderer/extensions/extension_dispatcher.h" 17 #include "chrome/renderer/extensions/extension_dispatcher.h"
17 #include "chrome/renderer/extensions/extension_helper.h" 18 #include "chrome/renderer/extensions/extension_helper.h"
18 #include "content/public/renderer/v8_value_converter.h" 19 #include "content/public/renderer/v8_value_converter.h"
19 #include "content/public/renderer/render_view.h" 20 #include "content/public/renderer/render_view.h"
20 #include "grit/renderer_resources.h" 21 #include "grit/renderer_resources.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
23 #include "v8/include/v8.h" 24 #include "v8/include/v8.h"
24 25
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 188
188 v8::Handle<v8::Value> AppBindingsHandler::GetDetailsForFrameImpl( 189 v8::Handle<v8::Value> AppBindingsHandler::GetDetailsForFrameImpl(
189 WebFrame* frame) { 190 WebFrame* frame) {
190 const ::Extension* extension = dispatcher_->extensions()->GetByURL( 191 const ::Extension* extension = dispatcher_->extensions()->GetByURL(
191 ExtensionURLInfo(frame->document().securityOrigin(), 192 ExtensionURLInfo(frame->document().securityOrigin(),
192 frame->document().url())); 193 frame->document().url()));
193 if (!extension) 194 if (!extension)
194 return v8::Null(); 195 return v8::Null();
195 196
196 scoped_ptr<DictionaryValue> manifest_copy( 197 scoped_ptr<DictionaryValue> manifest_copy(
197 extension->manifest_value()->DeepCopy()); 198 extension->manifest()->value()->DeepCopy());
198 manifest_copy->SetString("id", extension->id()); 199 manifest_copy->SetString("id", extension->id());
199 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); 200 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create());
200 return converter->ToV8Value(manifest_copy.get(), 201 return converter->ToV8Value(manifest_copy.get(),
201 frame->mainWorldScriptContext()); 202 frame->mainWorldScriptContext());
202 } 203 }
203 204
204 v8::Handle<v8::Value> AppBindingsHandler::GetAppNotifyChannel( 205 v8::Handle<v8::Value> AppBindingsHandler::GetAppNotifyChannel(
205 const v8::Arguments& args) { 206 const v8::Arguments& args) {
206 // Read the required 'clientId' value out of the object at args[0]. 207 // Read the required 'clientId' value out of the object at args[0].
207 std::string client_id; 208 std::string client_id;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 const std::string& channel_id, const std::string& error, int callback_id) { 254 const std::string& channel_id, const std::string& error, int callback_id) {
254 v8::HandleScope handle_scope; 255 v8::HandleScope handle_scope;
255 v8::Context::Scope context_scope(context_->v8_context()); 256 v8::Context::Scope context_scope(context_->v8_context());
256 v8::Handle<v8::Value> argv[3]; 257 v8::Handle<v8::Value> argv[3];
257 argv[0] = v8::String::New(channel_id.c_str()); 258 argv[0] = v8::String::New(channel_id.c_str());
258 argv[1] = v8::String::New(error.c_str()); 259 argv[1] = v8::String::New(error.c_str());
259 argv[2] = v8::Integer::New(callback_id); 260 argv[2] = v8::Integer::New(callback_id);
260 CHECK(context_->CallChromeHiddenMethod("app.onGetAppNotifyChannelResponse", 261 CHECK(context_->CallChromeHiddenMethod("app.onGetAppNotifyChannelResponse",
261 arraysize(argv), argv, NULL)); 262 arraysize(argv), argv, NULL));
262 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698