| 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" |
| 11 #include "content/public/browser/resource_dispatcher_host.h" | 11 #include "content/public/browser/resource_dispatcher_host.h" |
| 12 #include "content/public/common/url_constants.h" |
| 12 #include "content/shell/geolocation/shell_access_token_store.h" | 13 #include "content/shell/geolocation/shell_access_token_store.h" |
| 13 #include "content/shell/shell.h" | 14 #include "content/shell/shell.h" |
| 14 #include "content/shell/shell_browser_context.h" | 15 #include "content/shell/shell_browser_context.h" |
| 15 #include "content/shell/shell_browser_main_parts.h" | 16 #include "content/shell/shell_browser_main_parts.h" |
| 16 #include "content/shell/shell_devtools_delegate.h" | 17 #include "content/shell/shell_devtools_delegate.h" |
| 17 #include "content/shell/shell_messages.h" | 18 #include "content/shell/shell_messages.h" |
| 18 #include "content/shell/shell_resource_dispatcher_host_delegate.h" | 19 #include "content/shell/shell_resource_dispatcher_host_delegate.h" |
| 19 #include "content/shell/shell_switches.h" | 20 #include "content/shell/shell_switches.h" |
| 20 #include "content/shell/shell_web_contents_view_delegate_creator.h" | 21 #include "content/shell/shell_web_contents_view_delegate_creator.h" |
| 21 #include "content/shell/webkit_test_controller.h" | 22 #include "content/shell/webkit_test_controller.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 return shell_browser_main_parts_; | 73 return shell_browser_main_parts_; |
| 73 } | 74 } |
| 74 | 75 |
| 75 void ShellContentBrowserClient::RenderProcessHostCreated( | 76 void ShellContentBrowserClient::RenderProcessHostCreated( |
| 76 RenderProcessHost* host) { | 77 RenderProcessHost* host) { |
| 77 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 78 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 78 return; | 79 return; |
| 79 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_)); | 80 host->Send(new ShellViewMsg_SetWebKitSourceDir(webkit_source_dir_)); |
| 80 } | 81 } |
| 81 | 82 |
| 83 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { |
| 84 if (!url.is_valid()) |
| 85 return false; |
| 86 // Keep in sync with ProtocolHandlers added by |
| 87 // ShellURLRequestContextGetter::GetURLRequestContext(). |
| 88 return url.scheme() == chrome::kDataScheme || |
| 89 url.scheme() == chrome::kFileScheme; |
| 90 } |
| 91 |
| 82 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( | 92 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
| 83 CommandLine* command_line, int child_process_id) { | 93 CommandLine* command_line, int child_process_id) { |
| 84 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 94 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 85 command_line->AppendSwitch(switches::kDumpRenderTree); | 95 command_line->AppendSwitch(switches::kDumpRenderTree); |
| 86 } | 96 } |
| 87 | 97 |
| 88 void ShellContentBrowserClient::OverrideWebkitPrefs( | 98 void ShellContentBrowserClient::OverrideWebkitPrefs( |
| 89 RenderViewHost* render_view_host, | 99 RenderViewHost* render_view_host, |
| 90 const GURL& url, | 100 const GURL& url, |
| 91 webkit_glue::WebPreferences* prefs) { | 101 webkit_glue::WebPreferences* prefs) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 ShellBrowserContext* | 168 ShellBrowserContext* |
| 159 ShellContentBrowserClient::off_the_record_browser_context() { | 169 ShellContentBrowserClient::off_the_record_browser_context() { |
| 160 return shell_browser_main_parts_->off_the_record_browser_context(); | 170 return shell_browser_main_parts_->off_the_record_browser_context(); |
| 161 } | 171 } |
| 162 | 172 |
| 163 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { | 173 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { |
| 164 return new ShellAccessTokenStore(browser_context()->GetRequestContext()); | 174 return new ShellAccessTokenStore(browser_context()->GetRequestContext()); |
| 165 } | 175 } |
| 166 | 176 |
| 167 } // namespace content | 177 } // namespace content |
| OLD | NEW |