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