| 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 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 NOTREACHED(); | 1820 NOTREACHED(); |
| 1821 return; | 1821 return; |
| 1822 } | 1822 } |
| 1823 | 1823 |
| 1824 GURL requesting_url("https://" + cert_request_info->host_and_port.ToString()); | 1824 GURL requesting_url("https://" + cert_request_info->host_and_port.ToString()); |
| 1825 DCHECK(requesting_url.is_valid()) | 1825 DCHECK(requesting_url.is_valid()) |
| 1826 << "Invalid URL string: https://" | 1826 << "Invalid URL string: https://" |
| 1827 << cert_request_info->host_and_port.ToString(); | 1827 << cert_request_info->host_and_port.ToString(); |
| 1828 | 1828 |
| 1829 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 1829 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
| 1830 scoped_ptr<Value> filter( | 1830 scoped_ptr<base::Value> filter( |
| 1831 profile->GetHostContentSettingsMap()->GetWebsiteSetting( | 1831 profile->GetHostContentSettingsMap()->GetWebsiteSetting( |
| 1832 requesting_url, | 1832 requesting_url, |
| 1833 requesting_url, | 1833 requesting_url, |
| 1834 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | 1834 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
| 1835 std::string(), NULL)); | 1835 std::string(), NULL)); |
| 1836 | 1836 |
| 1837 if (filter.get()) { | 1837 if (filter.get()) { |
| 1838 // Try to automatically select a client certificate. | 1838 // Try to automatically select a client certificate. |
| 1839 if (filter->IsType(Value::TYPE_DICTIONARY)) { | 1839 if (filter->IsType(base::Value::TYPE_DICTIONARY)) { |
| 1840 DictionaryValue* filter_dict = | 1840 base::DictionaryValue* filter_dict = |
| 1841 static_cast<DictionaryValue*>(filter.get()); | 1841 static_cast<base::DictionaryValue*>(filter.get()); |
| 1842 | 1842 |
| 1843 const std::vector<scoped_refptr<net::X509Certificate> >& | 1843 const std::vector<scoped_refptr<net::X509Certificate> >& |
| 1844 all_client_certs = cert_request_info->client_certs; | 1844 all_client_certs = cert_request_info->client_certs; |
| 1845 for (size_t i = 0; i < all_client_certs.size(); ++i) { | 1845 for (size_t i = 0; i < all_client_certs.size(); ++i) { |
| 1846 if (CertMatchesFilter(*all_client_certs[i].get(), *filter_dict)) { | 1846 if (CertMatchesFilter(*all_client_certs[i].get(), *filter_dict)) { |
| 1847 // Use the first certificate that is matched by the filter. | 1847 // Use the first certificate that is matched by the filter. |
| 1848 callback.Run(all_client_certs[i].get()); | 1848 callback.Run(all_client_certs[i].get()); |
| 1849 return; | 1849 return; |
| 1850 } | 1850 } |
| 1851 } | 1851 } |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2204 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); | 2204 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); |
| 2205 | 2205 |
| 2206 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); | 2206 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); |
| 2207 | 2207 |
| 2208 web_prefs->javascript_can_open_windows_automatically = | 2208 web_prefs->javascript_can_open_windows_automatically = |
| 2209 prefs->GetBoolean(prefs::kWebKitJavascriptCanOpenWindowsAutomatically); | 2209 prefs->GetBoolean(prefs::kWebKitJavascriptCanOpenWindowsAutomatically); |
| 2210 web_prefs->dom_paste_enabled = | 2210 web_prefs->dom_paste_enabled = |
| 2211 prefs->GetBoolean(prefs::kWebKitDomPasteEnabled); | 2211 prefs->GetBoolean(prefs::kWebKitDomPasteEnabled); |
| 2212 web_prefs->shrinks_standalone_images_to_fit = | 2212 web_prefs->shrinks_standalone_images_to_fit = |
| 2213 prefs->GetBoolean(prefs::kWebKitShrinksStandaloneImagesToFit); | 2213 prefs->GetBoolean(prefs::kWebKitShrinksStandaloneImagesToFit); |
| 2214 const DictionaryValue* inspector_settings = | 2214 const base::DictionaryValue* inspector_settings = |
| 2215 prefs->GetDictionary(prefs::kWebKitInspectorSettings); | 2215 prefs->GetDictionary(prefs::kWebKitInspectorSettings); |
| 2216 if (inspector_settings) { | 2216 if (inspector_settings) { |
| 2217 for (DictionaryValue::Iterator iter(*inspector_settings); !iter.IsAtEnd(); | 2217 for (base::DictionaryValue::Iterator iter(*inspector_settings); |
| 2218 !iter.IsAtEnd(); |
| 2218 iter.Advance()) { | 2219 iter.Advance()) { |
| 2219 std::string value; | 2220 std::string value; |
| 2220 if (iter.value().GetAsString(&value)) { | 2221 if (iter.value().GetAsString(&value)) { |
| 2221 web_prefs->inspector_settings.push_back( | 2222 web_prefs->inspector_settings.push_back( |
| 2222 std::make_pair(iter.key(), value)); | 2223 std::make_pair(iter.key(), value)); |
| 2223 } | 2224 } |
| 2224 } | 2225 } |
| 2225 } | 2226 } |
| 2226 web_prefs->tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks); | 2227 web_prefs->tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks); |
| 2227 | 2228 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2318 #endif | 2319 #endif |
| 2319 } | 2320 } |
| 2320 | 2321 |
| 2321 void ChromeContentBrowserClient::UpdateInspectorSetting( | 2322 void ChromeContentBrowserClient::UpdateInspectorSetting( |
| 2322 RenderViewHost* rvh, const std::string& key, const std::string& value) { | 2323 RenderViewHost* rvh, const std::string& key, const std::string& value) { |
| 2323 content::BrowserContext* browser_context = | 2324 content::BrowserContext* browser_context = |
| 2324 rvh->GetProcess()->GetBrowserContext(); | 2325 rvh->GetProcess()->GetBrowserContext(); |
| 2325 DictionaryPrefUpdate update( | 2326 DictionaryPrefUpdate update( |
| 2326 Profile::FromBrowserContext(browser_context)->GetPrefs(), | 2327 Profile::FromBrowserContext(browser_context)->GetPrefs(), |
| 2327 prefs::kWebKitInspectorSettings); | 2328 prefs::kWebKitInspectorSettings); |
| 2328 DictionaryValue* inspector_settings = update.Get(); | 2329 base::DictionaryValue* inspector_settings = update.Get(); |
| 2329 inspector_settings->SetWithoutPathExpansion(key, | 2330 inspector_settings->SetWithoutPathExpansion( |
| 2330 Value::CreateStringValue(value)); | 2331 key, base::Value::CreateStringValue(value)); |
| 2331 } | 2332 } |
| 2332 | 2333 |
| 2333 void ChromeContentBrowserClient::BrowserURLHandlerCreated( | 2334 void ChromeContentBrowserClient::BrowserURLHandlerCreated( |
| 2334 BrowserURLHandler* handler) { | 2335 BrowserURLHandler* handler) { |
| 2335 // Add the default URL handlers. | 2336 // Add the default URL handlers. |
| 2336 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, | 2337 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, |
| 2337 BrowserURLHandler::null_handler()); | 2338 BrowserURLHandler::null_handler()); |
| 2338 handler->AddHandlerPair(BrowserURLHandler::null_handler(), | 2339 handler->AddHandlerPair(BrowserURLHandler::null_handler(), |
| 2339 &ExtensionWebUI::HandleChromeURLOverrideReverse); | 2340 &ExtensionWebUI::HandleChromeURLOverrideReverse); |
| 2340 | 2341 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on | 2651 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on |
| 2651 // Chromium builds as well. | 2652 // Chromium builds as well. |
| 2652 return channel <= chrome::VersionInfo::CHANNEL_DEV; | 2653 return channel <= chrome::VersionInfo::CHANNEL_DEV; |
| 2653 #else | 2654 #else |
| 2654 return false; | 2655 return false; |
| 2655 #endif | 2656 #endif |
| 2656 } | 2657 } |
| 2657 | 2658 |
| 2658 | 2659 |
| 2659 } // namespace chrome | 2660 } // namespace chrome |
| OLD | NEW |