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

Side by Side Diff: mojo/services/html_viewer/blink_platform_impl.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/blink_platform_impl.h" 5 #include "mojo/services/html_viewer/blink_platform_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "base/threading/platform_thread.h" 12 #include "base/threading/platform_thread.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "mojo/public/cpp/application/application_impl.h"
15 #include "mojo/services/html_viewer/webclipboard_impl.h"
16 #include "mojo/services/html_viewer/webcookiejar_impl.h"
17 #include "mojo/services/html_viewer/websockethandle_impl.h"
18 #include "mojo/services/html_viewer/webthread_impl.h" 14 #include "mojo/services/html_viewer/webthread_impl.h"
19 #include "mojo/services/html_viewer/weburlloader_impl.h"
20 #include "net/base/data_url.h" 15 #include "net/base/data_url.h"
21 #include "net/base/mime_util.h" 16 #include "net/base/mime_util.h"
22 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
23 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" 18 #include "third_party/WebKit/public/platform/WebWaitableEvent.h"
24 19
25 namespace mojo { 20 namespace mojo {
26 namespace { 21 namespace {
27 22
28 // TODO(darin): Figure out what our UA should really be. 23 // TODO(darin): Figure out what our UA should really be.
29 const char kUserAgentString[] = 24 const char kUserAgentString[] =
(...skipping 12 matching lines...) Expand all
42 return impl_.get(); 37 return impl_.get();
43 } 38 }
44 39
45 private: 40 private:
46 scoped_ptr<base::WaitableEvent> impl_; 41 scoped_ptr<base::WaitableEvent> impl_;
47 DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl); 42 DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl);
48 }; 43 };
49 44
50 } // namespace 45 } // namespace
51 46
52 BlinkPlatformImpl::BlinkPlatformImpl(ApplicationImpl* app) 47 BlinkPlatformImpl::BlinkPlatformImpl()
53 : main_loop_(base::MessageLoop::current()), 48 : main_loop_(base::MessageLoop::current()),
54 shared_timer_func_(NULL), 49 shared_timer_func_(NULL),
55 shared_timer_fire_time_(0.0), 50 shared_timer_fire_time_(0.0),
56 shared_timer_fire_time_was_set_while_suspended_(false), 51 shared_timer_fire_time_was_set_while_suspended_(false),
57 shared_timer_suspended_(0), 52 shared_timer_suspended_(0),
58 current_thread_slot_(&DestroyCurrentThread) { 53 current_thread_slot_(&DestroyCurrentThread) {
59 app->ConnectToService("mojo:network_service", &network_service_);
60
61 CookieStorePtr cookie_store;
62 network_service_->GetCookieStore(GetProxy(&cookie_store));
63 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass()));
64
65 ClipboardPtr clipboard;
66 app->ConnectToService("mojo:clipboard", &clipboard);
67 clipboard_.reset(new WebClipboardImpl(clipboard.Pass()));
68 } 54 }
69 55
70 BlinkPlatformImpl::~BlinkPlatformImpl() { 56 BlinkPlatformImpl::~BlinkPlatformImpl() {
71 } 57 }
72 58
73 blink::WebCookieJar* BlinkPlatformImpl::cookieJar() {
74 return cookie_jar_.get();
75 }
76
77 blink::WebClipboard* BlinkPlatformImpl::clipboard() {
78 return clipboard_.get();
79 }
80
81 blink::WebMimeRegistry* BlinkPlatformImpl::mimeRegistry() { 59 blink::WebMimeRegistry* BlinkPlatformImpl::mimeRegistry() {
82 return &mime_registry_; 60 return &mime_registry_;
83 } 61 }
84 62
85 blink::WebThemeEngine* BlinkPlatformImpl::themeEngine() { 63 blink::WebThemeEngine* BlinkPlatformImpl::themeEngine() {
86 return &theme_engine_; 64 return &theme_engine_;
87 } 65 }
88 66
89 blink::WebString BlinkPlatformImpl::defaultLocale() { 67 blink::WebString BlinkPlatformImpl::defaultLocale() {
90 return blink::WebString::fromUTF8("en-US"); 68 return blink::WebString::fromUTF8("en-US");
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return &scrollbar_behavior_; 137 return &scrollbar_behavior_;
160 } 138 }
161 139
162 const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag( 140 const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag(
163 const char* category_name) { 141 const char* category_name) {
164 static const unsigned char buf[] = "*"; 142 static const unsigned char buf[] = "*";
165 return buf; 143 return buf;
166 } 144 }
167 145
168 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() { 146 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() {
169 return new WebURLLoaderImpl(network_service_.get()); 147 return NULL;
170 } 148 }
171 149
172 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { 150 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() {
173 return new WebSocketHandleImpl(network_service_.get()); 151 return NULL;
174 } 152 }
175 153
176 blink::WebString BlinkPlatformImpl::userAgent() { 154 blink::WebString BlinkPlatformImpl::userAgent() {
177 return blink::WebString::fromUTF8(kUserAgentString); 155 return blink::WebString::fromUTF8(kUserAgentString);
178 } 156 }
179 157
180 blink::WebData BlinkPlatformImpl::parseDataURL( 158 blink::WebData BlinkPlatformImpl::parseDataURL(
181 const blink::WebURL& url, 159 const blink::WebURL& url,
182 blink::WebString& mimetype_out, 160 blink::WebString& mimetype_out,
183 blink::WebString& charset_out) { 161 blink::WebString& charset_out) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 220 }
243 221
244 // static 222 // static
245 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { 223 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) {
246 WebThreadImplForMessageLoop* impl = 224 WebThreadImplForMessageLoop* impl =
247 static_cast<WebThreadImplForMessageLoop*>(thread); 225 static_cast<WebThreadImplForMessageLoop*>(thread);
248 delete impl; 226 delete impl;
249 } 227 }
250 228
251 } // namespace mojo 229 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/html_viewer/blink_platform_impl.h ('k') | mojo/services/html_viewer/html_document_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698