| 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/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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 source_map_.RegisterSource("pageAction", IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS); | 544 source_map_.RegisterSource("pageAction", IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS); |
| 545 source_map_.RegisterSource("pageCapture", | 545 source_map_.RegisterSource("pageCapture", |
| 546 IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS); | 546 IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS); |
| 547 source_map_.RegisterSource("platformApp", IDR_PLATFORM_APP_JS); | 547 source_map_.RegisterSource("platformApp", IDR_PLATFORM_APP_JS); |
| 548 source_map_.RegisterSource("storage", IDR_STORAGE_CUSTOM_BINDINGS_JS); | 548 source_map_.RegisterSource("storage", IDR_STORAGE_CUSTOM_BINDINGS_JS); |
| 549 source_map_.RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS); | 549 source_map_.RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS); |
| 550 source_map_.RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); | 550 source_map_.RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); |
| 551 source_map_.RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); | 551 source_map_.RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); |
| 552 source_map_.RegisterSource("types", IDR_TYPES_CUSTOM_BINDINGS_JS); | 552 source_map_.RegisterSource("types", IDR_TYPES_CUSTOM_BINDINGS_JS); |
| 553 source_map_.RegisterSource("webRequest", IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS); | 553 source_map_.RegisterSource("webRequest", IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS); |
| 554 source_map_.RegisterSource("webRequestInternal", |
| 555 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS); |
| 554 source_map_.RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); | 556 source_map_.RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); |
| 555 } | 557 } |
| 556 | 558 |
| 557 void ExtensionDispatcher::PopulateLazyBindingsMap() { | 559 void ExtensionDispatcher::PopulateLazyBindingsMap() { |
| 558 lazy_bindings_map_["app"] = InstallAppBindings; | 560 lazy_bindings_map_["app"] = InstallAppBindings; |
| 559 lazy_bindings_map_["webstore"] = InstallWebstoreBindings; | 561 lazy_bindings_map_["webstore"] = InstallWebstoreBindings; |
| 560 } | 562 } |
| 561 | 563 |
| 562 void ExtensionDispatcher::InstallBindings(ModuleSystem* module_system, | 564 void ExtensionDispatcher::InstallBindings(ModuleSystem* module_system, |
| 563 v8::Handle<v8::Context> v8_context, | 565 v8::Handle<v8::Context> v8_context, |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 static const char kMessage[] = | 901 static const char kMessage[] = |
| 900 "%s can only be used in an extension process."; | 902 "%s can only be used in an extension process."; |
| 901 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 903 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
| 902 v8::ThrowException( | 904 v8::ThrowException( |
| 903 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 905 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
| 904 return false; | 906 return false; |
| 905 } | 907 } |
| 906 | 908 |
| 907 return true; | 909 return true; |
| 908 } | 910 } |
| OLD | NEW |