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

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: fix long line errors 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 #if defined(OS_WIN) 108 #if defined(OS_WIN)
108 #include "chrome/browser/chrome_browser_main_win.h" 109 #include "chrome/browser/chrome_browser_main_win.h"
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"
118 #elif defined(OS_ANDROID)
119 #include "chrome/browser/chrome_browser_main_android.h"
120 #include "chrome/common/descriptors_android.h"
117 #elif defined(OS_POSIX) 121 #elif defined(OS_POSIX)
118 #include "chrome/browser/chrome_browser_main_posix.h" 122 #include "chrome/browser/chrome_browser_main_posix.h"
119 #endif 123 #endif
120 124
121 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID) 125 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID)
122 #include "base/linux_util.h" 126 #include "base/linux_util.h"
123 #include "chrome/browser/crash_handler_host_linux.h" 127 #include "chrome/browser/crash_handler_host_linux.h"
124 #endif 128 #endif
125 129
130 #if defined(OS_ANDROID)
131 #include "ui/base/ui_base_paths.h"
132 #endif
133
126 #if defined(USE_NSS) 134 #if defined(USE_NSS)
127 #include "chrome/browser/ui/crypto_module_password_dialog.h" 135 #include "chrome/browser/ui/crypto_module_password_dialog.h"
128 #endif 136 #endif
129 137
130 using content::AccessTokenStore; 138 using content::AccessTokenStore;
131 using content::BrowserThread; 139 using content::BrowserThread;
132 using content::BrowserURLHandler; 140 using content::BrowserURLHandler;
133 using content::ChildProcessSecurityPolicy; 141 using content::ChildProcessSecurityPolicy;
134 using content::QuotaPermissionContext; 142 using content::QuotaPermissionContext;
135 using content::RenderViewHost; 143 using content::RenderViewHost;
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 1681
1674 #if defined(OS_POSIX) && !defined(OS_MACOSX) 1682 #if defined(OS_POSIX) && !defined(OS_MACOSX)
1675 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 1683 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
1676 const CommandLine& command_line, 1684 const CommandLine& command_line,
1677 base::GlobalDescriptors::Mapping* mappings) { 1685 base::GlobalDescriptors::Mapping* mappings) {
1678 int crash_signal_fd = GetCrashSignalFD(command_line); 1686 int crash_signal_fd = GetCrashSignalFD(command_line);
1679 if (crash_signal_fd >= 0) { 1687 if (crash_signal_fd >= 0) {
1680 mappings->push_back(std::pair<base::GlobalDescriptors::Key, int>( 1688 mappings->push_back(std::pair<base::GlobalDescriptors::Key, int>(
1681 kCrashDumpSignal, crash_signal_fd)); 1689 kCrashDumpSignal, crash_signal_fd));
1682 } 1690 }
1691 #if defined(OS_ANDROID)
1692 FilePath data_path;
1693 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path);
1694 DCHECK(!data_path.empty());
1695
1696 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ;
1697 FilePath chrome_pak = data_path.AppendASCII("chrome.pak");
1698 base::PlatformFile f =
1699 base::CreatePlatformFile(chrome_pak, flags, NULL, NULL);
1700 if (f == base::kInvalidPlatformFileValue) {
agl 2012/08/30 01:31:47 This looks like a DCHECK. Also, if this fails then
acleung 2012/08/31 23:36:33 Done.
1701 NOTREACHED() << "Failed to open file when creating renderer process: "
1702 << "chrome.pak";
1703 }
1704 mappings->push_back(std::pair<base::GlobalDescriptors::Key, int>(
1705 kAndroidChromePakDescriptor, f));
1706
1707 FilePath chrome_resources_pak =
1708 data_path.AppendASCII("chrome_100_percent.pak");
1709 f = base::CreatePlatformFile(chrome_resources_pak, flags, NULL, NULL);
1710 if (f == base::kInvalidPlatformFileValue) {
1711 NOTREACHED() << "Failed to open file when creating renderer process: "
1712 << chrome_resources_pak.value();
1713 }
1714 mappings->push_back(std::pair<base::GlobalDescriptors::Key, int>(
1715 kAndroidUIResourcesPakDescriptor, f));
1716 #endif // defined(OS_ANDROID)
1683 } 1717 }
1684 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 1718 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
1685 1719
1686 #if defined(OS_WIN) 1720 #if defined(OS_WIN)
1687 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { 1721 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() {
1688 return chrome::kBrowserResourcesDll; 1722 return chrome::kBrowserResourcesDll;
1689 } 1723 }
1690 #endif 1724 #endif
1691 1725
1692 #if defined(USE_NSS) 1726 #if defined(USE_NSS)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 partition_id = extension->id(); 1770 partition_id = extension->id();
1737 } 1771 }
1738 1772
1739 // Enforce that IsValidStoragePartitionId() implementation stays in sync. 1773 // Enforce that IsValidStoragePartitionId() implementation stays in sync.
1740 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); 1774 DCHECK(IsValidStoragePartitionId(browser_context, partition_id));
1741 return partition_id; 1775 return partition_id;
1742 } 1776 }
1743 1777
1744 1778
1745 } // namespace chrome 1779 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698