| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/renderer_webkitclient_impl.h" | 5 #include "chrome/renderer/renderer_webkitclient_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
| 10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/renderer/net/renderer_net_predictor.h" | 21 #include "chrome/renderer/net/renderer_net_predictor.h" |
| 22 #include "chrome/renderer/render_thread.h" | 22 #include "chrome/renderer/render_thread.h" |
| 23 #include "chrome/renderer/render_view.h" | 23 #include "chrome/renderer/render_view.h" |
| 24 #include "chrome/renderer/renderer_webaudiodevice_impl.h" | 24 #include "chrome/renderer/renderer_webaudiodevice_impl.h" |
| 25 #include "chrome/renderer/renderer_webidbfactory_impl.h" | 25 #include "chrome/renderer/renderer_webidbfactory_impl.h" |
| 26 #include "chrome/renderer/renderer_webstoragenamespace_impl.h" | 26 #include "chrome/renderer/renderer_webstoragenamespace_impl.h" |
| 27 #include "chrome/renderer/visitedlink_slave.h" | 27 #include "chrome/renderer/visitedlink_slave.h" |
| 28 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" | 28 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" |
| 29 #include "chrome/renderer/websharedworkerrepository_impl.h" | 29 #include "chrome/renderer/websharedworkerrepository_impl.h" |
| 30 #include "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
| 31 #include "grit/common_resources.h" |
| 31 #include "ipc/ipc_sync_message_filter.h" | 32 #include "ipc/ipc_sync_message_filter.h" |
| 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlobRegistry.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlobRegistry.h" |
| 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D.
h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D.
h" |
| 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" | 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" |
| 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" |
| 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" |
| 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptVa
lue.h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptVa
lue.h" |
| 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispat
cher.h" | 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispat
cher.h" |
| 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 return; | 236 return; |
| 236 | 237 |
| 237 // Let the browser know we generated cacheable metadata for this resource. The | 238 // Let the browser know we generated cacheable metadata for this resource. The |
| 238 // browser may cache it and return it on subsequent responses to speed | 239 // browser may cache it and return it on subsequent responses to speed |
| 239 // the processing of this resource. | 240 // the processing of this resource. |
| 240 std::vector<char> copy(data, data + size); | 241 std::vector<char> copy(data, data + size); |
| 241 RenderThread::current()->Send(new ViewHostMsg_DidGenerateCacheableMetadata( | 242 RenderThread::current()->Send(new ViewHostMsg_DidGenerateCacheableMetadata( |
| 242 url, response_time, copy)); | 243 url, response_time, copy)); |
| 243 } | 244 } |
| 244 | 245 |
| 246 WebKit::WebData RendererWebKitClientImpl::loadResource(const char* name) { |
| 247 struct { |
| 248 const char* name; |
| 249 int id; |
| 250 } resources[] = { |
| 251 { "americanExpressCC", IDR_AUTOFILL_CC_AMEX }, |
| 252 { "dinersCC", IDR_AUTOFILL_CC_DINERS }, |
| 253 { "discoverCC", IDR_AUTOFILL_CC_DISCOVER }, |
| 254 { "genericCC", IDR_AUTOFILL_CC_GENERIC }, |
| 255 { "jcbCC", IDR_AUTOFILL_CC_JCB }, |
| 256 { "masterCardCC", IDR_AUTOFILL_CC_MASTERCARD }, |
| 257 { "soloCC", IDR_AUTOFILL_CC_SOLO }, |
| 258 { "visaCC", IDR_AUTOFILL_CC_VISA }, |
| 259 }; |
| 260 |
| 261 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) { |
| 262 if (!strcmp(name, resources[i].name)) { |
| 263 base::StringPiece resource = |
| 264 webkit_glue::GetDataResource(resources[i].id); |
| 265 return WebKit::WebData(resource.data(), resource.size()); |
| 266 } |
| 267 } |
| 268 |
| 269 // The resource in webkit/glue/webkit_resources.grd can be only loaded by |
| 270 // WebClientImpl class. |
| 271 return webkit_glue::WebKitClientImpl::loadResource(name); |
| 272 } |
| 273 |
| 245 WebString RendererWebKitClientImpl::defaultLocale() { | 274 WebString RendererWebKitClientImpl::defaultLocale() { |
| 246 // TODO(darin): Eliminate this webkit_glue call. | 275 // TODO(darin): Eliminate this webkit_glue call. |
| 247 return ASCIIToUTF16(webkit_glue::GetWebKitLocale()); | 276 return ASCIIToUTF16(webkit_glue::GetWebKitLocale()); |
| 248 } | 277 } |
| 249 | 278 |
| 250 void RendererWebKitClientImpl::suddenTerminationChanged(bool enabled) { | 279 void RendererWebKitClientImpl::suddenTerminationChanged(bool enabled) { |
| 251 if (enabled) { | 280 if (enabled) { |
| 252 // We should not get more enables than disables, but we want it to be a | 281 // We should not get more enables than disables, but we want it to be a |
| 253 // non-fatal error if it does happen. | 282 // non-fatal error if it does happen. |
| 254 DCHECK_GT(sudden_termination_disables_, 0); | 283 DCHECK_GT(sudden_termination_disables_, 0); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 return WebString::fromUTF8(signed_public_key); | 586 return WebString::fromUTF8(signed_public_key); |
| 558 } | 587 } |
| 559 | 588 |
| 560 //------------------------------------------------------------------------------ | 589 //------------------------------------------------------------------------------ |
| 561 | 590 |
| 562 WebBlobRegistry* RendererWebKitClientImpl::blobRegistry() { | 591 WebBlobRegistry* RendererWebKitClientImpl::blobRegistry() { |
| 563 if (!blob_registry_.get()) | 592 if (!blob_registry_.get()) |
| 564 blob_registry_.reset(new WebBlobRegistryImpl(RenderThread::current())); | 593 blob_registry_.reset(new WebBlobRegistryImpl(RenderThread::current())); |
| 565 return blob_registry_.get(); | 594 return blob_registry_.get(); |
| 566 } | 595 } |
| OLD | NEW |