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