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

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

Issue 109683007: Pass a Feature* to IsAnyFeatureAvailableToContext instead of a string name. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update extension_api_stub.cc Created 7 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
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context.cc ('k') | extensions/common/extension_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/dispatcher.h" 5 #include "chrome/renderer/extensions/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/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 // Internal APIs are included via require(api_name) from internal code 748 // Internal APIs are included via require(api_name) from internal code
749 // rather than chrome[api_name]. 749 // rather than chrome[api_name].
750 if (feature->IsInternal()) 750 if (feature->IsInternal())
751 continue; 751 continue;
752 752
753 // If this API name has parent features, then this must be a function or 753 // If this API name has parent features, then this must be a function or
754 // event, so we should not register. 754 // event, so we should not register.
755 bool parent_feature_available = false; 755 bool parent_feature_available = false;
756 for (Feature* parent = api_feature_provider->GetParent(feature); 756 for (Feature* parent = api_feature_provider->GetParent(feature);
757 parent != NULL; parent = api_feature_provider->GetParent(parent)) { 757 parent != NULL; parent = api_feature_provider->GetParent(parent)) {
758 if (context->IsAnyFeatureAvailableToContext(parent->name())) { 758 if (context->IsAnyFeatureAvailableToContext(*parent)) {
759 parent_feature_available = true; 759 parent_feature_available = true;
760 break; 760 break;
761 } 761 }
762 } 762 }
763 if (parent_feature_available) 763 if (parent_feature_available)
764 continue; 764 continue;
765 765
766 if (context->IsAnyFeatureAvailableToContext(api_name)) 766 if (context->IsAnyFeatureAvailableToContext(*feature))
767 RegisterBinding(api_name, context); 767 RegisterBinding(api_name, context);
768 } 768 }
769 break; 769 break;
770 } 770 }
771 } 771 }
772 } 772 }
773 773
774 v8::Handle<v8::Object> Dispatcher::GetOrCreateBindObjectIfAvailable( 774 v8::Handle<v8::Object> Dispatcher::GetOrCreateBindObjectIfAvailable(
775 const std::string& api_name, 775 const std::string& api_name,
776 std::string* bind_name, 776 std::string* bind_name,
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 RenderView* background_view = 1656 RenderView* background_view =
1657 ExtensionHelper::GetBackgroundPage(extension_id); 1657 ExtensionHelper::GetBackgroundPage(extension_id);
1658 if (background_view) { 1658 if (background_view) {
1659 background_view->Send(new ExtensionHostMsg_EventAck( 1659 background_view->Send(new ExtensionHostMsg_EventAck(
1660 background_view->GetRoutingID())); 1660 background_view->GetRoutingID()));
1661 } 1661 }
1662 } 1662 }
1663 } 1663 }
1664 1664
1665 } // namespace extensions 1665 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context.cc ('k') | extensions/common/extension_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698