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 "content/shell/shell_content_browser_client.h" | 5 #include "content/shell/shell_content_browser_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "base/path_service.h" | 37 #include "base/path_service.h" |
38 #include "base/platform_file.h" | 38 #include "base/platform_file.h" |
39 #include "content/shell/android/shell_descriptors.h" | 39 #include "content/shell/android/shell_descriptors.h" |
40 #endif | 40 #endif |
41 | 41 |
42 namespace content { | 42 namespace content { |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 ShellContentBrowserClient* g_browser_client; | 46 ShellContentBrowserClient* g_browser_client; |
| 47 bool g_swap_processes_for_redirect = false; |
47 | 48 |
48 } // namespace | 49 } // namespace |
49 | 50 |
50 ShellContentBrowserClient* ShellContentBrowserClient::Get() { | 51 ShellContentBrowserClient* ShellContentBrowserClient::Get() { |
51 return g_browser_client; | 52 return g_browser_client; |
52 } | 53 } |
53 | 54 |
| 55 void ShellContentBrowserClient::SetSwapProcessesForRedirect(bool swap) { |
| 56 g_swap_processes_for_redirect = swap; |
| 57 } |
| 58 |
54 ShellContentBrowserClient::ShellContentBrowserClient() | 59 ShellContentBrowserClient::ShellContentBrowserClient() |
55 : shell_browser_main_parts_(NULL) { | 60 : shell_browser_main_parts_(NULL) { |
56 DCHECK(!g_browser_client); | 61 DCHECK(!g_browser_client); |
57 g_browser_client = this; | 62 g_browser_client = this; |
58 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 63 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
59 return; | 64 return; |
60 webkit_source_dir_ = GetWebKitRootDirFilePath(); | 65 webkit_source_dir_ = GetWebKitRootDirFilePath(); |
61 } | 66 } |
62 | 67 |
63 ShellContentBrowserClient::~ShellContentBrowserClient() { | 68 ShellContentBrowserClient::~ShellContentBrowserClient() { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 183 |
179 QuotaPermissionContext* | 184 QuotaPermissionContext* |
180 ShellContentBrowserClient::CreateQuotaPermissionContext() { | 185 ShellContentBrowserClient::CreateQuotaPermissionContext() { |
181 return new ShellQuotaPermissionContext(); | 186 return new ShellQuotaPermissionContext(); |
182 } | 187 } |
183 | 188 |
184 net::NetLog* ShellContentBrowserClient::GetNetLog() { | 189 net::NetLog* ShellContentBrowserClient::GetNetLog() { |
185 return shell_browser_main_parts_->net_log(); | 190 return shell_browser_main_parts_->net_log(); |
186 } | 191 } |
187 | 192 |
| 193 bool ShellContentBrowserClient::ShouldSwapProcessesForRedirect( |
| 194 ResourceContext* resource_context, |
| 195 const GURL& current_url, |
| 196 const GURL& new_url) { |
| 197 return g_swap_processes_for_redirect; |
| 198 } |
| 199 |
188 #if defined(OS_ANDROID) | 200 #if defined(OS_ANDROID) |
189 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 201 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
190 const CommandLine& command_line, | 202 const CommandLine& command_line, |
191 int child_process_id, | 203 int child_process_id, |
192 std::vector<content::FileDescriptorInfo>* mappings) { | 204 std::vector<content::FileDescriptorInfo>* mappings) { |
193 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; | 205 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; |
194 base::FilePath pak_file; | 206 base::FilePath pak_file; |
195 bool r = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file); | 207 bool r = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file); |
196 CHECK(r); | 208 CHECK(r); |
197 pak_file = pak_file.Append(FILE_PATH_LITERAL("paks")); | 209 pak_file = pak_file.Append(FILE_PATH_LITERAL("paks")); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 ShellBrowserContext* | 266 ShellBrowserContext* |
255 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 267 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
256 BrowserContext* content_browser_context) { | 268 BrowserContext* content_browser_context) { |
257 if (content_browser_context == browser_context()) | 269 if (content_browser_context == browser_context()) |
258 return browser_context(); | 270 return browser_context(); |
259 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 271 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
260 return off_the_record_browser_context(); | 272 return off_the_record_browser_context(); |
261 } | 273 } |
262 | 274 |
263 } // namespace content | 275 } // namespace content |
OLD | NEW |