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 827223002: [mojo] Make HTML viewer load the blink resources from the generated pak file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding new blink_resource_constants.h file Created 5 years, 11 months 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/services/html_viewer/blink_resource_constants.h"
14 #include "mojo/services/html_viewer/webthread_impl.h" 15 #include "mojo/services/html_viewer/webthread_impl.h"
15 #include "net/base/data_url.h" 16 #include "net/base/data_url.h"
16 #include "net/base/mime_util.h" 17 #include "net/base/mime_util.h"
17 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
18 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" 19 #include "third_party/WebKit/public/platform/WebWaitableEvent.h"
19 20
20 namespace html_viewer { 21 namespace html_viewer {
21 namespace { 22 namespace {
22 23
23 // TODO(darin): Figure out what our UA should really be. 24 // TODO(darin): Figure out what our UA should really be.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 blink::WebScrollbarBehavior* BlinkPlatformImpl::scrollbarBehavior() { 137 blink::WebScrollbarBehavior* BlinkPlatformImpl::scrollbarBehavior() {
137 return &scrollbar_behavior_; 138 return &scrollbar_behavior_;
138 } 139 }
139 140
140 const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag( 141 const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag(
141 const char* category_name) { 142 const char* category_name) {
142 static const unsigned char buf[] = "*"; 143 static const unsigned char buf[] = "*";
143 return buf; 144 return buf;
144 } 145 }
145 146
147 blink::WebData BlinkPlatformImpl::loadResource(const char* resource) {
148 for (size_t i = 0; i < arraysize(kDataResources); ++i) {
149 if (!strcmp(resource, kDataResources[i].name)) {
150 int length;
151 const char* data =
152 blink_resource_map_.GetResource(kDataResources[i].id, &length);
153 CHECK(data != nullptr && length > 0);
154 return blink::WebData(data, length);
155 }
156 }
157 NOTREACHED() << "Requested resource is unavailable!";
158 return blink::WebData();
159 }
160
146 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() { 161 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() {
147 return NULL; 162 return NULL;
148 } 163 }
149 164
150 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { 165 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() {
151 return NULL; 166 return NULL;
152 } 167 }
153 168
154 blink::WebString BlinkPlatformImpl::userAgent() { 169 blink::WebString BlinkPlatformImpl::userAgent() {
155 return blink::WebString::fromUTF8(kUserAgentString); 170 return blink::WebString::fromUTF8(kUserAgentString);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 235 }
221 236
222 // static 237 // static
223 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { 238 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) {
224 WebThreadImplForMessageLoop* impl = 239 WebThreadImplForMessageLoop* impl =
225 static_cast<WebThreadImplForMessageLoop*>(thread); 240 static_cast<WebThreadImplForMessageLoop*>(thread);
226 delete impl; 241 delete impl;
227 } 242 }
228 243
229 } // namespace html_viewer 244 } // namespace html_viewer
OLDNEW
« no previous file with comments | « mojo/services/html_viewer/blink_platform_impl.h ('k') | mojo/services/html_viewer/blink_resource_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698