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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 web_view_->close(); | 91 web_view_->close(); |
92 if (root_) | 92 if (root_) |
93 root_->RemoveObserver(this); | 93 root_->RemoveObserver(this); |
94 } | 94 } |
95 | 95 |
96 base::WeakPtr<DocumentView> DocumentView::GetWeakPtr() { | 96 base::WeakPtr<DocumentView> DocumentView::GetWeakPtr() { |
97 return weak_factory_.GetWeakPtr(); | 97 return weak_factory_.GetWeakPtr(); |
98 } | 98 } |
99 | 99 |
100 void DocumentView::OnEmbed( | 100 void DocumentView::OnEmbed( |
101 mojo::ViewManager* view_manager, | |
102 mojo::View* root, | 101 mojo::View* root, |
103 mojo::ServiceProviderImpl* exported_services, | 102 mojo::ServiceProviderImpl* exported_services, |
104 scoped_ptr<mojo::ServiceProvider> imported_services) { | 103 scoped_ptr<mojo::ServiceProvider> imported_services) { |
105 | |
106 root_ = root; | 104 root_ = root; |
107 imported_services_ = imported_services.Pass(); | 105 imported_services_ = imported_services.Pass(); |
108 navigator_host_.set_service_provider(imported_services_.get()); | 106 navigator_host_.set_service_provider(imported_services_.get()); |
109 exported_services->AddService(&inspector_service_factory_); | 107 exported_services->AddService(&inspector_service_factory_); |
110 | 108 |
111 Load(response_.Pass()); | 109 Load(response_.Pass()); |
112 | 110 |
113 gfx::Size size = root_->bounds().To<gfx::Rect>().size(); | 111 gfx::Size size = root_->bounds().To<gfx::Rect>().size(); |
114 web_view_->resize(size); | 112 web_view_->resize(size); |
115 // TODO(abarth): We should ask the view whether it is focused instead of | 113 // TODO(abarth): We should ask the view whether it is focused instead of |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 void DocumentView::StartDebuggerInspectorBackend() { | 276 void DocumentView::StartDebuggerInspectorBackend() { |
279 if (!inspector_backend_) { | 277 if (!inspector_backend_) { |
280 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); | 278 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); |
281 inspector_backend_.reset( | 279 inspector_backend_.reset( |
282 new inspector::InspectorBackendMojo(inspector_host_.get())); | 280 new inspector::InspectorBackendMojo(inspector_host_.get())); |
283 } | 281 } |
284 inspector_backend_->Connect(); | 282 inspector_backend_->Connect(); |
285 } | 283 } |
286 | 284 |
287 } // namespace sky | 285 } // namespace sky |
OLD | NEW |