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

Side by Side Diff: content/browser/renderer_host/render_message_filter.cc

Issue 2536993002: Remove support for the keygen tag (Closed)
Patch Set: Rebased Created 4 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_message_filter.h" 5 #include "content/browser/renderer_host/render_message_filter.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "content/public/browser/user_metrics.h" 54 #include "content/public/browser/user_metrics.h"
55 #include "content/public/common/content_switches.h" 55 #include "content/public/common/content_switches.h"
56 #include "content/public/common/context_menu_params.h" 56 #include "content/public/common/context_menu_params.h"
57 #include "content/public/common/url_constants.h" 57 #include "content/public/common/url_constants.h"
58 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" 58 #include "gpu/ipc/client/gpu_memory_buffer_impl.h"
59 #include "ipc/ipc_channel_handle.h" 59 #include "ipc/ipc_channel_handle.h"
60 #include "ipc/ipc_platform_file.h" 60 #include "ipc/ipc_platform_file.h"
61 #include "media/base/media_log_event.h" 61 #include "media/base/media_log_event.h"
62 #include "mojo/public/cpp/system/platform_handle.h" 62 #include "mojo/public/cpp/system/platform_handle.h"
63 #include "net/base/io_buffer.h" 63 #include "net/base/io_buffer.h"
64 #include "net/base/keygen_handler.h"
65 #include "net/base/mime_util.h" 64 #include "net/base/mime_util.h"
66 #include "net/base/request_priority.h" 65 #include "net/base/request_priority.h"
67 #include "net/http/http_cache.h" 66 #include "net/http/http_cache.h"
68 #include "net/url_request/url_request_context.h" 67 #include "net/url_request/url_request_context.h"
69 #include "net/url_request/url_request_context_getter.h" 68 #include "net/url_request/url_request_context_getter.h"
70 #include "ppapi/shared_impl/file_type_conversion.h" 69 #include "ppapi/shared_impl/file_type_conversion.h"
71 #include "url/gurl.h" 70 #include "url/gurl.h"
72 #include "url/origin.h" 71 #include "url/origin.h"
73 72
74 #if defined(OS_MACOSX) 73 #if defined(OS_MACOSX)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 IPC_MESSAGE_HANDLER_GENERIC( 173 IPC_MESSAGE_HANDLER_GENERIC(
175 ViewHostMsg_SetNeedsBeginFrames, 174 ViewHostMsg_SetNeedsBeginFrames,
176 ResizeHelperPostMsgToUIThread(render_process_id_, message)) 175 ResizeHelperPostMsgToUIThread(render_process_id_, message))
177 #endif 176 #endif
178 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChildProcessHostMsg_HasGpuProcess, 177 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChildProcessHostMsg_HasGpuProcess,
179 OnHasGpuProcess) 178 OnHasGpuProcess)
180 #if defined(OS_LINUX) 179 #if defined(OS_LINUX)
181 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SetThreadPriority, 180 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SetThreadPriority,
182 OnSetThreadPriority) 181 OnSetThreadPriority)
183 #endif 182 #endif
184 IPC_MESSAGE_HANDLER_DELAY_REPLY(RenderProcessHostMsg_Keygen, OnKeygen)
185 IPC_MESSAGE_HANDLER(RenderProcessHostMsg_DidGenerateCacheableMetadata, 183 IPC_MESSAGE_HANDLER(RenderProcessHostMsg_DidGenerateCacheableMetadata,
186 OnCacheableMetadataAvailable) 184 OnCacheableMetadataAvailable)
187 IPC_MESSAGE_HANDLER( 185 IPC_MESSAGE_HANDLER(
188 RenderProcessHostMsg_DidGenerateCacheableMetadataInCacheStorage, 186 RenderProcessHostMsg_DidGenerateCacheableMetadataInCacheStorage,
189 OnCacheableMetadataAvailableForCacheStorage) 187 OnCacheableMetadataAvailableForCacheStorage)
190 #if defined(OS_MACOSX) 188 #if defined(OS_MACOSX)
191 IPC_MESSAGE_HANDLER_DELAY_REPLY(RenderProcessHostMsg_LoadFont, OnLoadFont) 189 IPC_MESSAGE_HANDLER_DELAY_REPLY(RenderProcessHostMsg_LoadFont, OnLoadFont)
192 #endif 190 #endif
193 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaLogEvents, OnMediaLogEvents) 191 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaLogEvents, OnMediaLogEvents)
194 IPC_MESSAGE_UNHANDLED(handled = false) 192 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 if (error != CACHE_STORAGE_OK || !cache_handle || !cache_handle->value()) 396 if (error != CACHE_STORAGE_OK || !cache_handle || !cache_handle->value())
399 return; 397 return;
400 CacheStorageCache* cache = cache_handle->value(); 398 CacheStorageCache* cache = cache_handle->value();
401 if (!cache) 399 if (!cache)
402 return; 400 return;
403 cache->WriteSideData(base::Bind(&NoOpCacheStorageErrorCallback, 401 cache->WriteSideData(base::Bind(&NoOpCacheStorageErrorCallback,
404 base::Passed(std::move(cache_handle))), 402 base::Passed(std::move(cache_handle))),
405 url, expected_response_time, buf, buf_len); 403 url, expected_response_time, buf, buf_len);
406 } 404 }
407 405
408 void RenderMessageFilter::OnKeygen(uint32_t key_size_index,
409 const std::string& challenge_string,
410 const GURL& url,
411 const GURL& top_origin,
412 IPC::Message* reply_msg) {
413 if (!resource_context_)
414 return;
415
416 // Map displayed strings indicating level of keysecurity in the <keygen>
417 // menu to the key size in bits. (See SSLKeyGeneratorChromium.cpp in WebCore.)
418 int key_size_in_bits;
419 switch (key_size_index) {
420 case 0:
421 key_size_in_bits = 2048;
422 break;
423 case 1:
424 key_size_in_bits = 1024;
425 break;
426 default:
427 DCHECK(false) << "Illegal key_size_index " << key_size_index;
428 RenderProcessHostMsg_Keygen::WriteReplyParams(reply_msg, std::string());
429 Send(reply_msg);
430 return;
431 }
432
433 if (!GetContentClient()->browser()->AllowKeygen(top_origin,
434 resource_context_)) {
435 RenderProcessHostMsg_Keygen::WriteReplyParams(reply_msg, std::string());
436 Send(reply_msg);
437 return;
438 }
439
440 resource_context_->CreateKeygenHandler(
441 key_size_in_bits,
442 challenge_string,
443 url,
444 base::Bind(
445 &RenderMessageFilter::PostKeygenToWorkerThread, this, reply_msg));
446 }
447
448 void RenderMessageFilter::PostKeygenToWorkerThread(
449 IPC::Message* reply_msg,
450 std::unique_ptr<net::KeygenHandler> keygen_handler) {
451 VLOG(1) << "Dispatching keygen task to worker pool.";
452 // Dispatch to worker pool, so we do not block the IO thread.
453 if (!base::WorkerPool::PostTask(
454 FROM_HERE,
455 base::Bind(&RenderMessageFilter::OnKeygenOnWorkerThread,
456 this,
457 base::Passed(&keygen_handler),
458 reply_msg),
459 true)) {
460 NOTREACHED() << "Failed to dispatch keygen task to worker pool";
461 RenderProcessHostMsg_Keygen::WriteReplyParams(reply_msg, std::string());
462 Send(reply_msg);
463 }
464 }
465
466 void RenderMessageFilter::OnKeygenOnWorkerThread(
467 std::unique_ptr<net::KeygenHandler> keygen_handler,
468 IPC::Message* reply_msg) {
469 DCHECK(reply_msg);
470
471 // Generate a signed public key and challenge, then send it back.
472 RenderProcessHostMsg_Keygen::WriteReplyParams(
473 reply_msg,
474 keygen_handler->GenKeyAndSignChallenge());
475 Send(reply_msg);
476 }
477
478 void RenderMessageFilter::OnMediaLogEvents( 406 void RenderMessageFilter::OnMediaLogEvents(
479 const std::vector<media::MediaLogEvent>& events) { 407 const std::vector<media::MediaLogEvent>& events) {
480 // OnMediaLogEvents() is always dispatched to the UI thread for handling. 408 // OnMediaLogEvents() is always dispatched to the UI thread for handling.
481 // See OverrideThreadForMessage(). 409 // See OverrideThreadForMessage().
482 DCHECK_CURRENTLY_ON(BrowserThread::UI); 410 DCHECK_CURRENTLY_ON(BrowserThread::UI);
483 if (media_internals_) 411 if (media_internals_)
484 media_internals_->OnMediaEvents(render_process_id_, events); 412 media_internals_->OnMediaEvents(render_process_id_, events);
485 } 413 }
486 414
487 void RenderMessageFilter::OnHasGpuProcess(IPC::Message* reply_ptr) { 415 void RenderMessageFilter::OnHasGpuProcess(IPC::Message* reply_ptr) {
488 std::unique_ptr<IPC::Message> reply(reply_ptr); 416 std::unique_ptr<IPC::Message> reply(reply_ptr);
489 GpuProcessHost::GetProcessHandles( 417 GpuProcessHost::GetProcessHandles(
490 base::Bind(&RenderMessageFilter::GetGpuProcessHandlesCallback, 418 base::Bind(&RenderMessageFilter::GetGpuProcessHandlesCallback,
491 weak_ptr_factory_.GetWeakPtr(), base::Passed(&reply))); 419 weak_ptr_factory_.GetWeakPtr(), base::Passed(&reply)));
492 } 420 }
493 421
494 void RenderMessageFilter::GetGpuProcessHandlesCallback( 422 void RenderMessageFilter::GetGpuProcessHandlesCallback(
495 std::unique_ptr<IPC::Message> reply, 423 std::unique_ptr<IPC::Message> reply,
496 const std::list<base::ProcessHandle>& handles) { 424 const std::list<base::ProcessHandle>& handles) {
497 bool has_gpu_process = handles.size() > 0; 425 bool has_gpu_process = handles.size() > 0;
498 ChildProcessHostMsg_HasGpuProcess::WriteReplyParams(reply.get(), 426 ChildProcessHostMsg_HasGpuProcess::WriteReplyParams(reply.get(),
499 has_gpu_process); 427 has_gpu_process);
500 Send(reply.release()); 428 Send(reply.release());
501 } 429 }
502 430
503 } // namespace content 431 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_message_filter.h ('k') | content/browser/resource_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698