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

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

Issue 10703111: Cleanup: make ExtensionRequestSender manage its IPC responses directly, rather (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert sceopd_observer change Created 8 years, 5 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extension_dispatcher.h" 5 #include "chrome/renderer/extensions/extension_dispatcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 983
984 if (extensions_.ExtensionBindingsAllowed(url_info)) 984 if (extensions_.ExtensionBindingsAllowed(url_info))
985 return Feature::UNBLESSED_EXTENSION_CONTEXT; 985 return Feature::UNBLESSED_EXTENSION_CONTEXT;
986 986
987 if (url_info.url().is_valid()) 987 if (url_info.url().is_valid())
988 return Feature::WEB_PAGE_CONTEXT; 988 return Feature::WEB_PAGE_CONTEXT;
989 989
990 return Feature::UNSPECIFIED_CONTEXT; 990 return Feature::UNSPECIFIED_CONTEXT;
991 } 991 }
992 992
993 void ExtensionDispatcher::OnExtensionResponse(int request_id,
994 bool success,
995 const base::ListValue& response,
996 const std::string& error) {
997 request_sender_->HandleResponse(request_id, success, response, error);
998 }
999
1000 bool ExtensionDispatcher::CheckCurrentContextAccessToExtensionAPI( 993 bool ExtensionDispatcher::CheckCurrentContextAccessToExtensionAPI(
1001 const std::string& function_name) const { 994 const std::string& function_name) const {
1002 ChromeV8Context* context = v8_context_set().GetCurrent(); 995 ChromeV8Context* context = v8_context_set().GetCurrent();
1003 if (!context) { 996 if (!context) {
1004 DLOG(ERROR) << "Not in a v8::Context"; 997 DLOG(ERROR) << "Not in a v8::Context";
1005 return false; 998 return false;
1006 } 999 }
1007 1000
1008 if (!context->extension() || 1001 if (!context->extension() ||
1009 !context->extension()->HasAPIPermission(function_name)) { 1002 !context->extension()->HasAPIPermission(function_name)) {
(...skipping 20 matching lines...) Expand all
1030 // APIs, they don't get extension bindings injected. If we end up here it 1023 // APIs, they don't get extension bindings injected. If we end up here it
1031 // means that a sandboxed page somehow managed to invoke an API anyway, so 1024 // means that a sandboxed page somehow managed to invoke an API anyway, so
1032 // we should abort. 1025 // we should abort.
1033 WebKit::WebFrame* frame = context->web_frame(); 1026 WebKit::WebFrame* frame = context->web_frame();
1034 ExtensionURLInfo url_info(frame->document().securityOrigin(), 1027 ExtensionURLInfo url_info(frame->document().securityOrigin(),
1035 UserScriptSlave::GetDataSourceURLForFrame(frame)); 1028 UserScriptSlave::GetDataSourceURLForFrame(frame));
1036 CHECK(!extensions_.IsSandboxedPage(url_info)); 1029 CHECK(!extensions_.IsSandboxedPage(url_info));
1037 1030
1038 return true; 1031 return true;
1039 } 1032 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_dispatcher.h ('k') | chrome/renderer/extensions/extension_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698