| 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) { | 154 mojo::View* DocumentView::createChildFrame(const blink::WebURL& url) { |
| 155 if (!root_) | 155 if (!root_) |
| 156 return; | 156 return nullptr; |
| 157 | 157 |
| 158 mojo::View* child = mojo::View::Create(root_->view_manager()); | 158 mojo::View* child = mojo::View::Create(root_->view_manager()); |
| 159 root_->AddChild(child); | 159 root_->AddChild(child); |
| 160 // TODO(mpcomplete): actual bounds. | |
| 161 mojo::Rect mojo_bounds; | |
| 162 mojo_bounds.x = 0; | |
| 163 mojo_bounds.y = 50; | |
| 164 mojo_bounds.width = 300; | |
| 165 mojo_bounds.height = 100; | |
| 166 child->SetBounds(mojo_bounds); | |
| 167 child->Embed(mojo::String::From(url.string().utf8())); | 160 child->Embed(mojo::String::From(url.string().utf8())); |
| 161 |
| 162 return child; |
| 168 } | 163 } |
| 169 | 164 |
| 170 void DocumentView::frameDetached(blink::WebFrame* frame) { | 165 void DocumentView::frameDetached(blink::WebFrame* frame) { |
| 171 // |frame| is invalid after here. | 166 // |frame| is invalid after here. |
| 172 frame->close(); | 167 frame->close(); |
| 173 } | 168 } |
| 174 | 169 |
| 175 blink::WebNavigationPolicy DocumentView::decidePolicyForNavigation( | 170 blink::WebNavigationPolicy DocumentView::decidePolicyForNavigation( |
| 176 const blink::WebFrameClient::NavigationPolicyInfo& info) { | 171 const blink::WebFrameClient::NavigationPolicyInfo& info) { |
| 177 | 172 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 226 |
| 232 void DocumentView::OnViewInputEvent( | 227 void DocumentView::OnViewInputEvent( |
| 233 mojo::View* view, const mojo::EventPtr& event) { | 228 mojo::View* view, const mojo::EventPtr& event) { |
| 234 scoped_ptr<blink::WebInputEvent> web_event = | 229 scoped_ptr<blink::WebInputEvent> web_event = |
| 235 event.To<scoped_ptr<blink::WebInputEvent> >(); | 230 event.To<scoped_ptr<blink::WebInputEvent> >(); |
| 236 if (web_event) | 231 if (web_event) |
| 237 web_view_->handleInputEvent(*web_event); | 232 web_view_->handleInputEvent(*web_event); |
| 238 } | 233 } |
| 239 | 234 |
| 240 } // namespace sky | 235 } // namespace sky |
| OLD | NEW |