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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return shell_browser_main_parts_; | 72 return shell_browser_main_parts_; |
73 } | 73 } |
74 | 74 |
75 void ShellContentBrowserClient::RenderProcessHostCreated( | 75 void ShellContentBrowserClient::RenderProcessHostCreated( |
76 RenderProcessHost* host) { | 76 RenderProcessHost* host) { |
77 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 77 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
78 return; | 78 return; |
79 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_)); | 79 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_)); |
80 } | 80 } |
81 | 81 |
| 82 net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( |
| 83 content::BrowserContext* content_browser_context, |
| 84 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 85 blob_protocol_handler, |
| 86 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 87 file_system_protocol_handler, |
| 88 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 89 developer_protocol_handler) { |
| 90 ShellBrowserContext* shell_browser_context = |
| 91 ShellBrowserContextForBrowserContext(content_browser_context); |
| 92 return shell_browser_context->CreateRequestContext( |
| 93 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), |
| 94 developer_protocol_handler.Pass()); |
| 95 } |
| 96 |
| 97 net::URLRequestContextGetter* |
| 98 ShellContentBrowserClient::CreateRequestContextForStoragePartition( |
| 99 content::BrowserContext* content_browser_context, |
| 100 const FilePath& partition_path, |
| 101 bool in_memory, |
| 102 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 103 blob_protocol_handler, |
| 104 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 105 file_system_protocol_handler, |
| 106 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 107 developer_protocol_handler) { |
| 108 ShellBrowserContext* shell_browser_context = |
| 109 ShellBrowserContextForBrowserContext(content_browser_context); |
| 110 return shell_browser_context->CreateRequestContextForStoragePartition( |
| 111 partition_path, |
| 112 in_memory, |
| 113 blob_protocol_handler.Pass(), |
| 114 file_system_protocol_handler.Pass(), |
| 115 developer_protocol_handler.Pass()); |
| 116 } |
| 117 |
82 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( | 118 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
83 CommandLine* command_line, int child_process_id) { | 119 CommandLine* command_line, int child_process_id) { |
84 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 120 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
85 command_line->AppendSwitch(switches::kDumpRenderTree); | 121 command_line->AppendSwitch(switches::kDumpRenderTree); |
86 } | 122 } |
87 | 123 |
88 void ShellContentBrowserClient::OverrideWebkitPrefs( | 124 void ShellContentBrowserClient::OverrideWebkitPrefs( |
89 RenderViewHost* render_view_host, | 125 RenderViewHost* render_view_host, |
90 const GURL& url, | 126 const GURL& url, |
91 webkit_glue::WebPreferences* prefs) { | 127 webkit_glue::WebPreferences* prefs) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 193 |
158 ShellBrowserContext* | 194 ShellBrowserContext* |
159 ShellContentBrowserClient::off_the_record_browser_context() { | 195 ShellContentBrowserClient::off_the_record_browser_context() { |
160 return shell_browser_main_parts_->off_the_record_browser_context(); | 196 return shell_browser_main_parts_->off_the_record_browser_context(); |
161 } | 197 } |
162 | 198 |
163 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { | 199 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { |
164 return new ShellAccessTokenStore(browser_context()->GetRequestContext()); | 200 return new ShellAccessTokenStore(browser_context()->GetRequestContext()); |
165 } | 201 } |
166 | 202 |
| 203 ShellBrowserContext* |
| 204 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
| 205 BrowserContext* content_browser_context) { |
| 206 if (content_browser_context == browser_context()) |
| 207 return browser_context(); |
| 208 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
| 209 return off_the_record_browser_context(); |
| 210 } |
| 211 |
167 } // namespace content | 212 } // namespace content |
OLD | NEW |