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 "sky/viewer/document_view.h" | 5 #include "sky/viewer/document_view.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 void DocumentView::didCreateScriptContext(blink::WebLocalFrame* frame, | 272 void DocumentView::didCreateScriptContext(blink::WebLocalFrame* frame, |
273 v8::Handle<v8::Context> context) { | 273 v8::Handle<v8::Context> context) { |
274 script_runner_.reset(new ScriptRunner(frame, context)); | 274 script_runner_.reset(new ScriptRunner(frame, context)); |
275 | 275 |
276 v8::Isolate* isolate = context->GetIsolate(); | 276 v8::Isolate* isolate = context->GetIsolate(); |
277 gin::Handle<Internals> internals = Internals::Create(isolate, this); | 277 gin::Handle<Internals> internals = Internals::Create(isolate, this); |
278 context->Global()->Set(gin::StringToV8(isolate, "internals"), | 278 context->Global()->Set(gin::StringToV8(isolate, "internals"), |
279 gin::ConvertToV8(isolate, internals)); | 279 gin::ConvertToV8(isolate, internals)); |
280 } | 280 } |
281 | 281 |
282 blink::ServiceProvider& DocumentView::services() { | 282 blink::ServiceProvider* DocumentView::services() { |
283 return *this; | 283 return this; |
284 } | 284 } |
285 | 285 |
286 mojo::NavigatorHost* DocumentView::NavigatorHost() { | 286 mojo::NavigatorHost* DocumentView::NavigatorHost() { |
287 return navigator_host_.get(); | 287 return navigator_host_.get(); |
288 } | 288 } |
289 | 289 |
290 mojo::Shell* DocumentView::Shell() { | |
291 return shell_; | |
292 } | |
293 | |
294 void DocumentView::OnViewBoundsChanged(mojo::View* view, | 290 void DocumentView::OnViewBoundsChanged(mojo::View* view, |
295 const mojo::Rect& old_bounds, | 291 const mojo::Rect& old_bounds, |
296 const mojo::Rect& new_bounds) { | 292 const mojo::Rect& new_bounds) { |
297 DCHECK_EQ(view, root_); | 293 DCHECK_EQ(view, root_); |
298 UpdateRootSizeAndViewportMetrics(new_bounds); | 294 UpdateRootSizeAndViewportMetrics(new_bounds); |
299 } | 295 } |
300 | 296 |
301 void DocumentView::OnViewViewportMetricsChanged( | 297 void DocumentView::OnViewViewportMetricsChanged( |
302 mojo::View* view, | 298 mojo::View* view, |
303 const mojo::ViewportMetrics& old_metrics, | 299 const mojo::ViewportMetrics& old_metrics, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 void DocumentView::StartDebuggerInspectorBackend() { | 376 void DocumentView::StartDebuggerInspectorBackend() { |
381 if (!inspector_backend_) { | 377 if (!inspector_backend_) { |
382 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); | 378 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); |
383 inspector_backend_.reset( | 379 inspector_backend_.reset( |
384 new inspector::InspectorBackendMojo(inspector_host_.get())); | 380 new inspector::InspectorBackendMojo(inspector_host_.get())); |
385 } | 381 } |
386 inspector_backend_->Connect(); | 382 inspector_backend_->Connect(); |
387 } | 383 } |
388 | 384 |
389 } // namespace sky | 385 } // namespace sky |
OLD | NEW |