| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 if (hyphen_dictionary_file_ != base::kInvalidPlatformFileValue) { | 110 if (hyphen_dictionary_file_ != base::kInvalidPlatformFileValue) { |
| 111 IPC::PlatformFileForTransit file = IPC::GetFileHandleForProcess( | 111 IPC::PlatformFileForTransit file = IPC::GetFileHandleForProcess( |
| 112 hyphen_dictionary_file_, host->GetHandle(), false); | 112 hyphen_dictionary_file_, host->GetHandle(), false); |
| 113 host->Send(new ShellViewMsg_LoadHyphenDictionary(file)); | 113 host->Send(new ShellViewMsg_LoadHyphenDictionary(file)); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( | 117 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( |
| 118 BrowserContext* content_browser_context, | 118 BrowserContext* content_browser_context, |
| 119 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 119 ProtocolHandlerMap* protocol_handlers) { |
| 120 blob_protocol_handler, | |
| 121 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 122 file_system_protocol_handler, | |
| 123 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 124 developer_protocol_handler, | |
| 125 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 126 chrome_protocol_handler, | |
| 127 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 128 chrome_devtools_protocol_handler) { | |
| 129 ShellBrowserContext* shell_browser_context = | 120 ShellBrowserContext* shell_browser_context = |
| 130 ShellBrowserContextForBrowserContext(content_browser_context); | 121 ShellBrowserContextForBrowserContext(content_browser_context); |
| 131 return shell_browser_context->CreateRequestContext( | 122 return shell_browser_context->CreateRequestContext(protocol_handlers); |
| 132 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), | |
| 133 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), | |
| 134 chrome_devtools_protocol_handler.Pass()); | |
| 135 } | 123 } |
| 136 | 124 |
| 137 net::URLRequestContextGetter* | 125 net::URLRequestContextGetter* |
| 138 ShellContentBrowserClient::CreateRequestContextForStoragePartition( | 126 ShellContentBrowserClient::CreateRequestContextForStoragePartition( |
| 139 BrowserContext* content_browser_context, | 127 BrowserContext* content_browser_context, |
| 140 const base::FilePath& partition_path, | 128 const base::FilePath& partition_path, |
| 141 bool in_memory, | 129 bool in_memory, |
| 142 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 130 ProtocolHandlerMap* protocol_handlers) { |
| 143 blob_protocol_handler, | |
| 144 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 145 file_system_protocol_handler, | |
| 146 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 147 developer_protocol_handler, | |
| 148 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 149 chrome_protocol_handler, | |
| 150 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 151 chrome_devtools_protocol_handler) { | |
| 152 ShellBrowserContext* shell_browser_context = | 131 ShellBrowserContext* shell_browser_context = |
| 153 ShellBrowserContextForBrowserContext(content_browser_context); | 132 ShellBrowserContextForBrowserContext(content_browser_context); |
| 154 return shell_browser_context->CreateRequestContextForStoragePartition( | 133 return shell_browser_context->CreateRequestContextForStoragePartition( |
| 155 partition_path, in_memory, blob_protocol_handler.Pass(), | 134 partition_path, in_memory, protocol_handlers); |
| 156 file_system_protocol_handler.Pass(), | |
| 157 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), | |
| 158 chrome_devtools_protocol_handler.Pass()); | |
| 159 } | 135 } |
| 160 | 136 |
| 161 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( | 137 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
| 162 CommandLine* command_line, int child_process_id) { | 138 CommandLine* command_line, int child_process_id) { |
| 163 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 139 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 164 command_line->AppendSwitch(switches::kDumpRenderTree); | 140 command_line->AppendSwitch(switches::kDumpRenderTree); |
| 165 } | 141 } |
| 166 | 142 |
| 167 void ShellContentBrowserClient::OverrideWebkitPrefs( | 143 void ShellContentBrowserClient::OverrideWebkitPrefs( |
| 168 RenderViewHost* render_view_host, | 144 RenderViewHost* render_view_host, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 ShellBrowserContext* | 209 ShellBrowserContext* |
| 234 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 210 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
| 235 BrowserContext* content_browser_context) { | 211 BrowserContext* content_browser_context) { |
| 236 if (content_browser_context == browser_context()) | 212 if (content_browser_context == browser_context()) |
| 237 return browser_context(); | 213 return browser_context(); |
| 238 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 214 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
| 239 return off_the_record_browser_context(); | 215 return off_the_record_browser_context(); |
| 240 } | 216 } |
| 241 | 217 |
| 242 } // namespace content | 218 } // namespace content |
| OLD | NEW |