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

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

Issue 9950046: Implement FeatureProvider for ExtensionAPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 case Feature::CONTENT_SCRIPT_CONTEXT: { 536 case Feature::CONTENT_SCRIPT_CONTEXT: {
537 module_system->Require("miscellaneous_bindings"); 537 module_system->Require("miscellaneous_bindings");
538 module_system->Require("schema_generated_bindings"); 538 module_system->Require("schema_generated_bindings");
539 module_system->Require("apitest"); 539 module_system->Require("apitest");
540 540
541 // TODO(kalman): move this code back out of the switch and execute it 541 // TODO(kalman): move this code back out of the switch and execute it
542 // regardless of |context_type|. ExtensionAPI knows how to return the 542 // regardless of |context_type|. ExtensionAPI knows how to return the
543 // correct APIs, however, until it doesn't have a 2MB overhead we can't 543 // correct APIs, however, until it doesn't have a 2MB overhead we can't
544 // load it in every process. 544 // load it in every process.
545 scoped_ptr<std::set<std::string> > apis = 545 scoped_ptr<std::set<std::string> > apis =
546 ExtensionAPI::GetInstance()->GetAPIsForContext( 546 ExtensionAPI::GetSharedInstance()->GetAPIsForContext(
547 context_type, extension, url_info.url()); 547 context_type, extension, url_info.url());
548 for (std::set<std::string>::iterator i = apis->begin(); i != apis->end(); 548 for (std::set<std::string>::iterator i = apis->begin(); i != apis->end();
549 ++i) { 549 ++i) {
550 InstallBindings(module_system.get(), v8_context, *i); 550 InstallBindings(module_system.get(), v8_context, *i);
551 } 551 }
552 552
553 break; 553 break;
554 } 554 }
555 } 555 }
556 556
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 return Feature::BLESSED_EXTENSION_CONTEXT; 747 return Feature::BLESSED_EXTENSION_CONTEXT;
748 748
749 if (extensions_.ExtensionBindingsAllowed(url_info)) 749 if (extensions_.ExtensionBindingsAllowed(url_info))
750 return Feature::UNBLESSED_EXTENSION_CONTEXT; 750 return Feature::UNBLESSED_EXTENSION_CONTEXT;
751 751
752 if (url_info.url().is_valid()) 752 if (url_info.url().is_valid())
753 return Feature::WEB_PAGE_CONTEXT; 753 return Feature::WEB_PAGE_CONTEXT;
754 754
755 return Feature::UNSPECIFIED_CONTEXT; 755 return Feature::UNSPECIFIED_CONTEXT;
756 } 756 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698