| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 // aka ChromeFrame then we need to retrieve cookie settings from the external | 526 // aka ChromeFrame then we need to retrieve cookie settings from the external |
| 527 // host. | 527 // host. |
| 528 *cookies_enabled = content::GetContentClient()->browser()->AllowGetCookie( | 528 *cookies_enabled = content::GetContentClient()->browser()->AllowGetCookie( |
| 529 url, first_party_for_cookies, net::CookieList(), resource_context_, | 529 url, first_party_for_cookies, net::CookieList(), resource_context_, |
| 530 render_process_id_, MSG_ROUTING_CONTROL); | 530 render_process_id_, MSG_ROUTING_CONTROL); |
| 531 } | 531 } |
| 532 | 532 |
| 533 #if defined(OS_MACOSX) | 533 #if defined(OS_MACOSX) |
| 534 void RenderMessageFilter::OnLoadFont(const FontDescriptor& font, | 534 void RenderMessageFilter::OnLoadFont(const FontDescriptor& font, |
| 535 uint32* handle_size, | 535 uint32* handle_size, |
| 536 base::SharedMemoryHandle* handle) { | 536 base::SharedMemoryHandle* handle, |
| 537 uint32* font_id) { |
| 537 base::SharedMemory font_data; | 538 base::SharedMemory font_data; |
| 538 uint32 font_data_size = 0; | 539 uint32 font_data_size = 0; |
| 539 bool ok = FontLoader::LoadFontIntoBuffer(font.ToNSFont(), &font_data, | 540 bool ok = FontLoader::LoadFontIntoBuffer(font.ToNSFont(), &font_data, |
| 540 &font_data_size); | 541 &font_data_size, font_id); |
| 541 if (!ok || font_data_size == 0) { | 542 if (!ok || font_data_size == 0 || *font_id == 0) { |
| 542 LOG(ERROR) << "Couldn't load font data for " << font.font_name << | 543 LOG(ERROR) << "Couldn't load font data for " << font.font_name << |
| 543 " ok=" << ok << " font_data_size=" << font_data_size; | 544 " ok=" << ok << " font_data_size=" << font_data_size << |
| 545 " font id=" << *font_id; |
| 544 *handle_size = 0; | 546 *handle_size = 0; |
| 545 *handle = base::SharedMemory::NULLHandle(); | 547 *handle = base::SharedMemory::NULLHandle(); |
| 548 *font_id = 0; |
| 546 return; | 549 return; |
| 547 } | 550 } |
| 548 | 551 |
| 549 *handle_size = font_data_size; | 552 *handle_size = font_data_size; |
| 550 font_data.GiveToProcess(base::GetCurrentProcessHandle(), handle); | 553 font_data.GiveToProcess(base::GetCurrentProcessHandle(), handle); |
| 551 } | 554 } |
| 552 #endif // OS_MACOSX | 555 #endif // OS_MACOSX |
| 553 | 556 |
| 554 #if defined(OS_WIN) // This hack is Windows-specific. | 557 #if defined(OS_WIN) // This hack is Windows-specific. |
| 555 void RenderMessageFilter::OnPreCacheFont(LOGFONT font) { | 558 void RenderMessageFilter::OnPreCacheFont(LOGFONT font) { |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 file_for_transit = base::FileDescriptor(file, true); | 906 file_for_transit = base::FileDescriptor(file, true); |
| 904 #endif | 907 #endif |
| 905 } | 908 } |
| 906 | 909 |
| 907 IPC::Message* reply = new ViewMsg_AsyncOpenFile_ACK( | 910 IPC::Message* reply = new ViewMsg_AsyncOpenFile_ACK( |
| 908 routing_id, error_code, file_for_transit, message_id); | 911 routing_id, error_code, file_for_transit, message_id); |
| 909 BrowserThread::PostTask( | 912 BrowserThread::PostTask( |
| 910 BrowserThread::IO, FROM_HERE, NewRunnableMethod( | 913 BrowserThread::IO, FROM_HERE, NewRunnableMethod( |
| 911 this, &RenderMessageFilter::Send, reply)); | 914 this, &RenderMessageFilter::Send, reply)); |
| 912 } | 915 } |
| OLD | NEW |