OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "apps/shell/renderer/shell_extensions_renderer_client.h" | 5 #include "apps/shell/renderer/shell_extensions_renderer_client.h" |
6 | 6 |
| 7 #include "apps/shell/renderer/shell_custom_bindings.h" |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/renderer/resource_bundle_source_map.h" |
| 10 #include "extensions/renderer/module_system.h" |
| 11 #include "grit/app_shell_resources.h" |
| 12 |
7 namespace apps { | 13 namespace apps { |
8 | 14 |
9 ShellExtensionsRendererClient::ShellExtensionsRendererClient() {} | 15 ShellExtensionsRendererClient::ShellExtensionsRendererClient() {} |
10 | 16 |
11 ShellExtensionsRendererClient::~ShellExtensionsRendererClient() {} | 17 ShellExtensionsRendererClient::~ShellExtensionsRendererClient() {} |
12 | 18 |
13 bool ShellExtensionsRendererClient::IsIncognitoProcess() const { | 19 bool ShellExtensionsRendererClient::IsIncognitoProcess() const { |
14 // app_shell doesn't support off-the-record contexts. | 20 // app_shell doesn't support off-the-record contexts. |
15 return false; | 21 return false; |
16 } | 22 } |
17 | 23 |
18 int ShellExtensionsRendererClient::GetLowestIsolatedWorldId() const { | 24 int ShellExtensionsRendererClient::GetLowestIsolatedWorldId() const { |
19 // app_shell doesn't need to reserve world IDs for anything other than | 25 // app_shell doesn't need to reserve world IDs for anything other than |
20 // extensions, so we always return 1. Note that 0 is reserved for the global | 26 // extensions, so we always return 1. Note that 0 is reserved for the global |
21 // world. | 27 // world. |
22 return 1; | 28 return 1; |
23 } | 29 } |
24 | 30 |
| 31 void ShellExtensionsRendererClient::RegisterNativeHandlers( |
| 32 extensions::ModuleSystem* module_system, |
| 33 extensions::ScriptContext* context) { |
| 34 module_system->RegisterNativeHandler( |
| 35 "shell_natives", |
| 36 scoped_ptr<extensions::NativeHandler>(new ShellCustomBindings(context))); |
| 37 } |
| 38 |
| 39 void ShellExtensionsRendererClient::PopulateSourceMap( |
| 40 ResourceBundleSourceMap* source_map) { |
| 41 source_map->RegisterSource("shell", IDR_SHELL_CUSTOM_BINDINGS_JS); |
| 42 } |
| 43 |
25 } // namespace apps | 44 } // namespace apps |
OLD | NEW |