| 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/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 host->GetID(), | 82 host->GetID(), |
| 83 BrowserContext::GetDefaultStoragePartition(browser_context()) | 83 BrowserContext::GetDefaultStoragePartition(browser_context()) |
| 84 ->GetDatabaseTracker(), | 84 ->GetDatabaseTracker(), |
| 85 BrowserContext::GetDefaultStoragePartition(browser_context()) | 85 BrowserContext::GetDefaultStoragePartition(browser_context()) |
| 86 ->GetQuotaManager())); | 86 ->GetQuotaManager())); |
| 87 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_)); | 87 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_)); |
| 88 } | 88 } |
| 89 | 89 |
| 90 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( | 90 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( |
| 91 BrowserContext* content_browser_context, | 91 BrowserContext* content_browser_context, |
| 92 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 92 ProtocolHandlerMap* protocol_handlers) { |
| 93 blob_protocol_handler, | |
| 94 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 95 file_system_protocol_handler, | |
| 96 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 97 developer_protocol_handler, | |
| 98 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 99 chrome_protocol_handler, | |
| 100 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 101 chrome_devtools_protocol_handler) { | |
| 102 ShellBrowserContext* shell_browser_context = | 93 ShellBrowserContext* shell_browser_context = |
| 103 ShellBrowserContextForBrowserContext(content_browser_context); | 94 ShellBrowserContextForBrowserContext(content_browser_context); |
| 104 return shell_browser_context->CreateRequestContext( | 95 return shell_browser_context->CreateRequestContext(protocol_handlers); |
| 105 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), | |
| 106 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), | |
| 107 chrome_devtools_protocol_handler.Pass()); | |
| 108 } | 96 } |
| 109 | 97 |
| 110 net::URLRequestContextGetter* | 98 net::URLRequestContextGetter* |
| 111 ShellContentBrowserClient::CreateRequestContextForStoragePartition( | 99 ShellContentBrowserClient::CreateRequestContextForStoragePartition( |
| 112 BrowserContext* content_browser_context, | 100 BrowserContext* content_browser_context, |
| 113 const base::FilePath& partition_path, | 101 const base::FilePath& partition_path, |
| 114 bool in_memory, | 102 bool in_memory, |
| 115 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 103 ProtocolHandlerMap* protocol_handlers) { |
| 116 blob_protocol_handler, | |
| 117 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 118 file_system_protocol_handler, | |
| 119 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 120 developer_protocol_handler, | |
| 121 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 122 chrome_protocol_handler, | |
| 123 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 124 chrome_devtools_protocol_handler) { | |
| 125 ShellBrowserContext* shell_browser_context = | 104 ShellBrowserContext* shell_browser_context = |
| 126 ShellBrowserContextForBrowserContext(content_browser_context); | 105 ShellBrowserContextForBrowserContext(content_browser_context); |
| 127 return shell_browser_context->CreateRequestContextForStoragePartition( | 106 return shell_browser_context->CreateRequestContextForStoragePartition( |
| 128 partition_path, in_memory, blob_protocol_handler.Pass(), | 107 partition_path, in_memory, protocol_handlers); |
| 129 file_system_protocol_handler.Pass(), | |
| 130 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), | |
| 131 chrome_devtools_protocol_handler.Pass()); | |
| 132 } | 108 } |
| 133 | 109 |
| 134 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( | 110 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
| 135 CommandLine* command_line, int child_process_id) { | 111 CommandLine* command_line, int child_process_id) { |
| 136 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 112 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 137 command_line->AppendSwitch(switches::kDumpRenderTree); | 113 command_line->AppendSwitch(switches::kDumpRenderTree); |
| 138 } | 114 } |
| 139 | 115 |
| 140 void ShellContentBrowserClient::OverrideWebkitPrefs( | 116 void ShellContentBrowserClient::OverrideWebkitPrefs( |
| 141 RenderViewHost* render_view_host, | 117 RenderViewHost* render_view_host, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 ShellBrowserContext* | 182 ShellBrowserContext* |
| 207 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 183 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
| 208 BrowserContext* content_browser_context) { | 184 BrowserContext* content_browser_context) { |
| 209 if (content_browser_context == browser_context()) | 185 if (content_browser_context == browser_context()) |
| 210 return browser_context(); | 186 return browser_context(); |
| 211 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 187 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
| 212 return off_the_record_browser_context(); | 188 return off_the_record_browser_context(); |
| 213 } | 189 } |
| 214 | 190 |
| 215 } // namespace content | 191 } // namespace content |
| OLD | NEW |