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

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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 187 }
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 = 191 const ::Extension* extension =
191 dispatcher_->extensions()->GetByURL(frame->document().url()); 192 dispatcher_->extensions()->GetByURL(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 }
202 203
203 v8::Handle<v8::Value> AppBindingsHandler::GetAppNotifyChannel( 204 v8::Handle<v8::Value> AppBindingsHandler::GetAppNotifyChannel(
204 const v8::Arguments& args) { 205 const v8::Arguments& args) {
205 // Read the required 'clientId' value out of the object at args[0]. 206 // Read the required 'clientId' value out of the object at args[0].
206 std::string client_id; 207 std::string client_id;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698