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/string_piece.h" | 10 #include "base/string_piece.h" |
11 #include "chrome/common/child_process_logging.h" | 11 #include "chrome/common/child_process_logging.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/chrome_version_info.h" | 13 #include "chrome/common/chrome_version_info.h" |
14 #include "chrome/common/extensions/api/extension_api.h" | 14 #include "chrome/common/extensions/api/extension_api.h" |
15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
16 #include "chrome/common/extensions/extension_messages.h" | 16 #include "chrome/common/extensions/extension_messages.h" |
| 17 #include "chrome/common/extensions/manifest.h" |
17 #include "chrome/common/extensions/permissions/permission_set.h" | 18 #include "chrome/common/extensions/permissions/permission_set.h" |
18 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
19 #include "chrome/common/view_type.h" | 20 #include "chrome/common/view_type.h" |
20 #include "chrome/renderer/chrome_render_process_observer.h" | 21 #include "chrome/renderer/chrome_render_process_observer.h" |
21 #include "chrome/renderer/extensions/api_definitions_natives.h" | 22 #include "chrome/renderer/extensions/api_definitions_natives.h" |
22 #include "chrome/renderer/extensions/app_bindings.h" | 23 #include "chrome/renderer/extensions/app_bindings.h" |
23 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" | 24 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" |
24 #include "chrome/renderer/extensions/app_window_custom_bindings.h" | 25 #include "chrome/renderer/extensions/app_window_custom_bindings.h" |
25 #include "chrome/renderer/extensions/chrome_v8_context.h" | 26 #include "chrome/renderer/extensions/chrome_v8_context.h" |
26 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 27 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 scoped_ptr<NativeHandler>(new ChromeHiddenNativeHandler())); | 768 scoped_ptr<NativeHandler>(new ChromeHiddenNativeHandler())); |
768 module_system->RegisterNativeHandler("print", | 769 module_system->RegisterNativeHandler("print", |
769 scoped_ptr<NativeHandler>(new PrintNativeHandler())); | 770 scoped_ptr<NativeHandler>(new PrintNativeHandler())); |
770 module_system->RegisterNativeHandler("lazy_background_page", | 771 module_system->RegisterNativeHandler("lazy_background_page", |
771 scoped_ptr<NativeHandler>(new LazyBackgroundPageNativeHandler(this))); | 772 scoped_ptr<NativeHandler>(new LazyBackgroundPageNativeHandler(this))); |
772 module_system->RegisterNativeHandler("logging", | 773 module_system->RegisterNativeHandler("logging", |
773 scoped_ptr<NativeHandler>(new LoggingNativeHandler())); | 774 scoped_ptr<NativeHandler>(new LoggingNativeHandler())); |
774 | 775 |
775 int manifest_version = extension ? extension->manifest_version() : 1; | 776 int manifest_version = extension ? extension->manifest_version() : 1; |
776 bool send_request_disabled = | 777 bool send_request_disabled = |
777 (extension && extension->location() == Extension::LOAD && | 778 (extension && extension->location() == Manifest::LOAD && |
778 extension->has_lazy_background_page()); | 779 extension->has_lazy_background_page()); |
779 module_system->RegisterNativeHandler("process", | 780 module_system->RegisterNativeHandler("process", |
780 scoped_ptr<NativeHandler>(new ProcessInfoNativeHandler( | 781 scoped_ptr<NativeHandler>(new ProcessInfoNativeHandler( |
781 this, context->GetExtensionID(), | 782 this, context->GetExtensionID(), |
782 context->GetContextTypeDescription(), | 783 context->GetContextTypeDescription(), |
783 ChromeRenderProcessObserver::is_incognito_process(), | 784 ChromeRenderProcessObserver::is_incognito_process(), |
784 manifest_version, send_request_disabled))); | 785 manifest_version, send_request_disabled))); |
785 | 786 |
786 GetOrCreateChrome(v8_context); | 787 GetOrCreateChrome(v8_context); |
787 | 788 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1145 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
1145 v8::ThrowException( | 1146 v8::ThrowException( |
1146 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1147 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
1147 return false; | 1148 return false; |
1148 } | 1149 } |
1149 | 1150 |
1150 return true; | 1151 return true; |
1151 } | 1152 } |
1152 | 1153 |
1153 } // namespace extensions | 1154 } // namespace extensions |
OLD | NEW |