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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 10876056: Additional file descriptor mappings for Android (Closed) Base URL: http://git.chromium.org/chromium/src.git@x509
Patch Set: Updated from a sync Created 8 years, 2 months 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 "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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/path_service.h"
13 #include "base/string_tokenizer.h" 14 #include "base/string_tokenizer.h"
14 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
15 #include "chrome/app/breakpad_mac.h" 16 #include "chrome/app/breakpad_mac.h"
16 #include "chrome/browser/browser_about_handler.h" 17 #include "chrome/browser/browser_about_handler.h"
17 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/browsing_data/browsing_data_helper.h" 19 #include "chrome/browser/browsing_data/browsing_data_helper.h"
19 #include "chrome/browser/browsing_data/browsing_data_remover.h" 20 #include "chrome/browser/browsing_data/browsing_data_remover.h"
20 #include "chrome/browser/character_encoding.h" 21 #include "chrome/browser/character_encoding.h"
21 #include "chrome/browser/chrome_benchmarking_message_filter.h" 22 #include "chrome/browser/chrome_benchmarking_message_filter.h"
22 #include "chrome/browser/chrome_quota_permission_context.h" 23 #include "chrome/browser/chrome_quota_permission_context.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 #elif defined(OS_MACOSX) 113 #elif defined(OS_MACOSX)
113 #include "chrome/browser/chrome_browser_main_mac.h" 114 #include "chrome/browser/chrome_browser_main_mac.h"
114 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" 115 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h"
115 #elif defined(OS_CHROMEOS) 116 #elif defined(OS_CHROMEOS)
116 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" 117 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
117 #include "chrome/browser/chromeos/login/user_manager.h" 118 #include "chrome/browser/chromeos/login/user_manager.h"
118 #elif defined(OS_LINUX) 119 #elif defined(OS_LINUX)
119 #include "chrome/browser/chrome_browser_main_linux.h" 120 #include "chrome/browser/chrome_browser_main_linux.h"
120 #elif defined(OS_ANDROID) 121 #elif defined(OS_ANDROID)
121 #include "chrome/browser/chrome_browser_main_android.h" 122 #include "chrome/browser/chrome_browser_main_android.h"
123 #include "chrome/common/descriptors_android.h"
122 #elif defined(OS_POSIX) 124 #elif defined(OS_POSIX)
123 #include "chrome/browser/chrome_browser_main_posix.h" 125 #include "chrome/browser/chrome_browser_main_posix.h"
124 #endif 126 #endif
125 127
126 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID) 128 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID)
127 #include "base/linux_util.h" 129 #include "base/linux_util.h"
128 #include "chrome/browser/crash_handler_host_linux.h" 130 #include "chrome/browser/crash_handler_host_linux.h"
129 #endif 131 #endif
130 132
131 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 133 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
132 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" 134 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h"
133 #endif 135 #endif
134 136
137 #if defined(OS_ANDROID)
138 #include "ui/base/ui_base_paths.h"
139 #endif
140
135 #if defined(USE_NSS) 141 #if defined(USE_NSS)
136 #include "chrome/browser/ui/crypto_module_password_dialog.h" 142 #include "chrome/browser/ui/crypto_module_password_dialog.h"
137 #endif 143 #endif
138 144
139 using base::FileDescriptor; 145 using base::FileDescriptor;
140 using content::AccessTokenStore; 146 using content::AccessTokenStore;
141 using content::BrowserThread; 147 using content::BrowserThread;
142 using content::BrowserURLHandler; 148 using content::BrowserURLHandler;
143 using content::ChildProcessSecurityPolicy; 149 using content::ChildProcessSecurityPolicy;
144 using content::FileDescriptorInfo; 150 using content::FileDescriptorInfo;
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 #if defined(OS_POSIX) && !defined(OS_MACOSX) 1741 #if defined(OS_POSIX) && !defined(OS_MACOSX)
1736 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 1742 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
1737 const CommandLine& command_line, 1743 const CommandLine& command_line,
1738 std::vector<FileDescriptorInfo>* mappings) { 1744 std::vector<FileDescriptorInfo>* mappings) {
1739 int crash_signal_fd = GetCrashSignalFD(command_line); 1745 int crash_signal_fd = GetCrashSignalFD(command_line);
1740 if (crash_signal_fd >= 0) { 1746 if (crash_signal_fd >= 0) {
1741 mappings->push_back(FileDescriptorInfo(kCrashDumpSignal, 1747 mappings->push_back(FileDescriptorInfo(kCrashDumpSignal,
1742 FileDescriptor(crash_signal_fd, 1748 FileDescriptor(crash_signal_fd,
1743 false))); 1749 false)));
1744 } 1750 }
1751 #if defined(OS_ANDROID)
1752 FilePath data_path;
1753 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path);
1754 DCHECK(!data_path.empty());
1755
1756 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ;
1757 FilePath chrome_pak = data_path.AppendASCII("chrome.pak");
1758 base::PlatformFile f =
1759 base::CreatePlatformFile(chrome_pak, flags, NULL, NULL);
1760 DCHECK(f != base::kInvalidPlatformFileValue);
1761 mappings->push_back(FileDescriptorInfo(kAndroidChromePakDescriptor,
1762 FileDescriptor(f, true)));
1763
1764 FilePath chrome_resources_pak =
1765 data_path.AppendASCII("chrome_100_percent.pak");
1766 f = base::CreatePlatformFile(chrome_resources_pak, flags, NULL, NULL);
1767 DCHECK(f != base::kInvalidPlatformFileValue);
1768 mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor,
1769 FileDescriptor(f, true)));
1770
1771 const std::string locale = GetApplicationLocale();
1772 FilePath locale_pak = ResourceBundle::GetSharedInstance().
1773 GetLocaleFilePath(locale, false);
1774 f = base::CreatePlatformFile(locale_pak, flags, NULL, NULL);
1775 DCHECK(f != base::kInvalidPlatformFileValue);
1776 mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor,
1777 FileDescriptor(f, true)));
1778 #endif // defined(OS_ANDROID)
1745 } 1779 }
1746 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 1780 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
1747 1781
1748 #if defined(OS_WIN) 1782 #if defined(OS_WIN)
1749 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { 1783 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() {
1750 return chrome::kBrowserResourcesDll; 1784 return chrome::kBrowserResourcesDll;
1751 } 1785 }
1752 #endif 1786 #endif
1753 1787
1754 #if defined(USE_NSS) 1788 #if defined(USE_NSS)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1798 partition_id = extension->id(); 1832 partition_id = extension->id();
1799 } 1833 }
1800 1834
1801 // Enforce that IsValidStoragePartitionId() implementation stays in sync. 1835 // Enforce that IsValidStoragePartitionId() implementation stays in sync.
1802 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); 1836 DCHECK(IsValidStoragePartitionId(browser_context, partition_id));
1803 return partition_id; 1837 return partition_id;
1804 } 1838 }
1805 1839
1806 1840
1807 } // namespace chrome 1841 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698