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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 #include "content/public/browser/render_process_host.h" | 116 #include "content/public/browser/render_process_host.h" |
117 #include "content/public/browser/render_view_host.h" | 117 #include "content/public/browser/render_view_host.h" |
118 #include "content/public/browser/resource_context.h" | 118 #include "content/public/browser/resource_context.h" |
119 #include "content/public/browser/site_instance.h" | 119 #include "content/public/browser/site_instance.h" |
120 #include "content/public/browser/web_contents.h" | 120 #include "content/public/browser/web_contents.h" |
121 #include "content/public/common/child_process_host.h" | 121 #include "content/public/common/child_process_host.h" |
122 #include "content/public/common/content_descriptors.h" | 122 #include "content/public/common/content_descriptors.h" |
123 #include "content/public/common/service_registry.h" | 123 #include "content/public/common/service_registry.h" |
124 #include "content/public/common/url_utils.h" | 124 #include "content/public/common/url_utils.h" |
125 #include "content/public/common/web_preferences.h" | 125 #include "content/public/common/web_preferences.h" |
126 #include "gin/v8_initializer.h" | |
127 #include "net/base/mime_util.h" | 126 #include "net/base/mime_util.h" |
128 #include "net/cookies/canonical_cookie.h" | 127 #include "net/cookies/canonical_cookie.h" |
129 #include "net/cookies/cookie_options.h" | 128 #include "net/cookies/cookie_options.h" |
130 #include "net/ssl/ssl_cert_request_info.h" | 129 #include "net/ssl/ssl_cert_request_info.h" |
131 #include "ppapi/host/ppapi_host.h" | 130 #include "ppapi/host/ppapi_host.h" |
132 #include "storage/browser/fileapi/external_mount_points.h" | 131 #include "storage/browser/fileapi/external_mount_points.h" |
133 #include "ui/base/l10n/l10n_util.h" | 132 #include "ui/base/l10n/l10n_util.h" |
134 #include "ui/base/resource/resource_bundle.h" | 133 #include "ui/base/resource/resource_bundle.h" |
135 #include "ui/resources/grit/ui_resources.h" | 134 #include "ui/resources/grit/ui_resources.h" |
136 | 135 |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 incognito)); | 595 incognito)); |
597 } | 596 } |
598 #endif // defined(ENABLE_EXTENSIONS) | 597 #endif // defined(ENABLE_EXTENSIONS) |
599 | 598 |
600 } // namespace | 599 } // namespace |
601 | 600 |
602 namespace chrome { | 601 namespace chrome { |
603 | 602 |
604 ChromeContentBrowserClient::ChromeContentBrowserClient() | 603 ChromeContentBrowserClient::ChromeContentBrowserClient() |
605 : | 604 : |
606 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
607 v8_natives_fd_(-1), | |
608 v8_snapshot_fd_(-1), | |
609 #endif // OS_POSIX && !OS_MACOSX | |
610 weak_factory_(this) { | 605 weak_factory_(this) { |
611 #if defined(ENABLE_PLUGINS) | 606 #if defined(ENABLE_PLUGINS) |
612 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) | 607 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) |
613 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); | 608 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); |
614 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | 609 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) |
615 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | 610 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
616 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 611 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
617 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 612 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
618 | 613 |
619 extra_parts_.push_back(new ChromeContentBrowserClientPluginsPart); | 614 extra_parts_.push_back(new ChromeContentBrowserClientPluginsPart); |
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2213 additional_backends->push_back(backend); | 2208 additional_backends->push_back(backend); |
2214 #endif | 2209 #endif |
2215 | 2210 |
2216 for (size_t i = 0; i < extra_parts_.size(); ++i) { | 2211 for (size_t i = 0; i < extra_parts_.size(); ++i) { |
2217 extra_parts_[i]->GetAdditionalFileSystemBackends( | 2212 extra_parts_[i]->GetAdditionalFileSystemBackends( |
2218 browser_context, storage_partition_path, additional_backends); | 2213 browser_context, storage_partition_path, additional_backends); |
2219 } | 2214 } |
2220 } | 2215 } |
2221 | 2216 |
2222 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 2217 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 2218 |
2223 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 2219 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
2224 const base::CommandLine& command_line, | 2220 const base::CommandLine& command_line, |
2225 int child_process_id, | 2221 int child_process_id, |
2226 FileDescriptorInfo* mappings) { | 2222 FileDescriptorInfo* mappings |
| 2223 #if defined(OS_ANDROID) |
| 2224 , std::map<int, base::MemoryMappedFile::Region>* regions |
| 2225 #endif |
| 2226 ) { |
2227 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 2227 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
2228 if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) { | 2228 if (!v8_files_.IsLoaded()) { |
2229 int v8_natives_fd = -1; | 2229 gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_files_); |
2230 int v8_snapshot_fd = -1; | |
2231 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd, | |
2232 &v8_snapshot_fd)) { | |
2233 v8_natives_fd_.reset(v8_natives_fd); | |
2234 v8_snapshot_fd_.reset(v8_snapshot_fd); | |
2235 } | |
2236 } | 2230 } |
2237 DCHECK(v8_natives_fd_.get() != -1 && v8_snapshot_fd_.get() != -1); | 2231 DCHECK(v8_files_.IsLoaded()); |
2238 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); | 2232 mappings->Share(kV8NativesDataDescriptor, v8_files_.natives_fd.get()); |
2239 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); | 2233 mappings->Share(kV8SnapshotDataDescriptor, v8_files_.snapshot_fd.get()); |
2240 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 2234 LOG(WARNING) << "ANDREW: mapping v8 " << v8_files_.natives_fd.get(); |
| 2235 #if defined(OS_ANDROID) |
| 2236 LOG(WARNING) << "ANDREW: inserting v8 " << v8_files_.natives_fd.get(); |
| 2237 regions->insert( |
| 2238 std::make_pair(kV8NativesDataDescriptor, v8_files_.natives_region)); |
| 2239 regions->insert( |
| 2240 std::make_pair(kV8SnapshotDataDescriptor, v8_files_.snapshot_region)); |
| 2241 #endif // defined(OS_ANDROID) |
| 2242 #endif // V8_USE_EXTERNAL_STARTUP_DATA && !defined(OS_ANDROID) |
2241 | 2243 |
2242 #if defined(OS_ANDROID) | 2244 #if defined(OS_ANDROID) |
2243 base::FilePath data_path; | 2245 base::FilePath data_path; |
2244 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); | 2246 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); |
2245 DCHECK(!data_path.empty()); | 2247 DCHECK(!data_path.empty()); |
2246 | 2248 |
2247 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; | 2249 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; |
2248 base::FilePath chrome_resources_pak = | 2250 base::FilePath chrome_resources_pak = |
2249 data_path.AppendASCII("chrome_100_percent.pak"); | 2251 data_path.AppendASCII("chrome_100_percent.pak"); |
2250 base::File file(chrome_resources_pak, flags); | 2252 base::File file(chrome_resources_pak, flags); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2446 switches::kDisableWebRtcEncryption, | 2448 switches::kDisableWebRtcEncryption, |
2447 }; | 2449 }; |
2448 to_command_line->CopySwitchesFrom(from_command_line, | 2450 to_command_line->CopySwitchesFrom(from_command_line, |
2449 kWebRtcDevSwitchNames, | 2451 kWebRtcDevSwitchNames, |
2450 arraysize(kWebRtcDevSwitchNames)); | 2452 arraysize(kWebRtcDevSwitchNames)); |
2451 } | 2453 } |
2452 } | 2454 } |
2453 #endif // defined(ENABLE_WEBRTC) | 2455 #endif // defined(ENABLE_WEBRTC) |
2454 | 2456 |
2455 } // namespace chrome | 2457 } // namespace chrome |
OLD | NEW |