| 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 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 | 1760 |
| 1756 FilePath ChromeContentBrowserClient::GetHyphenDictionaryDirectory() { | 1761 FilePath ChromeContentBrowserClient::GetHyphenDictionaryDirectory() { |
| 1757 FilePath directory; | 1762 FilePath directory; |
| 1758 PathService::Get(chrome::DIR_APP_DICTIONARIES, &directory); | 1763 PathService::Get(chrome::DIR_APP_DICTIONARIES, &directory); |
| 1759 return directory.Append(FILE_PATH_LITERAL("Hyphen")); | 1764 return directory.Append(FILE_PATH_LITERAL("Hyphen")); |
| 1760 } | 1765 } |
| 1761 | 1766 |
| 1762 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 1767 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 1763 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 1768 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
| 1764 const CommandLine& command_line, | 1769 const CommandLine& command_line, |
| 1770 int child_process_id, |
| 1765 std::vector<FileDescriptorInfo>* mappings) { | 1771 std::vector<FileDescriptorInfo>* mappings) { |
| 1766 int crash_signal_fd = GetCrashSignalFD(command_line); | |
| 1767 if (crash_signal_fd >= 0) { | |
| 1768 mappings->push_back(FileDescriptorInfo(kCrashDumpSignal, | |
| 1769 FileDescriptor(crash_signal_fd, | |
| 1770 false))); | |
| 1771 } | |
| 1772 #if defined(OS_ANDROID) | 1772 #if defined(OS_ANDROID) |
| 1773 FilePath data_path; | 1773 FilePath data_path; |
| 1774 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); | 1774 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); |
| 1775 DCHECK(!data_path.empty()); | 1775 DCHECK(!data_path.empty()); |
| 1776 | 1776 |
| 1777 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; | 1777 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; |
| 1778 FilePath chrome_pak = data_path.AppendASCII("chrome.pak"); | 1778 FilePath chrome_pak = data_path.AppendASCII("chrome.pak"); |
| 1779 base::PlatformFile f = | 1779 base::PlatformFile f = |
| 1780 base::CreatePlatformFile(chrome_pak, flags, NULL, NULL); | 1780 base::CreatePlatformFile(chrome_pak, flags, NULL, NULL); |
| 1781 DCHECK(f != base::kInvalidPlatformFileValue); | 1781 DCHECK(f != base::kInvalidPlatformFileValue); |
| 1782 mappings->push_back(FileDescriptorInfo(kAndroidChromePakDescriptor, | 1782 mappings->push_back(FileDescriptorInfo(kAndroidChromePakDescriptor, |
| 1783 FileDescriptor(f, true))); | 1783 FileDescriptor(f, true))); |
| 1784 | 1784 |
| 1785 FilePath chrome_resources_pak = | 1785 FilePath chrome_resources_pak = |
| 1786 data_path.AppendASCII("chrome_100_percent.pak"); | 1786 data_path.AppendASCII("chrome_100_percent.pak"); |
| 1787 f = base::CreatePlatformFile(chrome_resources_pak, flags, NULL, NULL); | 1787 f = base::CreatePlatformFile(chrome_resources_pak, flags, NULL, NULL); |
| 1788 DCHECK(f != base::kInvalidPlatformFileValue); | 1788 DCHECK(f != base::kInvalidPlatformFileValue); |
| 1789 mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, | 1789 mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, |
| 1790 FileDescriptor(f, true))); | 1790 FileDescriptor(f, true))); |
| 1791 | 1791 |
| 1792 const std::string locale = GetApplicationLocale(); | 1792 const std::string locale = GetApplicationLocale(); |
| 1793 FilePath locale_pak = ResourceBundle::GetSharedInstance(). | 1793 FilePath locale_pak = ResourceBundle::GetSharedInstance(). |
| 1794 GetLocaleFilePath(locale, false); | 1794 GetLocaleFilePath(locale, false); |
| 1795 f = base::CreatePlatformFile(locale_pak, flags, NULL, NULL); | 1795 f = base::CreatePlatformFile(locale_pak, flags, NULL, NULL); |
| 1796 DCHECK(f != base::kInvalidPlatformFileValue); | 1796 DCHECK(f != base::kInvalidPlatformFileValue); |
| 1797 mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, | 1797 mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, |
| 1798 FileDescriptor(f, true))); | 1798 FileDescriptor(f, true))); |
| 1799 |
| 1800 #if defined(USE_LINUX_BREAKPAD) |
| 1801 f = crash_dump_manager_->CreateMinidumpFile(child_process_id); |
| 1802 if (f == base::kInvalidPlatformFileValue) { |
| 1803 LOG(ERROR) << "Failed to create file for minidump, crash reporting will be " |
| 1804 "disabled for this process."; |
| 1805 } else { |
| 1806 mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor, |
| 1807 FileDescriptor(f, true))); |
| 1808 } |
| 1809 #endif // defined(USE_LINUX_BREAKPAD) |
| 1810 |
| 1811 #else |
| 1812 int crash_signal_fd = GetCrashSignalFD(command_line); |
| 1813 if (crash_signal_fd >= 0) { |
| 1814 mappings->push_back(FileDescriptorInfo(kCrashDumpSignal, |
| 1815 FileDescriptor(crash_signal_fd, |
| 1816 false))); |
| 1817 } |
| 1799 #endif // defined(OS_ANDROID) | 1818 #endif // defined(OS_ANDROID) |
| 1800 } | 1819 } |
| 1801 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 1820 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
| 1802 | 1821 |
| 1803 #if defined(OS_WIN) | 1822 #if defined(OS_WIN) |
| 1804 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { | 1823 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { |
| 1805 return chrome::kBrowserResourcesDll; | 1824 return chrome::kBrowserResourcesDll; |
| 1806 } | 1825 } |
| 1807 #endif | 1826 #endif |
| 1808 | 1827 |
| 1828 #if defined(OS_ANDROID) |
| 1829 void ChromeContentBrowserClient::InitCrashDumpManager() { |
| 1830 if (!crash_dump_manager_.get()) |
| 1831 crash_dump_manager_.reset(new CrashDumpManager()); |
| 1832 } |
| 1833 #endif |
| 1834 |
| 1809 #if defined(USE_NSS) | 1835 #if defined(USE_NSS) |
| 1810 crypto::CryptoModuleBlockingPasswordDelegate* | 1836 crypto::CryptoModuleBlockingPasswordDelegate* |
| 1811 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 1837 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 1812 const GURL& url) { | 1838 const GURL& url) { |
| 1813 return chrome::NewCryptoModuleBlockingDialogDelegate( | 1839 return chrome::NewCryptoModuleBlockingDialogDelegate( |
| 1814 chrome::kCryptoModulePasswordKeygen, url.host()); | 1840 chrome::kCryptoModulePasswordKeygen, url.host()); |
| 1815 } | 1841 } |
| 1816 #endif | 1842 #endif |
| 1817 | 1843 |
| 1818 void ChromeContentBrowserClient::SetApplicationLocale( | 1844 void ChromeContentBrowserClient::SetApplicationLocale( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 partition_id = extension->id(); | 1879 partition_id = extension->id(); |
| 1854 } | 1880 } |
| 1855 | 1881 |
| 1856 // Enforce that IsValidStoragePartitionId() implementation stays in sync. | 1882 // Enforce that IsValidStoragePartitionId() implementation stays in sync. |
| 1857 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); | 1883 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); |
| 1858 return partition_id; | 1884 return partition_id; |
| 1859 } | 1885 } |
| 1860 | 1886 |
| 1861 | 1887 |
| 1862 } // namespace chrome | 1888 } // namespace chrome |
| OLD | NEW |