Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/shell/ui/engine.h" | 5 #include "sky/shell/ui/engine.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "mojo/public/cpp/application/connect.h" | 8 #include "mojo/public/cpp/application/connect.h" |
| 9 #include "sky/engine/public/platform/WebInputEvent.h" | 9 #include "sky/engine/public/platform/WebInputEvent.h" |
| 10 #include "sky/engine/public/web/Sky.h" | 10 #include "sky/engine/public/web/Sky.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 | 112 |
| 113 void Engine::OnInputEvent(InputEventPtr event) { | 113 void Engine::OnInputEvent(InputEventPtr event) { |
| 114 scoped_ptr<blink::WebInputEvent> web_event = | 114 scoped_ptr<blink::WebInputEvent> web_event = |
| 115 ConvertEvent(event, device_pixel_ratio_); | 115 ConvertEvent(event, device_pixel_ratio_); |
| 116 if (!web_event) | 116 if (!web_event) |
| 117 return; | 117 return; |
| 118 web_view_->handleInputEvent(*web_event); | 118 web_view_->handleInputEvent(*web_event); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void Engine::LoadURL(const mojo::String& url) { | 121 void Engine::LoadURL(const mojo::String& url) { |
| 122 if (web_view_) | |
| 123 web_view_->close(); | |
| 122 web_view_ = blink::WebView::create(this); | 124 web_view_ = blink::WebView::create(this); |
| 123 ConfigureSettings(web_view_->settings()); | 125 ConfigureSettings(web_view_->settings()); |
| 124 web_view_->setMainFrame(blink::WebLocalFrame::create(this)); | 126 web_view_->setMainFrame(blink::WebLocalFrame::create(this)); |
| 125 UpdateWebViewSize(); | 127 UpdateWebViewSize(); |
| 126 web_view_->mainFrame()->load(GURL(url)); | 128 web_view_->mainFrame()->load(GURL(url)); |
| 127 } | 129 } |
| 128 | 130 |
| 131 void Engine::frameDetached(blink::WebFrame* frame) { | |
| 132 // |frame| is invalid after here. | |
| 133 frame->close(); | |
| 134 } | |
| 135 | |
| 129 void Engine::initializeLayerTreeView() { | 136 void Engine::initializeLayerTreeView() { |
| 130 } | 137 } |
| 131 | 138 |
| 132 void Engine::scheduleVisualUpdate() { | 139 void Engine::scheduleVisualUpdate() { |
| 133 animator_->RequestFrame(); | 140 animator_->RequestFrame(); |
| 134 } | 141 } |
| 135 | 142 |
| 143 blink::ServiceProvider* Engine::services() { | |
| 144 return this; | |
| 145 } | |
| 146 | |
| 147 mojo::NavigatorHost* Engine::NavigatorHost() { | |
| 148 return this; | |
| 149 } | |
| 150 | |
| 151 void Engine::RequestNavigate(mojo::Target target, | |
| 152 mojo::URLRequestPtr request) { | |
| 153 // Ignoring target for now. | |
| 154 LoadURL(request->url); | |
|
abarth-chromium
2015/02/25 23:21:32
We should do this asynchronously.
| |
| 155 } | |
| 156 | |
| 157 void Engine::DidNavigateLocally(const mojo::String& url) { | |
| 158 } | |
| 159 | |
| 136 } // namespace shell | 160 } // namespace shell |
| 137 } // namespace sky | 161 } // namespace sky |
| OLD | NEW |