| 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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 ModuleSystem* module_system, | 675 ModuleSystem* module_system, |
| 676 ChromeV8Context* context, | 676 ChromeV8Context* context, |
| 677 v8::Handle<v8::Context> v8_context) { | 677 v8::Handle<v8::Context> v8_context) { |
| 678 std::set<std::string> apis = | 678 std::set<std::string> apis = |
| 679 ExtensionAPI::GetSharedInstance()->GetAllAPINames(); | 679 ExtensionAPI::GetSharedInstance()->GetAllAPINames(); |
| 680 for (std::set<std::string>::iterator it = apis.begin(); | 680 for (std::set<std::string>::iterator it = apis.begin(); |
| 681 it != apis.end(); ++it) { | 681 it != apis.end(); ++it) { |
| 682 const std::string& api_name = *it; | 682 const std::string& api_name = *it; |
| 683 | 683 |
| 684 Feature* feature = | 684 Feature* feature = |
| 685 BaseFeatureProvider::GetAPIFeatures()->GetFeature(api_name); | 685 BaseFeatureProvider::GetFeaturesByName("api")->GetFeature(api_name); |
| 686 if (feature && feature->IsInternal()) | 686 if (feature && feature->IsInternal()) |
| 687 continue; | 687 continue; |
| 688 | 688 |
| 689 std::vector<std::string> split; | 689 std::vector<std::string> split; |
| 690 base::SplitString(api_name, '.', &split); | 690 base::SplitString(api_name, '.', &split); |
| 691 | 691 |
| 692 v8::Handle<v8::Object> bind_object = GetOrCreateChrome(v8_context); | 692 v8::Handle<v8::Object> bind_object = GetOrCreateChrome(v8_context); |
| 693 for (size_t i = 0; i < split.size() - 1; ++i) | 693 for (size_t i = 0; i < split.size() - 1; ++i) |
| 694 bind_object = GetOrCreateObject(bind_object, split[i]); | 694 bind_object = GetOrCreateObject(bind_object, split[i]); |
| 695 | 695 |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1374 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
| 1375 v8::ThrowException( | 1375 v8::ThrowException( |
| 1376 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1376 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
| 1377 return false; | 1377 return false; |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 return true; | 1380 return true; |
| 1381 } | 1381 } |
| 1382 | 1382 |
| 1383 } // namespace extensions | 1383 } // namespace extensions |
| OLD | NEW |