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 "services/sky/document_view.h" | 5 #include "services/sky/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/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 : response_(response.Pass()), | 86 : response_(response.Pass()), |
87 exported_services_(services.Pass()), | 87 exported_services_(services.Pass()), |
88 imported_services_(exported_services.Pass()), | 88 imported_services_(exported_services.Pass()), |
89 shell_(shell), | 89 shell_(shell), |
90 root_(nullptr), | 90 root_(nullptr), |
91 view_manager_client_factory_(shell_, this), | 91 view_manager_client_factory_(shell_, this), |
92 bitmap_rasterizer_(nullptr), | 92 bitmap_rasterizer_(nullptr), |
93 weak_factory_(this) { | 93 weak_factory_(this) { |
94 exported_services_.AddService(&view_manager_client_factory_); | 94 exported_services_.AddService(&view_manager_client_factory_); |
95 InitServiceRegistry(); | 95 InitServiceRegistry(); |
| 96 mojo::ServiceProviderPtr network_service_provider; |
| 97 shell->ConnectToApplication("mojo:authenticated_network_service", |
| 98 mojo::GetProxy(&network_service_provider), |
| 99 nullptr); |
| 100 mojo::ConnectToService(network_service_provider.get(), &network_service_); |
96 } | 101 } |
97 | 102 |
98 DocumentView::~DocumentView() { | 103 DocumentView::~DocumentView() { |
99 if (root_) | 104 if (root_) |
100 root_->RemoveObserver(this); | 105 root_->RemoveObserver(this); |
101 ui::GestureRecognizer::Get()->CleanupStateForConsumer(this); | 106 ui::GestureRecognizer::Get()->CleanupStateForConsumer(this); |
102 } | 107 } |
103 | 108 |
104 base::WeakPtr<DocumentView> DocumentView::GetWeakPtr() { | 109 base::WeakPtr<DocumentView> DocumentView::GetWeakPtr() { |
105 return weak_factory_.GetWeakPtr(); | 110 return weak_factory_.GetWeakPtr(); |
(...skipping 19 matching lines...) Expand all Loading... |
125 | 130 |
126 root_->AddObserver(this); | 131 root_->AddObserver(this); |
127 } | 132 } |
128 | 133 |
129 void DocumentView::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { | 134 void DocumentView::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { |
130 // TODO(aa): Need to figure out how shutdown works. | 135 // TODO(aa): Need to figure out how shutdown works. |
131 } | 136 } |
132 void DocumentView::Load(mojo::URLResponsePtr response) { | 137 void DocumentView::Load(mojo::URLResponsePtr response) { |
133 String name = String::fromUTF8(response->url); | 138 String name = String::fromUTF8(response->url); |
134 library_provider_.reset(new DartLibraryProviderImpl( | 139 library_provider_.reset(new DartLibraryProviderImpl( |
135 blink::Platform::current()->networkService(), | 140 network_service_.get(), |
136 CreatePrefetchedLibraryIfNeeded(name, response.Pass()))); | 141 CreatePrefetchedLibraryIfNeeded(name, response.Pass()))); |
137 sky_view_ = blink::SkyView::Create(this); | 142 sky_view_ = blink::SkyView::Create(this); |
138 layer_host_.reset(new LayerHost(this)); | 143 layer_host_.reset(new LayerHost(this)); |
139 root_layer_ = make_scoped_refptr(new Layer(this)); | 144 root_layer_ = make_scoped_refptr(new Layer(this)); |
140 root_layer_->set_rasterizer(CreateRasterizer()); | 145 root_layer_->set_rasterizer(CreateRasterizer()); |
141 layer_host_->SetRootLayer(root_layer_); | 146 layer_host_->SetRootLayer(root_layer_); |
142 | 147 |
143 sky_view_->RunFromLibrary(name, library_provider_.get()); | 148 sky_view_->RunFromLibrary(name, library_provider_.get()); |
144 } | 149 } |
145 | 150 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 new mojo::StrongBinding<mojo::ServiceProvider>(sp_impl, &sp)); | 308 new mojo::StrongBinding<mojo::ServiceProvider>(sp_impl, &sp)); |
304 service_registry_->AddServices(interface_names.Pass(), sp.Pass()); | 309 service_registry_->AddServices(interface_names.Pass(), sp.Pass()); |
305 } | 310 } |
306 | 311 |
307 void DocumentView::ScheduleFrame() { | 312 void DocumentView::ScheduleFrame() { |
308 DCHECK(sky_view_); | 313 DCHECK(sky_view_); |
309 layer_host_->SetNeedsAnimate(); | 314 layer_host_->SetNeedsAnimate(); |
310 } | 315 } |
311 | 316 |
312 } // namespace sky | 317 } // namespace sky |
OLD | NEW |