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

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

Issue 659043004: Fix build. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 months 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
« no previous file with comments | « sky/viewer/document_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
13 #include "mojo/converters/geometry/geometry_type_converters.h"
13 #include "mojo/public/cpp/application/connect.h" 14 #include "mojo/public/cpp/application/connect.h"
14 #include "mojo/public/cpp/application/service_provider_impl.h" 15 #include "mojo/public/cpp/application/service_provider_impl.h"
15 #include "mojo/public/cpp/system/data_pipe.h" 16 #include "mojo/public/cpp/system/data_pipe.h"
16 #include "mojo/public/interfaces/application/shell.mojom.h" 17 #include "mojo/public/interfaces/application/shell.mojom.h"
17 #include "mojo/services/public/cpp/view_manager/view.h" 18 #include "mojo/services/public/cpp/view_manager/view.h"
18 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h" 19 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h"
19 #include "skia/ext/refptr.h" 20 #include "skia/ext/refptr.h"
20 #include "sky/engine/public/platform/Platform.h" 21 #include "sky/engine/public/platform/Platform.h"
21 #include "sky/engine/public/platform/WebHTTPHeaderVisitor.h" 22 #include "sky/engine/public/platform/WebHTTPHeaderVisitor.h"
22 #include "sky/engine/public/web/WebConsoleMessage.h" 23 #include "sky/engine/public/web/WebConsoleMessage.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 mojo::View* root, 98 mojo::View* root,
98 mojo::ServiceProviderImpl* exported_services, 99 mojo::ServiceProviderImpl* exported_services,
99 scoped_ptr<mojo::ServiceProvider> imported_services) { 100 scoped_ptr<mojo::ServiceProvider> imported_services) {
100 101
101 root_ = root; 102 root_ = root;
102 imported_services_ = imported_services.Pass(); 103 imported_services_ = imported_services.Pass();
103 navigator_host_.set_service_provider(imported_services_.get()); 104 navigator_host_.set_service_provider(imported_services_.get());
104 105
105 Load(response_.Pass()); 106 Load(response_.Pass());
106 107
107 web_view_->resize(root_->bounds().size()); 108 gfx::Size size = root_->bounds().To<gfx::Rect>().size();
108 web_layer_tree_view_impl_->setViewportSize(root_->bounds().size()); 109 web_view_->resize(size);
110 web_layer_tree_view_impl_->setViewportSize(size);
109 web_layer_tree_view_impl_->set_view(root_); 111 web_layer_tree_view_impl_->set_view(root_);
110 root_->AddObserver(this); 112 root_->AddObserver(this);
111 } 113 }
112 114
113 void DocumentView::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { 115 void DocumentView::OnViewManagerDisconnected(mojo::ViewManager* view_manager) {
114 // TODO(aa): Need to figure out how shutdown works. 116 // TODO(aa): Need to figure out how shutdown works.
115 } 117 }
116 118
117 void DocumentView::Load(mojo::URLResponsePtr response) { 119 void DocumentView::Load(mojo::URLResponsePtr response) {
118 web_view_ = blink::WebView::create(this); 120 web_view_ = blink::WebView::create(this);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 return; 174 return;
173 script_runner_.reset(new ScriptRunner(frame, context)); 175 script_runner_.reset(new ScriptRunner(frame, context));
174 176
175 v8::Isolate* isolate = context->GetIsolate(); 177 v8::Isolate* isolate = context->GetIsolate();
176 gin::Handle<Internals> internals = Internals::Create(isolate, this); 178 gin::Handle<Internals> internals = Internals::Create(isolate, this);
177 context->Global()->Set(gin::StringToV8(isolate, "internals"), 179 context->Global()->Set(gin::StringToV8(isolate, "internals"),
178 gin::ConvertToV8(isolate, internals)); 180 gin::ConvertToV8(isolate, internals));
179 } 181 }
180 182
181 void DocumentView::OnViewBoundsChanged(mojo::View* view, 183 void DocumentView::OnViewBoundsChanged(mojo::View* view,
182 const gfx::Rect& old_bounds, 184 const mojo::Rect& old_bounds,
183 const gfx::Rect& new_bounds) { 185 const mojo::Rect& new_bounds) {
184 DCHECK_EQ(view, root_); 186 DCHECK_EQ(view, root_);
185 web_view_->resize(new_bounds.size()); 187 gfx::Size size = new_bounds.To<gfx::Rect>().size();
186 web_layer_tree_view_impl_->setViewportSize(new_bounds.size()); 188 web_view_->resize(size);
189 web_layer_tree_view_impl_->setViewportSize(size);
187 } 190 }
188 191
189 void DocumentView::OnViewDestroyed(mojo::View* view) { 192 void DocumentView::OnViewDestroyed(mojo::View* view) {
190 DCHECK_EQ(view, root_); 193 DCHECK_EQ(view, root_);
191 delete this; 194 delete this;
192 } 195 }
193 196
194 void DocumentView::OnViewInputEvent( 197 void DocumentView::OnViewInputEvent(
195 mojo::View* view, const mojo::EventPtr& event) { 198 mojo::View* view, const mojo::EventPtr& event) {
196 scoped_ptr<blink::WebInputEvent> web_event = 199 scoped_ptr<blink::WebInputEvent> web_event =
197 event.To<scoped_ptr<blink::WebInputEvent> >(); 200 event.To<scoped_ptr<blink::WebInputEvent> >();
198 if (web_event) 201 if (web_event)
199 web_view_->handleInputEvent(*web_event); 202 web_view_->handleInputEvent(*web_event);
200 } 203 }
201 204
202 } // namespace sky 205 } // namespace sky
OLDNEW
« no previous file with comments | « sky/viewer/document_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698