Chromium Code Reviews| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 shell_->ConnectToApplication("mojo:native_viewport_service", | 144 shell_->ConnectToApplication("mojo:native_viewport_service", |
| 145 mojo::GetProxy(&gpu_service_provider)); | 145 mojo::GetProxy(&gpu_service_provider)); |
| 146 mojo::InterfacePtr<mojo::Gpu> gpu_service; | 146 mojo::InterfacePtr<mojo::Gpu> gpu_service; |
| 147 mojo::ConnectToService(gpu_service_provider.get(), &gpu_service); | 147 mojo::ConnectToService(gpu_service_provider.get(), &gpu_service); |
| 148 web_layer_tree_view_impl_.reset(new WebLayerTreeViewImpl( | 148 web_layer_tree_view_impl_.reset(new WebLayerTreeViewImpl( |
| 149 compositor_thread_, surfaces_service.Pass(), gpu_service.Pass())); | 149 compositor_thread_, surfaces_service.Pass(), gpu_service.Pass())); |
| 150 | 150 |
| 151 return web_layer_tree_view_impl_.get(); | 151 return web_layer_tree_view_impl_.get(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void DocumentView::createChildView(const blink::WebURL& url, | |
| 155 const blink::WebRect& bounds) { | |
| 156 if (!root_) | |
| 157 return; | |
| 158 | |
| 159 mojo::View* child = mojo::View::Create(root_->view_manager()); | |
| 160 root_->AddChild(child); | |
|
abarth-chromium
2014/11/06 22:55:07
Do we need to observe child so we can destroy it l
Matt Perry
2014/11/06 23:38:50
I must admit I don't understand the ownership here
Matt Perry
2014/11/07 17:27:40
Sky says we need to delete the children manually,
| |
| 161 mojo::Rect mojo_bounds; | |
| 162 mojo_bounds.x = bounds.x; | |
| 163 mojo_bounds.y = bounds.y; | |
| 164 mojo_bounds.width = bounds.width; | |
| 165 mojo_bounds.height = bounds.height; | |
| 166 child->SetBounds(mojo_bounds); | |
| 167 child->Embed(mojo::String::From(url.string().utf8())); | |
| 168 } | |
| 169 | |
| 154 void DocumentView::frameDetached(blink::WebFrame* frame) { | 170 void DocumentView::frameDetached(blink::WebFrame* frame) { |
| 155 // |frame| is invalid after here. | 171 // |frame| is invalid after here. |
| 156 frame->close(); | 172 frame->close(); |
| 157 } | 173 } |
| 158 | 174 |
| 159 blink::WebNavigationPolicy DocumentView::decidePolicyForNavigation( | 175 blink::WebNavigationPolicy DocumentView::decidePolicyForNavigation( |
| 160 const blink::WebFrameClient::NavigationPolicyInfo& info) { | 176 const blink::WebFrameClient::NavigationPolicyInfo& info) { |
| 161 | 177 |
| 162 navigator_host_->RequestNavigate( | 178 navigator_host_->RequestNavigate( |
| 163 WebNavigationPolicyToNavigationTarget(info.defaultPolicy), | 179 WebNavigationPolicyToNavigationTarget(info.defaultPolicy), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 | 227 |
| 212 void DocumentView::OnViewInputEvent( | 228 void DocumentView::OnViewInputEvent( |
| 213 mojo::View* view, const mojo::EventPtr& event) { | 229 mojo::View* view, const mojo::EventPtr& event) { |
| 214 scoped_ptr<blink::WebInputEvent> web_event = | 230 scoped_ptr<blink::WebInputEvent> web_event = |
| 215 event.To<scoped_ptr<blink::WebInputEvent> >(); | 231 event.To<scoped_ptr<blink::WebInputEvent> >(); |
| 216 if (web_event) | 232 if (web_event) |
| 217 web_view_->handleInputEvent(*web_event); | 233 web_view_->handleInputEvent(*web_event); |
| 218 } | 234 } |
| 219 | 235 |
| 220 } // namespace sky | 236 } // namespace sky |
| OLD | NEW |