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 "chrome/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2143 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); | 2143 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); |
2144 | 2144 |
2145 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); | 2145 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); |
2146 | 2146 |
2147 web_prefs->javascript_can_open_windows_automatically = | 2147 web_prefs->javascript_can_open_windows_automatically = |
2148 prefs->GetBoolean(prefs::kWebKitJavascriptCanOpenWindowsAutomatically); | 2148 prefs->GetBoolean(prefs::kWebKitJavascriptCanOpenWindowsAutomatically); |
2149 web_prefs->dom_paste_enabled = | 2149 web_prefs->dom_paste_enabled = |
2150 prefs->GetBoolean(prefs::kWebKitDomPasteEnabled); | 2150 prefs->GetBoolean(prefs::kWebKitDomPasteEnabled); |
2151 web_prefs->shrinks_standalone_images_to_fit = | 2151 web_prefs->shrinks_standalone_images_to_fit = |
2152 prefs->GetBoolean(prefs::kWebKitShrinksStandaloneImagesToFit); | 2152 prefs->GetBoolean(prefs::kWebKitShrinksStandaloneImagesToFit); |
2153 const base::DictionaryValue* inspector_settings = | |
2154 prefs->GetDictionary(prefs::kWebKitInspectorSettings); | |
2155 if (inspector_settings) { | |
2156 for (base::DictionaryValue::Iterator iter(*inspector_settings); | |
2157 !iter.IsAtEnd(); | |
2158 iter.Advance()) { | |
2159 std::string value; | |
2160 if (iter.value().GetAsString(&value)) { | |
2161 web_prefs->inspector_settings.push_back( | |
2162 std::make_pair(iter.key(), value)); | |
2163 } | |
2164 } | |
2165 } | |
2166 web_prefs->tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks); | 2153 web_prefs->tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks); |
2167 | 2154 |
2168 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled)) | 2155 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled)) |
2169 web_prefs->javascript_enabled = false; | 2156 web_prefs->javascript_enabled = false; |
2170 if (!prefs->GetBoolean(prefs::kWebKitWebSecurityEnabled)) | 2157 if (!prefs->GetBoolean(prefs::kWebKitWebSecurityEnabled)) |
2171 web_prefs->web_security_enabled = false; | 2158 web_prefs->web_security_enabled = false; |
2172 if (!prefs->GetBoolean(prefs::kWebKitPluginsEnabled)) | 2159 if (!prefs->GetBoolean(prefs::kWebKitPluginsEnabled)) |
2173 web_prefs->plugins_enabled = false; | 2160 web_prefs->plugins_enabled = false; |
2174 if (!prefs->GetBoolean(prefs::kWebKitJavaEnabled)) | 2161 if (!prefs->GetBoolean(prefs::kWebKitJavaEnabled)) |
2175 web_prefs->java_enabled = false; | 2162 web_prefs->java_enabled = false; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2215 if (web_prefs->default_encoding.empty()) { | 2202 if (web_prefs->default_encoding.empty()) { |
2216 prefs->ClearPref(prefs::kDefaultCharset); | 2203 prefs->ClearPref(prefs::kDefaultCharset); |
2217 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); | 2204 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); |
2218 } | 2205 } |
2219 DCHECK(!web_prefs->default_encoding.empty()); | 2206 DCHECK(!web_prefs->default_encoding.empty()); |
2220 | 2207 |
2221 for (size_t i = 0; i < extra_parts_.size(); ++i) | 2208 for (size_t i = 0; i < extra_parts_.size(); ++i) |
2222 extra_parts_[i]->OverrideWebkitPrefs(rvh, url, web_prefs); | 2209 extra_parts_[i]->OverrideWebkitPrefs(rvh, url, web_prefs); |
2223 } | 2210 } |
2224 | 2211 |
2225 void ChromeContentBrowserClient::UpdateInspectorSetting( | |
2226 RenderViewHost* rvh, const std::string& key, const std::string& value) { | |
2227 content::BrowserContext* browser_context = | |
2228 rvh->GetProcess()->GetBrowserContext(); | |
2229 DictionaryPrefUpdate update( | |
2230 Profile::FromBrowserContext(browser_context)->GetPrefs(), | |
2231 prefs::kWebKitInspectorSettings); | |
2232 base::DictionaryValue* inspector_settings = update.Get(); | |
2233 inspector_settings->SetWithoutPathExpansion(key, | |
2234 new base::StringValue(value)); | |
2235 } | |
2236 | |
2237 void ChromeContentBrowserClient::BrowserURLHandlerCreated( | 2212 void ChromeContentBrowserClient::BrowserURLHandlerCreated( |
2238 BrowserURLHandler* handler) { | 2213 BrowserURLHandler* handler) { |
2239 for (size_t i = 0; i < extra_parts_.size(); ++i) | 2214 for (size_t i = 0; i < extra_parts_.size(); ++i) |
2240 extra_parts_[i]->BrowserURLHandlerCreated(handler); | 2215 extra_parts_[i]->BrowserURLHandlerCreated(handler); |
2241 | 2216 |
2242 // about: handler. Must come before chrome: handler, since it will | 2217 // about: handler. Must come before chrome: handler, since it will |
2243 // rewrite about: urls to chrome: URLs and then expect chrome: to | 2218 // rewrite about: urls to chrome: URLs and then expect chrome: to |
2244 // actually handle them. | 2219 // actually handle them. |
2245 handler->AddHandlerPair(&WillHandleBrowserAboutURL, | 2220 handler->AddHandlerPair(&WillHandleBrowserAboutURL, |
2246 BrowserURLHandler::null_handler()); | 2221 BrowserURLHandler::null_handler()); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 switches::kDisableWebRtcEncryption, | 2594 switches::kDisableWebRtcEncryption, |
2620 }; | 2595 }; |
2621 to_command_line->CopySwitchesFrom(from_command_line, | 2596 to_command_line->CopySwitchesFrom(from_command_line, |
2622 kWebRtcDevSwitchNames, | 2597 kWebRtcDevSwitchNames, |
2623 arraysize(kWebRtcDevSwitchNames)); | 2598 arraysize(kWebRtcDevSwitchNames)); |
2624 } | 2599 } |
2625 } | 2600 } |
2626 #endif // defined(ENABLE_WEBRTC) | 2601 #endif // defined(ENABLE_WEBRTC) |
2627 | 2602 |
2628 } // namespace chrome | 2603 } // namespace chrome |
OLD | NEW |