| 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_view.h" | 5 #include "mojo/services/html_viewer/html_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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return false; | 82 return false; |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace | 85 } // namespace |
| 86 | 86 |
| 87 HTMLDocumentView::HTMLDocumentView( | 87 HTMLDocumentView::HTMLDocumentView( |
| 88 URLResponsePtr response, | 88 URLResponsePtr response, |
| 89 ShellPtr shell, | 89 ShellPtr shell, |
| 90 scoped_refptr<base::MessageLoopProxy> compositor_thread, | 90 scoped_refptr<base::MessageLoopProxy> compositor_thread, |
| 91 WebMediaPlayerFactory* web_media_player_factory) | 91 WebMediaPlayerFactory* web_media_player_factory) |
| 92 : shell_(shell.Pass()), | 92 : response_(response.Pass()), |
| 93 shell_(shell.Pass()), |
| 93 web_view_(NULL), | 94 web_view_(NULL), |
| 94 root_(NULL), | 95 root_(NULL), |
| 95 view_manager_client_factory_(shell_.get(), this), | 96 view_manager_client_factory_(shell_.get(), this), |
| 96 compositor_thread_(compositor_thread), | 97 compositor_thread_(compositor_thread), |
| 97 web_media_player_factory_(web_media_player_factory), | 98 web_media_player_factory_(web_media_player_factory), |
| 98 weak_factory_(this) { | 99 weak_factory_(this) { |
| 99 Load(response.Pass()); | 100 shell_.set_client(this); |
| 100 } | 101 } |
| 101 | 102 |
| 102 HTMLDocumentView::~HTMLDocumentView() { | 103 HTMLDocumentView::~HTMLDocumentView() { |
| 103 if (web_view_) | 104 if (web_view_) |
| 104 web_view_->close(); | 105 web_view_->close(); |
| 105 if (root_) | 106 if (root_) |
| 106 root_->RemoveObserver(this); | 107 root_->RemoveObserver(this); |
| 107 } | 108 } |
| 108 | 109 |
| 109 void HTMLDocumentView::AcceptConnection(const String& requestor_url, | 110 void HTMLDocumentView::AcceptConnection(const String& requestor_url, |
| 110 ServiceProviderPtr provider) { | 111 ServiceProviderPtr provider) { |
| 111 exported_services_.AddService(&view_manager_client_factory_); | 112 exported_services_.AddService(&view_manager_client_factory_); |
| 112 WeakBindToPipe(&exported_services_, provider.PassMessagePipe()); | 113 WeakBindToPipe(&exported_services_, provider.PassMessagePipe()); |
| 114 Load(response_.Pass()); |
| 113 } | 115 } |
| 114 | 116 |
| 115 void HTMLDocumentView::Initialize(Array<String> args) { | 117 void HTMLDocumentView::Initialize(Array<String> args) { |
| 116 } | 118 } |
| 117 | 119 |
| 118 void HTMLDocumentView::OnEmbed( | 120 void HTMLDocumentView::OnEmbed( |
| 119 ViewManager* view_manager, | 121 ViewManager* view_manager, |
| 120 View* root, | 122 View* root, |
| 121 ServiceProviderImpl* embedee_service_provider_impl, | 123 ServiceProviderImpl* embedee_service_provider_impl, |
| 122 scoped_ptr<ServiceProvider> embedder_service_provider) { | 124 scoped_ptr<ServiceProvider> embedder_service_provider) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 261 } |
| 260 | 262 |
| 261 void HTMLDocumentView::OnViewInputEvent(View* view, const EventPtr& event) { | 263 void HTMLDocumentView::OnViewInputEvent(View* view, const EventPtr& event) { |
| 262 scoped_ptr<blink::WebInputEvent> web_event = | 264 scoped_ptr<blink::WebInputEvent> web_event = |
| 263 event.To<scoped_ptr<blink::WebInputEvent> >(); | 265 event.To<scoped_ptr<blink::WebInputEvent> >(); |
| 264 if (web_event) | 266 if (web_event) |
| 265 web_view_->handleInputEvent(*web_event); | 267 web_view_->handleInputEvent(*web_event); |
| 266 } | 268 } |
| 267 | 269 |
| 268 } // namespace mojo | 270 } // namespace mojo |
| OLD | NEW |