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

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: rebase Created 8 years, 3 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #elif defined(OS_MACOSX) 110 #elif defined(OS_MACOSX)
110 #include "chrome/browser/chrome_browser_main_mac.h" 111 #include "chrome/browser/chrome_browser_main_mac.h"
111 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" 112 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h"
112 #elif defined(OS_CHROMEOS) 113 #elif defined(OS_CHROMEOS)
113 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" 114 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
114 #include "chrome/browser/chromeos/login/user_manager.h" 115 #include "chrome/browser/chromeos/login/user_manager.h"
115 #elif defined(OS_LINUX) 116 #elif defined(OS_LINUX)
116 #include "chrome/browser/chrome_browser_main_linux.h" 117 #include "chrome/browser/chrome_browser_main_linux.h"
117 #elif defined(OS_ANDROID) 118 #elif defined(OS_ANDROID)
118 #include "chrome/browser/chrome_browser_main_android.h" 119 #include "chrome/browser/chrome_browser_main_android.h"
120 #include "chrome/common/descriptors_android.h"
119 #elif defined(OS_POSIX) 121 #elif defined(OS_POSIX)
120 #include "chrome/browser/chrome_browser_main_posix.h" 122 #include "chrome/browser/chrome_browser_main_posix.h"
121 #endif 123 #endif
122 124
123 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID) 125 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID)
124 #include "base/linux_util.h" 126 #include "base/linux_util.h"
125 #include "chrome/browser/crash_handler_host_linux.h" 127 #include "chrome/browser/crash_handler_host_linux.h"
126 #endif 128 #endif
127 129
130 #if defined(OS_ANDROID)
131 #include "ui/base/ui_base_paths.h"
132 #endif
133
128 #if defined(USE_NSS) 134 #if defined(USE_NSS)
129 #include "chrome/browser/ui/crypto_module_password_dialog.h" 135 #include "chrome/browser/ui/crypto_module_password_dialog.h"
130 #endif 136 #endif
131 137
132 using content::AccessTokenStore; 138 using content::AccessTokenStore;
133 using content::BrowserThread; 139 using content::BrowserThread;
134 using content::BrowserURLHandler; 140 using content::BrowserURLHandler;
135 using content::ChildProcessSecurityPolicy; 141 using content::ChildProcessSecurityPolicy;
136 using content::QuotaPermissionContext; 142 using content::QuotaPermissionContext;
137 using content::RenderViewHost; 143 using content::RenderViewHost;
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 1675
1670 #if defined(OS_POSIX) && !defined(OS_MACOSX) 1676 #if defined(OS_POSIX) && !defined(OS_MACOSX)
1671 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 1677 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
1672 const CommandLine& command_line, 1678 const CommandLine& command_line,
1673 base::GlobalDescriptors::Mapping* mappings) { 1679 base::GlobalDescriptors::Mapping* mappings) {
1674 int crash_signal_fd = GetCrashSignalFD(command_line); 1680 int crash_signal_fd = GetCrashSignalFD(command_line);
1675 if (crash_signal_fd >= 0) { 1681 if (crash_signal_fd >= 0) {
1676 mappings->push_back(std::pair<base::GlobalDescriptors::Key, int>( 1682 mappings->push_back(std::pair<base::GlobalDescriptors::Key, int>(
1677 kCrashDumpSignal, crash_signal_fd)); 1683 kCrashDumpSignal, crash_signal_fd));
1678 } 1684 }
1685 #if defined(OS_ANDROID)
1686 FilePath data_path;
1687 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path);
1688 DCHECK(!data_path.empty());
1689
1690 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ;
1691 FilePath chrome_pak = data_path.AppendASCII("chrome.pak");
1692 base::PlatformFile f =
1693 base::CreatePlatformFile(chrome_pak, flags, NULL, NULL);
1694 DCHECK(f != base::kInvalidPlatformFileValue);
1695 mappings->push_back(std::pair<base::GlobalDescriptors::Key, int>(
1696 kAndroidChromePakDescriptor, f));
1697
1698 FilePath chrome_resources_pak =
1699 data_path.AppendASCII("chrome_100_percent.pak");
1700 f = base::CreatePlatformFile(chrome_resources_pak, flags, NULL, NULL);
1701 DCHECK(f != base::kInvalidPlatformFileValue);
1702 mappings->push_back(std::pair<base::GlobalDescriptors::Key, int>(
1703 kAndroidUIResourcesPakDescriptor, f));
1704
1705 const std::string locale = GetApplicationLocale();
1706 FilePath locale_pak = ResourceBundle::GetSharedInstance().
1707 GetLocaleFilePath(locale, false);
1708 f = base::CreatePlatformFile(locale_pak, flags, NULL, NULL);
1709 DCHECK(f != base::kInvalidPlatformFileValue);
1710 mappings->push_back(std::pair<base::GlobalDescriptors::Key, int>(
1711 kAndroidLocalePakDescriptor, f));
1712 #endif // defined(OS_ANDROID)
1679 } 1713 }
1680 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 1714 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
1681 1715
1682 #if defined(OS_WIN) 1716 #if defined(OS_WIN)
1683 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { 1717 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() {
1684 return chrome::kBrowserResourcesDll; 1718 return chrome::kBrowserResourcesDll;
1685 } 1719 }
1686 #endif 1720 #endif
1687 1721
1688 #if defined(USE_NSS) 1722 #if defined(USE_NSS)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 partition_id = extension->id(); 1766 partition_id = extension->id();
1733 } 1767 }
1734 1768
1735 // Enforce that IsValidStoragePartitionId() implementation stays in sync. 1769 // Enforce that IsValidStoragePartitionId() implementation stays in sync.
1736 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); 1770 DCHECK(IsValidStoragePartitionId(browser_context, partition_id));
1737 return partition_id; 1771 return partition_id;
1738 } 1772 }
1739 1773
1740 1774
1741 } // namespace chrome 1775 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698