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

Side by Side Diff: mojo/services/html_viewer/html_document_view.cc

Issue 710803002: Beginning of an accessibility implementation for html_viewer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 "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"
11 #include "base/stl_util.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
13 #include "mojo/public/cpp/application/connect.h" 14 #include "mojo/public/cpp/application/connect.h"
14 #include "mojo/public/cpp/system/data_pipe.h" 15 #include "mojo/public/cpp/system/data_pipe.h"
15 #include "mojo/public/interfaces/application/shell.mojom.h" 16 #include "mojo/public/interfaces/application/shell.mojom.h"
16 #include "mojo/services/html_viewer/blink_input_events_type_converters.h" 17 #include "mojo/services/html_viewer/blink_input_events_type_converters.h"
17 #include "mojo/services/html_viewer/blink_url_request_type_converters.h" 18 #include "mojo/services/html_viewer/blink_url_request_type_converters.h"
18 #include "mojo/services/html_viewer/weblayertreeview_impl.h" 19 #include "mojo/services/html_viewer/weblayertreeview_impl.h"
19 #include "mojo/services/html_viewer/webmediaplayer_factory.h" 20 #include "mojo/services/html_viewer/webmediaplayer_factory.h"
20 #include "mojo/services/html_viewer/webstoragenamespace_impl.h" 21 #include "mojo/services/html_viewer/webstoragenamespace_impl.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 URLResponsePtr response, 89 URLResponsePtr response,
89 ShellPtr shell, 90 ShellPtr shell,
90 scoped_refptr<base::MessageLoopProxy> compositor_thread, 91 scoped_refptr<base::MessageLoopProxy> compositor_thread,
91 WebMediaPlayerFactory* web_media_player_factory) 92 WebMediaPlayerFactory* web_media_player_factory)
92 : response_(response.Pass()), 93 : response_(response.Pass()),
93 shell_(shell.Pass()), 94 shell_(shell.Pass()),
94 web_view_(NULL), 95 web_view_(NULL),
95 root_(NULL), 96 root_(NULL),
96 view_manager_client_factory_(shell_.get(), this), 97 view_manager_client_factory_(shell_.get(), this),
97 compositor_thread_(compositor_thread), 98 compositor_thread_(compositor_thread),
98 web_media_player_factory_(web_media_player_factory), 99 web_media_player_factory_(web_media_player_factory) {
99 weak_factory_(this) {
100 shell_.set_client(this); 100 shell_.set_client(this);
101 } 101 }
102 102
103 HTMLDocumentView::~HTMLDocumentView() { 103 HTMLDocumentView::~HTMLDocumentView() {
104 STLDeleteElements(&ax_provider_impls_);
105
104 if (web_view_) 106 if (web_view_)
105 web_view_->close(); 107 web_view_->close();
106 if (root_) 108 if (root_)
107 root_->RemoveObserver(this); 109 root_->RemoveObserver(this);
108 } 110 }
109 111
110 void HTMLDocumentView::AcceptConnection(const String& requestor_url, 112 void HTMLDocumentView::AcceptConnection(const String& requestor_url,
111 ServiceProviderPtr provider) { 113 ServiceProviderPtr provider) {
114 exported_services_.AddService(this);
112 exported_services_.AddService(&view_manager_client_factory_); 115 exported_services_.AddService(&view_manager_client_factory_);
113 WeakBindToPipe(&exported_services_, provider.PassMessagePipe()); 116 WeakBindToPipe(&exported_services_, provider.PassMessagePipe());
114 Load(response_.Pass()); 117 Load(response_.Pass());
115 } 118 }
116 119
117 void HTMLDocumentView::Initialize(Array<String> args) { 120 void HTMLDocumentView::Initialize(Array<String> args) {
118 } 121 }
119 122
120 void HTMLDocumentView::OnEmbed( 123 void HTMLDocumentView::OnEmbed(
121 ViewManager* view_manager, 124 ViewManager* view_manager,
122 View* root, 125 View* root,
123 ServiceProviderImpl* embedee_service_provider_impl, 126 ServiceProviderImpl* embedee_service_provider_impl,
124 scoped_ptr<ServiceProvider> embedder_service_provider) { 127 scoped_ptr<ServiceProvider> embedder_service_provider) {
125 root_ = root; 128 root_ = root;
126 embedder_service_provider_ = embedder_service_provider.Pass(); 129 embedder_service_provider_ = embedder_service_provider.Pass();
127 navigator_host_.set_service_provider(embedder_service_provider_.get()); 130 navigator_host_.set_service_provider(embedder_service_provider_.get());
128 131
129 blink::WebSize root_size(root_->bounds().width, root_->bounds().height); 132 blink::WebSize root_size(root_->bounds().width, root_->bounds().height);
130 web_view_->resize(root_size); 133 web_view_->resize(root_size);
131 web_layer_tree_view_impl_->setViewportSize(root_size); 134 web_layer_tree_view_impl_->setViewportSize(root_size);
132 web_layer_tree_view_impl_->set_view(root_); 135 web_layer_tree_view_impl_->set_view(root_);
133 root_->AddObserver(this); 136 root_->AddObserver(this);
134 } 137 }
135 138
139 void HTMLDocumentView::Create(ApplicationConnection* connection,
140 InterfaceRequest<AxProvider> request) {
141 if (!web_view_)
142 return;
143 ax_provider_impls_.insert(
144 WeakBindToRequest(new AxProviderImpl(web_view_), &request));
145 }
146
136 void HTMLDocumentView::OnViewManagerDisconnected(ViewManager* view_manager) { 147 void HTMLDocumentView::OnViewManagerDisconnected(ViewManager* view_manager) {
137 // TODO(aa): Need to figure out how shutdown works. 148 // TODO(aa): Need to figure out how shutdown works.
138 } 149 }
139 150
140 void HTMLDocumentView::Load(URLResponsePtr response) { 151 void HTMLDocumentView::Load(URLResponsePtr response) {
141 web_view_ = blink::WebView::create(this); 152 web_view_ = blink::WebView::create(this);
142 web_layer_tree_view_impl_->set_widget(web_view_); 153 web_layer_tree_view_impl_->set_widget(web_view_);
143 ConfigureSettings(web_view_->settings()); 154 ConfigureSettings(web_view_->settings());
144 web_view_->setMainFrame(blink::WebLocalFrame::create(this)); 155 web_view_->setMainFrame(blink::WebLocalFrame::create(this));
145 156
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 272 }
262 273
263 void HTMLDocumentView::OnViewInputEvent(View* view, const EventPtr& event) { 274 void HTMLDocumentView::OnViewInputEvent(View* view, const EventPtr& event) {
264 scoped_ptr<blink::WebInputEvent> web_event = 275 scoped_ptr<blink::WebInputEvent> web_event =
265 event.To<scoped_ptr<blink::WebInputEvent> >(); 276 event.To<scoped_ptr<blink::WebInputEvent> >();
266 if (web_event) 277 if (web_event)
267 web_view_->handleInputEvent(*web_event); 278 web_view_->handleInputEvent(*web_event);
268 } 279 }
269 280
270 } // namespace mojo 281 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/html_viewer/html_document_view.h ('k') | mojo/services/html_viewer/html_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698