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_path.h" | 8 #include "base/file_path.h" |
9 #include "content/public/browser/resource_dispatcher_host.h" | 9 #include "content/public/browser/resource_dispatcher_host.h" |
10 #include "content/shell/geolocation/shell_access_token_store.h" | 10 #include "content/shell/geolocation/shell_access_token_store.h" |
11 #include "content/shell/shell.h" | 11 #include "content/shell/shell.h" |
12 #include "content/shell/shell_browser_context.h" | 12 #include "content/shell/shell_browser_context.h" |
13 #include "content/shell/shell_browser_main_parts.h" | 13 #include "content/shell/shell_browser_main_parts.h" |
14 #include "content/shell/shell_devtools_delegate.h" | 14 #include "content/shell/shell_devtools_delegate.h" |
15 #include "content/shell/shell_resource_dispatcher_host_delegate.h" | 15 #include "content/shell/shell_resource_dispatcher_host_delegate.h" |
16 #include "content/shell/shell_switches.h" | 16 #include "content/shell/shell_switches.h" |
17 #include "content/shell/shell_web_contents_view_delegate_creator.h" | 17 #include "content/shell/shell_web_contents_view_delegate_creator.h" |
18 #include "content/shell/webkit_test_runner_host.h" | 18 #include "content/shell/webkit_test_runner_host.h" |
19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 20 #include "webkit/glue/webpreferences.h" |
20 | 21 |
21 #if defined(OS_ANDROID) | 22 #if defined(OS_ANDROID) |
22 #include "base/android/path_utils.h" | 23 #include "base/android/path_utils.h" |
23 #include "base/path_service.h" | 24 #include "base/path_service.h" |
24 #include "base/platform_file.h" | 25 #include "base/platform_file.h" |
25 #include "content/shell/android/shell_descriptors.h" | 26 #include "content/shell/android/shell_descriptors.h" |
26 #endif | 27 #endif |
27 | 28 |
28 namespace content { | 29 namespace content { |
29 | 30 |
(...skipping 16 matching lines...) Expand all Loading... |
46 return; | 47 return; |
47 new WebKitTestRunnerHost(render_view_host); | 48 new WebKitTestRunnerHost(render_view_host); |
48 } | 49 } |
49 | 50 |
50 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( | 51 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
51 CommandLine* command_line, int child_process_id) { | 52 CommandLine* command_line, int child_process_id) { |
52 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 53 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
53 command_line->AppendSwitch(switches::kDumpRenderTree); | 54 command_line->AppendSwitch(switches::kDumpRenderTree); |
54 } | 55 } |
55 | 56 |
| 57 void ShellContentBrowserClient::OverrideWebkitPrefs( |
| 58 RenderViewHost* render_view_host, |
| 59 const GURL& url, |
| 60 webkit_glue::WebPreferences* prefs) { |
| 61 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 62 return; |
| 63 prefs->dom_paste_enabled = true; |
| 64 prefs->javascript_can_access_clipboard = true; |
| 65 prefs->allow_universal_access_from_file_urls = true; |
| 66 } |
| 67 |
56 void ShellContentBrowserClient::ResourceDispatcherHostCreated() { | 68 void ShellContentBrowserClient::ResourceDispatcherHostCreated() { |
57 resource_dispatcher_host_delegate_.reset( | 69 resource_dispatcher_host_delegate_.reset( |
58 new ShellResourceDispatcherHostDelegate()); | 70 new ShellResourceDispatcherHostDelegate()); |
59 ResourceDispatcherHost::Get()->SetDelegate( | 71 ResourceDispatcherHost::Get()->SetDelegate( |
60 resource_dispatcher_host_delegate_.get()); | 72 resource_dispatcher_host_delegate_.get()); |
61 } | 73 } |
62 | 74 |
63 std::string ShellContentBrowserClient::GetDefaultDownloadName() { | 75 std::string ShellContentBrowserClient::GetDefaultDownloadName() { |
64 return "download"; | 76 return "download"; |
65 } | 77 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 ShellBrowserContext* | 115 ShellBrowserContext* |
104 ShellContentBrowserClient::off_the_record_browser_context() { | 116 ShellContentBrowserClient::off_the_record_browser_context() { |
105 return shell_browser_main_parts_->off_the_record_browser_context(); | 117 return shell_browser_main_parts_->off_the_record_browser_context(); |
106 } | 118 } |
107 | 119 |
108 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { | 120 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { |
109 return new ShellAccessTokenStore(browser_context()->GetRequestContext()); | 121 return new ShellAccessTokenStore(browser_context()->GetRequestContext()); |
110 } | 122 } |
111 | 123 |
112 } // namespace content | 124 } // namespace content |
OLD | NEW |