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 "content/renderer/mojo_context_state.h" | 5 #include "content/renderer/mojo_context_state.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 } // namespace | 93 } // namespace |
94 | 94 |
95 MojoContextState::MojoContextState(blink::WebFrame* frame, | 95 MojoContextState::MojoContextState(blink::WebFrame* frame, |
96 v8::Local<v8::Context> context, | 96 v8::Local<v8::Context> context, |
97 bool for_layout_tests) | 97 bool for_layout_tests) |
98 : frame_(frame), | 98 : frame_(frame), |
99 module_added_(false), | 99 module_added_(false), |
100 module_prefix_(for_layout_tests | 100 module_prefix_(for_layout_tests |
101 ? "layout-test-mojom://" | 101 ? "layout-test-mojom://" |
102 : frame_->securityOrigin().toString().utf8() + "/") { | 102 : frame_->getSecurityOrigin().toString().utf8() + |
| 103 "/") { |
103 gin::PerContextData* context_data = gin::PerContextData::From(context); | 104 gin::PerContextData* context_data = gin::PerContextData::From(context); |
104 gin::ContextHolder* context_holder = context_data->context_holder(); | 105 gin::ContextHolder* context_holder = context_data->context_holder(); |
105 runner_.reset(new MojoMainRunner(frame_, context_holder)); | 106 runner_.reset(new MojoMainRunner(frame_, context_holder)); |
106 gin::Runner::Scope scoper(runner_.get()); | 107 gin::Runner::Scope scoper(runner_.get()); |
107 gin::ModuleRegistry::From(context)->AddObserver(this); | 108 gin::ModuleRegistry::From(context)->AddObserver(this); |
108 content::RenderFrame::FromWebFrame(frame) | 109 content::RenderFrame::FromWebFrame(frame) |
109 ->EnsureMojoBuiltinsAreAvailable(context_holder->isolate(), context); | 110 ->EnsureMojoBuiltinsAreAvailable(context_holder->isolate(), context); |
110 v8::Local<v8::Object> install_target; | 111 v8::Local<v8::Object> install_target; |
111 if (for_layout_tests) { | 112 if (for_layout_tests) { |
112 // In layout tests we install the module system under 'mojo.define' | 113 // In layout tests we install the module system under 'mojo.define' |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 const std::vector<std::string>& dependencies) { | 200 const std::vector<std::string>& dependencies) { |
200 FetchModules(dependencies); | 201 FetchModules(dependencies); |
201 | 202 |
202 gin::ContextHolder* context_holder = runner_->GetContextHolder(); | 203 gin::ContextHolder* context_holder = runner_->GetContextHolder(); |
203 gin::ModuleRegistry* registry = gin::ModuleRegistry::From( | 204 gin::ModuleRegistry* registry = gin::ModuleRegistry::From( |
204 context_holder->context()); | 205 context_holder->context()); |
205 registry->AttemptToLoadMoreModules(context_holder->isolate()); | 206 registry->AttemptToLoadMoreModules(context_holder->isolate()); |
206 } | 207 } |
207 | 208 |
208 } // namespace content | 209 } // namespace content |
OLD | NEW |