| OLD | NEW |
| 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 "chrome/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 #include "chrome/browser/chrome_browser_main_win.h" | 113 #include "chrome/browser/chrome_browser_main_win.h" |
| 114 #elif defined(OS_MACOSX) | 114 #elif defined(OS_MACOSX) |
| 115 #include "chrome/browser/chrome_browser_main_mac.h" | 115 #include "chrome/browser/chrome_browser_main_mac.h" |
| 116 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" | 116 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" |
| 117 #elif defined(OS_CHROMEOS) | 117 #elif defined(OS_CHROMEOS) |
| 118 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" | 118 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
| 119 #include "chrome/browser/chromeos/login/user_manager.h" | 119 #include "chrome/browser/chromeos/login/user_manager.h" |
| 120 #elif defined(OS_LINUX) | 120 #elif defined(OS_LINUX) |
| 121 #include "chrome/browser/chrome_browser_main_linux.h" | 121 #include "chrome/browser/chrome_browser_main_linux.h" |
| 122 #elif defined(OS_ANDROID) | 122 #elif defined(OS_ANDROID) |
| 123 #include "chrome/browser/android/crash_dump_manager.h" |
| 123 #include "chrome/browser/chrome_browser_main_android.h" | 124 #include "chrome/browser/chrome_browser_main_android.h" |
| 124 #include "chrome/common/descriptors_android.h" | 125 #include "chrome/common/descriptors_android.h" |
| 125 #elif defined(OS_POSIX) | 126 #elif defined(OS_POSIX) |
| 126 #include "chrome/browser/chrome_browser_main_posix.h" | 127 #include "chrome/browser/chrome_browser_main_posix.h" |
| 127 #endif | 128 #endif |
| 128 | 129 |
| 129 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID) | 130 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID) |
| 130 #include "base/linux_util.h" | 131 #include "base/linux_util.h" |
| 131 #include "chrome/browser/crash_handler_host_linux.h" | 132 #include "chrome/browser/crash_handler_host_linux.h" |
| 132 #endif | 133 #endif |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 new prerender::PrerenderMessageFilter(id, profile)); | 565 new prerender::PrerenderMessageFilter(id, profile)); |
| 565 | 566 |
| 566 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( | 567 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( |
| 567 profile->IsOffTheRecord())); | 568 profile->IsOffTheRecord())); |
| 568 | 569 |
| 569 SendExtensionWebRequestStatusToHost(host); | 570 SendExtensionWebRequestStatusToHost(host); |
| 570 | 571 |
| 571 RendererContentSettingRules rules; | 572 RendererContentSettingRules rules; |
| 572 GetRendererContentSettingRules(profile->GetHostContentSettingsMap(), &rules); | 573 GetRendererContentSettingRules(profile->GetHostContentSettingsMap(), &rules); |
| 573 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); | 574 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); |
| 575 |
| 576 #if defined(OS_ANDROID) && defined(USE_LINUX_BREAKPAD) |
| 577 InitCrashDumpManager(); |
| 578 #endif |
| 574 } | 579 } |
| 575 | 580 |
| 576 void ChromeContentBrowserClient::BrowserChildProcessHostCreated( | 581 void ChromeContentBrowserClient::BrowserChildProcessHostCreated( |
| 577 content::BrowserChildProcessHost* host) { | 582 content::BrowserChildProcessHost* host) { |
| 578 host->GetHost()->AddFilter(new PepperGtalkMessageFilter()); | 583 host->GetHost()->AddFilter(new PepperGtalkMessageFilter()); |
| 579 } | 584 } |
| 580 | 585 |
| 581 content::WebUIControllerFactory* | 586 content::WebUIControllerFactory* |
| 582 ChromeContentBrowserClient::GetWebUIControllerFactory() { | 587 ChromeContentBrowserClient::GetWebUIControllerFactory() { |
| 583 return ChromeWebUIControllerFactory::GetInstance(); | 588 return ChromeWebUIControllerFactory::GetInstance(); |
| (...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 | 1757 |
| 1753 FilePath ChromeContentBrowserClient::GetHyphenDictionaryDirectory() { | 1758 FilePath ChromeContentBrowserClient::GetHyphenDictionaryDirectory() { |
| 1754 FilePath directory; | 1759 FilePath directory; |
| 1755 PathService::Get(chrome::DIR_APP_DICTIONARIES, &directory); | 1760 PathService::Get(chrome::DIR_APP_DICTIONARIES, &directory); |
| 1756 return directory.Append(FILE_PATH_LITERAL("Hyphen")); | 1761 return directory.Append(FILE_PATH_LITERAL("Hyphen")); |
| 1757 } | 1762 } |
| 1758 | 1763 |
| 1759 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 1764 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 1760 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 1765 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
| 1761 const CommandLine& command_line, | 1766 const CommandLine& command_line, |
| 1767 int child_process_id, |
| 1762 std::vector<FileDescriptorInfo>* mappings) { | 1768 std::vector<FileDescriptorInfo>* mappings) { |
| 1763 int crash_signal_fd = GetCrashSignalFD(command_line); | |
| 1764 if (crash_signal_fd >= 0) { | |
| 1765 mappings->push_back(FileDescriptorInfo(kCrashDumpSignal, | |
| 1766 FileDescriptor(crash_signal_fd, | |
| 1767 false))); | |
| 1768 } | |
| 1769 #if defined(OS_ANDROID) | 1769 #if defined(OS_ANDROID) |
| 1770 FilePath data_path; | 1770 FilePath data_path; |
| 1771 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); | 1771 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); |
| 1772 DCHECK(!data_path.empty()); | 1772 DCHECK(!data_path.empty()); |
| 1773 | 1773 |
| 1774 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; | 1774 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; |
| 1775 FilePath chrome_pak = data_path.AppendASCII("chrome.pak"); | 1775 FilePath chrome_pak = data_path.AppendASCII("chrome.pak"); |
| 1776 base::PlatformFile f = | 1776 base::PlatformFile f = |
| 1777 base::CreatePlatformFile(chrome_pak, flags, NULL, NULL); | 1777 base::CreatePlatformFile(chrome_pak, flags, NULL, NULL); |
| 1778 DCHECK(f != base::kInvalidPlatformFileValue); | 1778 DCHECK(f != base::kInvalidPlatformFileValue); |
| 1779 mappings->push_back(FileDescriptorInfo(kAndroidChromePakDescriptor, | 1779 mappings->push_back(FileDescriptorInfo(kAndroidChromePakDescriptor, |
| 1780 FileDescriptor(f, true))); | 1780 FileDescriptor(f, true))); |
| 1781 | 1781 |
| 1782 FilePath chrome_resources_pak = | 1782 FilePath chrome_resources_pak = |
| 1783 data_path.AppendASCII("chrome_100_percent.pak"); | 1783 data_path.AppendASCII("chrome_100_percent.pak"); |
| 1784 f = base::CreatePlatformFile(chrome_resources_pak, flags, NULL, NULL); | 1784 f = base::CreatePlatformFile(chrome_resources_pak, flags, NULL, NULL); |
| 1785 DCHECK(f != base::kInvalidPlatformFileValue); | 1785 DCHECK(f != base::kInvalidPlatformFileValue); |
| 1786 mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, | 1786 mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, |
| 1787 FileDescriptor(f, true))); | 1787 FileDescriptor(f, true))); |
| 1788 | 1788 |
| 1789 const std::string locale = GetApplicationLocale(); | 1789 const std::string locale = GetApplicationLocale(); |
| 1790 FilePath locale_pak = ResourceBundle::GetSharedInstance(). | 1790 FilePath locale_pak = ResourceBundle::GetSharedInstance(). |
| 1791 GetLocaleFilePath(locale, false); | 1791 GetLocaleFilePath(locale, false); |
| 1792 f = base::CreatePlatformFile(locale_pak, flags, NULL, NULL); | 1792 f = base::CreatePlatformFile(locale_pak, flags, NULL, NULL); |
| 1793 DCHECK(f != base::kInvalidPlatformFileValue); | 1793 DCHECK(f != base::kInvalidPlatformFileValue); |
| 1794 mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, | 1794 mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, |
| 1795 FileDescriptor(f, true))); | 1795 FileDescriptor(f, true))); |
| 1796 |
| 1797 #if defined(USE_LINUX_BREAKPAD) |
| 1798 f = crash_dump_manager_->CreateMinidumpFile(child_process_id); |
| 1799 if (f == base::kInvalidPlatformFileValue) { |
| 1800 LOG(ERROR) << "Failed to create file for minidump, crash reporting will be " |
| 1801 "disabled for this process."; |
| 1802 } else { |
| 1803 mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor, |
| 1804 FileDescriptor(f, true))); |
| 1805 } |
| 1806 #endif // defined(USE_LINUX_BREAKPAD) |
| 1807 |
| 1808 #else |
| 1809 int crash_signal_fd = GetCrashSignalFD(command_line); |
| 1810 if (crash_signal_fd >= 0) { |
| 1811 mappings->push_back(FileDescriptorInfo(kCrashDumpSignal, |
| 1812 FileDescriptor(crash_signal_fd, |
| 1813 false))); |
| 1814 } |
| 1796 #endif // defined(OS_ANDROID) | 1815 #endif // defined(OS_ANDROID) |
| 1797 } | 1816 } |
| 1798 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 1817 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
| 1799 | 1818 |
| 1800 #if defined(OS_WIN) | 1819 #if defined(OS_WIN) |
| 1801 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { | 1820 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { |
| 1802 return chrome::kBrowserResourcesDll; | 1821 return chrome::kBrowserResourcesDll; |
| 1803 } | 1822 } |
| 1804 #endif | 1823 #endif |
| 1805 | 1824 |
| 1825 #if defined(OS_ANDROID) |
| 1826 void ChromeContentBrowserClient::InitCrashDumpManager() { |
| 1827 if (!crash_dump_manager_.get()) |
| 1828 crash_dump_manager_.reset(new CrashDumpManager()); |
| 1829 } |
| 1830 #endif |
| 1831 |
| 1806 #if defined(USE_NSS) | 1832 #if defined(USE_NSS) |
| 1807 crypto::CryptoModuleBlockingPasswordDelegate* | 1833 crypto::CryptoModuleBlockingPasswordDelegate* |
| 1808 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 1834 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 1809 const GURL& url) { | 1835 const GURL& url) { |
| 1810 return chrome::NewCryptoModuleBlockingDialogDelegate( | 1836 return chrome::NewCryptoModuleBlockingDialogDelegate( |
| 1811 chrome::kCryptoModulePasswordKeygen, url.host()); | 1837 chrome::kCryptoModulePasswordKeygen, url.host()); |
| 1812 } | 1838 } |
| 1813 #endif | 1839 #endif |
| 1814 | 1840 |
| 1815 void ChromeContentBrowserClient::SetApplicationLocale( | 1841 void ChromeContentBrowserClient::SetApplicationLocale( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 partition_id = extension->id(); | 1876 partition_id = extension->id(); |
| 1851 } | 1877 } |
| 1852 | 1878 |
| 1853 // Enforce that IsValidStoragePartitionId() implementation stays in sync. | 1879 // Enforce that IsValidStoragePartitionId() implementation stays in sync. |
| 1854 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); | 1880 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); |
| 1855 return partition_id; | 1881 return partition_id; |
| 1856 } | 1882 } |
| 1857 | 1883 |
| 1858 | 1884 |
| 1859 } // namespace chrome | 1885 } // namespace chrome |
| OLD | NEW |