Chromium Code Reviews| 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/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/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "mojo/public/cpp/application/application_impl.h" | 13 #include "mojo/public/cpp/application/application_impl.h" |
| 14 #include "mojo/services/html_viewer/webcookiejar_impl.h" | 14 #include "mojo/services/html_viewer/webcookiejar_impl.h" |
| 15 #include "mojo/services/html_viewer/websockethandle_impl.h" | |
| 15 #include "mojo/services/html_viewer/webthread_impl.h" | 16 #include "mojo/services/html_viewer/webthread_impl.h" |
| 16 #include "mojo/services/html_viewer/weburlloader_impl.h" | 17 #include "mojo/services/html_viewer/weburlloader_impl.h" |
| 17 #include "net/base/data_url.h" | 18 #include "net/base/data_url.h" |
| 18 #include "net/base/mime_util.h" | 19 #include "net/base/mime_util.h" |
| 19 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 20 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 21 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
| 21 | 22 |
| 22 namespace mojo { | 23 namespace mojo { |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag( | 144 const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag( |
| 144 const char* category_name) { | 145 const char* category_name) { |
| 145 static const unsigned char buf[] = "*"; | 146 static const unsigned char buf[] = "*"; |
| 146 return buf; | 147 return buf; |
| 147 } | 148 } |
| 148 | 149 |
| 149 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() { | 150 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() { |
| 150 return new WebURLLoaderImpl(network_service_.get()); | 151 return new WebURLLoaderImpl(network_service_.get()); |
| 151 } | 152 } |
| 152 | 153 |
| 154 blink::WebSocketStreamHandle* BlinkPlatformImpl::createSocketStreamHandle() { | |
| 155 // TODO(mpcomplete): what's this for? | |
|
darin (slow to review)
2014/08/28 22:42:15
This is the legacy way that Blink implemented webs
Matt Perry
2014/08/28 23:24:21
Cool, looks like it's not needed.
| |
| 156 return 0; | |
| 157 } | |
| 158 | |
| 159 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { | |
| 160 return new WebSocketHandleImpl(network_service_.get()); | |
| 161 } | |
| 162 | |
| 153 blink::WebString BlinkPlatformImpl::userAgent() { | 163 blink::WebString BlinkPlatformImpl::userAgent() { |
| 154 return blink::WebString::fromUTF8(kUserAgentString); | 164 return blink::WebString::fromUTF8(kUserAgentString); |
| 155 } | 165 } |
| 156 | 166 |
| 157 blink::WebData BlinkPlatformImpl::parseDataURL( | 167 blink::WebData BlinkPlatformImpl::parseDataURL( |
| 158 const blink::WebURL& url, | 168 const blink::WebURL& url, |
| 159 blink::WebString& mimetype_out, | 169 blink::WebString& mimetype_out, |
| 160 blink::WebString& charset_out) { | 170 blink::WebString& charset_out) { |
| 161 std::string mimetype, charset, data; | 171 std::string mimetype, charset, data; |
| 162 if (net::DataURL::Parse(url, &mimetype, &charset, &data) | 172 if (net::DataURL::Parse(url, &mimetype, &charset, &data) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 } | 225 } |
| 216 | 226 |
| 217 // static | 227 // static |
| 218 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 228 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
| 219 WebThreadImplForMessageLoop* impl = | 229 WebThreadImplForMessageLoop* impl = |
| 220 static_cast<WebThreadImplForMessageLoop*>(thread); | 230 static_cast<WebThreadImplForMessageLoop*>(thread); |
| 221 delete impl; | 231 delete impl; |
| 222 } | 232 } |
| 223 | 233 |
| 224 } // namespace mojo | 234 } // namespace mojo |
| OLD | NEW |