| 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 "mojo/services/html_viewer/html_document.h" | 5 #include "mojo/services/html_viewer/html_document.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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 void HTMLDocument::didNavigateWithinPage( | 270 void HTMLDocument::didNavigateWithinPage( |
| 271 blink::WebLocalFrame* frame, | 271 blink::WebLocalFrame* frame, |
| 272 const blink::WebHistoryItem& history_item, | 272 const blink::WebHistoryItem& history_item, |
| 273 blink::WebHistoryCommitType commit_type) { | 273 blink::WebHistoryCommitType commit_type) { |
| 274 if (navigator_host_.get()) | 274 if (navigator_host_.get()) |
| 275 navigator_host_->DidNavigateLocally(history_item.urlString().utf8()); | 275 navigator_host_->DidNavigateLocally(history_item.urlString().utf8()); |
| 276 } | 276 } |
| 277 | 277 |
| 278 blink::WebEncryptedMediaClient* HTMLDocument::encryptedMediaClient() { | 278 blink::WebEncryptedMediaClient* HTMLDocument::encryptedMediaClient() { |
| 279 if (!web_encrypted_media_client_) { | 279 if (!web_encrypted_media_client_) { |
| 280 // TODO(xhwang): Hook up permission services and add a MediaPermission |
| 281 // implementation for HTMLDocument. |
| 280 web_encrypted_media_client_.reset(new media::WebEncryptedMediaClientImpl( | 282 web_encrypted_media_client_.reset(new media::WebEncryptedMediaClientImpl( |
| 281 make_scoped_ptr(new media::DefaultCdmFactory()))); | 283 make_scoped_ptr(new media::DefaultCdmFactory()), nullptr)); |
| 282 } | 284 } |
| 283 return web_encrypted_media_client_.get(); | 285 return web_encrypted_media_client_.get(); |
| 284 } | 286 } |
| 285 | 287 |
| 286 void HTMLDocument::OnViewBoundsChanged(View* view, | 288 void HTMLDocument::OnViewBoundsChanged(View* view, |
| 287 const Rect& old_bounds, | 289 const Rect& old_bounds, |
| 288 const Rect& new_bounds) { | 290 const Rect& new_bounds) { |
| 289 DCHECK_EQ(view, root_); | 291 DCHECK_EQ(view, root_); |
| 290 web_view_->resize( | 292 web_view_->resize( |
| 291 blink::WebSize(view->bounds().width, view->bounds().height)); | 293 blink::WebSize(view->bounds().width, view->bounds().height)); |
| 292 } | 294 } |
| 293 | 295 |
| 294 void HTMLDocument::OnViewDestroyed(View* view) { | 296 void HTMLDocument::OnViewDestroyed(View* view) { |
| 295 DCHECK_EQ(view, root_); | 297 DCHECK_EQ(view, root_); |
| 296 root_ = nullptr; | 298 root_ = nullptr; |
| 297 } | 299 } |
| 298 | 300 |
| 299 void HTMLDocument::OnViewInputEvent(View* view, const mojo::EventPtr& event) { | 301 void HTMLDocument::OnViewInputEvent(View* view, const mojo::EventPtr& event) { |
| 300 scoped_ptr<blink::WebInputEvent> web_event = | 302 scoped_ptr<blink::WebInputEvent> web_event = |
| 301 event.To<scoped_ptr<blink::WebInputEvent>>(); | 303 event.To<scoped_ptr<blink::WebInputEvent>>(); |
| 302 if (web_event) | 304 if (web_event) |
| 303 web_view_->handleInputEvent(*web_event); | 305 web_view_->handleInputEvent(*web_event); |
| 304 } | 306 } |
| 305 | 307 |
| 306 } // namespace html_viewer | 308 } // namespace html_viewer |
| OLD | NEW |