OLD | NEW |
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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 | 711 |
712 v8::Handle<v8::Object> new_object = v8::Object::New(); | 712 v8::Handle<v8::Object> new_object = v8::Object::New(); |
713 object->Set(key, new_object); | 713 object->Set(key, new_object); |
714 return handle_scope.Close(new_object); | 714 return handle_scope.Close(new_object); |
715 } | 715 } |
716 | 716 |
717 void Dispatcher::RegisterSchemaGeneratedBindings( | 717 void Dispatcher::RegisterSchemaGeneratedBindings( |
718 ModuleSystem* module_system, | 718 ModuleSystem* module_system, |
719 ChromeV8Context* context) { | 719 ChromeV8Context* context) { |
720 std::set<std::string> apis = | 720 std::set<std::string> apis = |
721 ExtensionAPI::GetSharedInstance()->GetAllAPINames(); | 721 BaseFeatureProvider::GetByName("api")->GetAllFeatureNames(); |
722 for (std::set<std::string>::iterator it = apis.begin(); | 722 for (std::set<std::string>::iterator it = apis.begin(); |
723 it != apis.end(); ++it) { | 723 it != apis.end(); ++it) { |
724 const std::string& api_name = *it; | 724 const std::string& api_name = *it; |
| 725 |
| 726 std::string child_name; |
| 727 ExtensionAPI::GetSharedInstance()->GetAPINameFromFullName(api_name, |
| 728 &child_name); |
| 729 if (!child_name.empty()) |
| 730 continue; |
| 731 |
725 if (!context->IsAnyFeatureAvailableToContext(api_name)) | 732 if (!context->IsAnyFeatureAvailableToContext(api_name)) |
726 continue; | 733 continue; |
727 | 734 |
728 Feature* feature = | 735 Feature* feature = |
729 BaseFeatureProvider::GetByName("api")->GetFeature(api_name); | 736 BaseFeatureProvider::GetByName("api")->GetFeature(api_name); |
730 if (feature && feature->IsInternal()) | 737 if (feature && feature->IsInternal()) |
731 continue; | 738 continue; |
732 | 739 |
733 std::vector<std::string> split; | 740 std::vector<std::string> split; |
734 base::SplitString(api_name, '.', &split); | 741 base::SplitString(api_name, '.', &split); |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1458 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
1452 v8::ThrowException( | 1459 v8::ThrowException( |
1453 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1460 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
1454 return false; | 1461 return false; |
1455 } | 1462 } |
1456 | 1463 |
1457 return true; | 1464 return true; |
1458 } | 1465 } |
1459 | 1466 |
1460 } // namespace extensions | 1467 } // namespace extensions |
OLD | NEW |