Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: sky/viewer/document_view.cc

Issue 695803003: Make clicks on <a> request a navigation (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (frame != web_view_->mainFrame()) 180 if (frame != web_view_->mainFrame())
181 return; 181 return;
182 script_runner_.reset(new ScriptRunner(frame, context)); 182 script_runner_.reset(new ScriptRunner(frame, context));
183 183
184 v8::Isolate* isolate = context->GetIsolate(); 184 v8::Isolate* isolate = context->GetIsolate();
185 gin::Handle<Internals> internals = Internals::Create(isolate, this); 185 gin::Handle<Internals> internals = Internals::Create(isolate, this);
186 context->Global()->Set(gin::StringToV8(isolate, "internals"), 186 context->Global()->Set(gin::StringToV8(isolate, "internals"),
187 gin::ConvertToV8(isolate, internals)); 187 gin::ConvertToV8(isolate, internals));
188 } 188 }
189 189
190 blink::ServiceProvider* DocumentView::services() { 190 blink::ServiceProvider& DocumentView::services() {
191 return this; 191 return *this;
192 } 192 }
193 193
194 mojo::NavigatorHost* DocumentView::NavigatorHost() { 194 mojo::NavigatorHost* DocumentView::NavigatorHost() {
195 return navigator_host_.get(); 195 return navigator_host_.get();
196 } 196 }
197 197
198 void DocumentView::OnViewBoundsChanged(mojo::View* view, 198 void DocumentView::OnViewBoundsChanged(mojo::View* view,
199 const mojo::Rect& old_bounds, 199 const mojo::Rect& old_bounds,
200 const mojo::Rect& new_bounds) { 200 const mojo::Rect& new_bounds) {
201 DCHECK_EQ(view, root_); 201 DCHECK_EQ(view, root_);
202 gfx::Size size = new_bounds.To<gfx::Rect>().size(); 202 gfx::Size size = new_bounds.To<gfx::Rect>().size();
203 web_view_->resize(size); 203 web_view_->resize(size);
204 web_layer_tree_view_impl_->setViewportSize(size); 204 web_layer_tree_view_impl_->setViewportSize(size);
205 } 205 }
206 206
207 void DocumentView::OnViewDestroyed(mojo::View* view) { 207 void DocumentView::OnViewDestroyed(mojo::View* view) {
208 DCHECK_EQ(view, root_); 208 DCHECK_EQ(view, root_);
209 delete this; 209 delete this;
210 } 210 }
211 211
212 void DocumentView::OnViewInputEvent( 212 void DocumentView::OnViewInputEvent(
213 mojo::View* view, const mojo::EventPtr& event) { 213 mojo::View* view, const mojo::EventPtr& event) {
214 scoped_ptr<blink::WebInputEvent> web_event = 214 scoped_ptr<blink::WebInputEvent> web_event =
215 event.To<scoped_ptr<blink::WebInputEvent> >(); 215 event.To<scoped_ptr<blink::WebInputEvent> >();
216 if (web_event) 216 if (web_event)
217 web_view_->handleInputEvent(*web_event); 217 web_view_->handleInputEvent(*web_event);
218 } 218 }
219 219
220 } // namespace sky 220 } // namespace sky
OLDNEW
« sky/engine/core/testing/DummyPageHolder.cpp ('K') | « sky/viewer/document_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698