| 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 "chromecast/renderer/cast_content_renderer_client.h" | 5 #include "chromecast/renderer/cast_content_renderer_client.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 gin::Runner::Scope scoper(runner); | 163 gin::Runner::Scope scoper(runner); |
| 164 | 164 |
| 165 // Initialize AMD API for Mojo. | 165 // Initialize AMD API for Mojo. |
| 166 render_frame->EnsureMojoBuiltinsAreAvailable(context->GetIsolate(), context); | 166 render_frame->EnsureMojoBuiltinsAreAvailable(context->GetIsolate(), context); |
| 167 gin::ModuleRegistry::InstallGlobals(context->GetIsolate(), context->Global()); | 167 gin::ModuleRegistry::InstallGlobals(context->GetIsolate(), context->Global()); |
| 168 | 168 |
| 169 // Inject JavaScript files in the correct dependency order. | 169 // Inject JavaScript files in the correct dependency order. |
| 170 static const int mojo_resource_ids[] = { | 170 static const int mojo_resource_ids[] = { |
| 171 IDR_MOJO_UNICODE_JS, | 171 IDR_MOJO_UNICODE_JS, |
| 172 IDR_MOJO_BUFFER_JS, | 172 IDR_MOJO_BUFFER_JS, |
| 173 IDR_MOJO_INTERFACE_TYPES_JS, |
| 173 IDR_MOJO_CODEC_JS, | 174 IDR_MOJO_CODEC_JS, |
| 174 IDR_MOJO_CONNECTOR_JS, | 175 IDR_MOJO_CONNECTOR_JS, |
| 175 IDR_MOJO_VALIDATOR_JS, | 176 IDR_MOJO_VALIDATOR_JS, |
| 176 IDR_MOJO_ROUTER_JS, | 177 IDR_MOJO_ROUTER_JS, |
| 177 IDR_MOJO_BINDINGS_JS, | 178 IDR_MOJO_BINDINGS_JS, |
| 178 IDR_MOJO_CONNECTION_JS, | 179 IDR_MOJO_CONNECTION_JS, |
| 179 }; | 180 }; |
| 180 for (size_t i = 0; i < arraysize(mojo_resource_ids); i++) { | 181 for (size_t i = 0; i < arraysize(mojo_resource_ids); i++) { |
| 181 ExecuteJavaScript(render_frame, mojo_resource_ids[i]); | 182 ExecuteJavaScript(render_frame, mojo_resource_ids[i]); |
| 182 } | 183 } |
| 183 } | 184 } |
| 184 | 185 |
| 185 void ExecuteJavaScript(content::RenderFrame* render_frame, int resource_id) { | 186 void ExecuteJavaScript(content::RenderFrame* render_frame, int resource_id) { |
| 186 const std::string& js_string = ui::ResourceBundle::GetSharedInstance() | 187 const std::string& js_string = ui::ResourceBundle::GetSharedInstance() |
| 187 .GetRawDataResource(resource_id) | 188 .GetRawDataResource(resource_id) |
| 188 .as_string(); | 189 .as_string(); |
| 189 render_frame->ExecuteJavaScript(base::UTF8ToUTF16(js_string)); | 190 render_frame->ExecuteJavaScript(base::UTF8ToUTF16(js_string)); |
| 190 } | 191 } |
| 191 | 192 |
| 192 } // namespace shell | 193 } // namespace shell |
| 193 } // namespace chromecast | 194 } // namespace chromecast |
| OLD | NEW |