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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 profile->GetPrefs()->GetString(prefs::kNewTabPageLocationOverride); | 651 profile->GetPrefs()->GetString(prefs::kNewTabPageLocationOverride); |
652 if (ntp_location.empty()) | 652 if (ntp_location.empty()) |
653 return false; | 653 return false; |
654 | 654 |
655 *url = GURL(ntp_location); | 655 *url = GURL(ntp_location); |
656 return true; | 656 return true; |
657 } | 657 } |
658 | 658 |
659 // Handles rewriting Web UI URLs. | 659 // Handles rewriting Web UI URLs. |
660 bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { | 660 bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { |
661 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { | 661 // Rewrite chrome://help and chrome://chrome to chrome://settings/help. |
662 // Rewrite chrome://help and chrome://chrome to chrome://settings/help. | 662 if (url->host() == chrome::kChromeUIHelpHost || |
663 if (url->host() == chrome::kChromeUIHelpHost || | 663 (url->host() == chrome::kChromeUIUberHost && |
664 (url->host() == chrome::kChromeUIUberHost && | 664 (url->path().empty() || url->path() == "/"))) { |
665 (url->path().empty() || url->path() == "/"))) { | 665 *url = ReplaceURLHostAndPath(*url, chrome::kChromeUISettingsHost, |
666 *url = ReplaceURLHostAndPath(*url, chrome::kChromeUISettingsHost, | 666 chrome::kChromeUIHelpHost); |
667 chrome::kChromeUIHelpHost); | 667 return true; // Return true to update the displayed URL. |
668 return true; // Return true to update the displayed URL. | |
669 } | |
670 } | 668 } |
671 | 669 |
672 // Do not handle special URLs such as "about:foo" | 670 // Do not handle special URLs such as "about:foo" |
673 if (!url->host().empty()) { | 671 if (!url->host().empty()) { |
674 const GURL chrome_url = AddUberHost(*url); | 672 const GURL chrome_url = AddUberHost(*url); |
675 | 673 |
676 // Handle valid "chrome://chrome/foo" URLs so the reverse handler will | 674 // Handle valid "chrome://chrome/foo" URLs so the reverse handler will |
677 // be called. | 675 // be called. |
678 if (ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL( | 676 if (ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL( |
679 browser_context, chrome_url)) | 677 browser_context, chrome_url)) |
(...skipping 19 matching lines...) Expand all Loading... |
699 #endif | 697 #endif |
700 | 698 |
701 return true; | 699 return true; |
702 } | 700 } |
703 | 701 |
704 // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to | 702 // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to |
705 // "chrome://foo/". | 703 // "chrome://foo/". |
706 bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) { | 704 bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) { |
707 // No need to actually reverse-rewrite the URL, but return true to update the | 705 // No need to actually reverse-rewrite the URL, but return true to update the |
708 // displayed URL when rewriting chrome://help to chrome://settings/help. | 706 // displayed URL when rewriting chrome://help to chrome://settings/help. |
709 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings) && | 707 if (url->host() == chrome::kChromeUISettingsHost) |
710 url->host() == chrome::kChromeUISettingsHost) { | |
711 return true; | 708 return true; |
712 } | |
713 | 709 |
714 if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme)) | 710 if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme)) |
715 return false; | 711 return false; |
716 | 712 |
717 return RemoveUberHost(url); | 713 return RemoveUberHost(url); |
718 } | 714 } |
719 | 715 |
720 bool CertMatchesFilter(const net::X509Certificate& cert, | 716 bool CertMatchesFilter(const net::X509Certificate& cert, |
721 const base::DictionaryValue& filter) { | 717 const base::DictionaryValue& filter) { |
722 // TODO(markusheintz): This is the minimal required filter implementation. | 718 // TODO(markusheintz): This is the minimal required filter implementation. |
(...skipping 2885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3608 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3604 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
3609 return variations::GetVariationParamValue( | 3605 return variations::GetVariationParamValue( |
3610 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3606 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
3611 } | 3607 } |
3612 | 3608 |
3613 // static | 3609 // static |
3614 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3610 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
3615 const storage::QuotaSettings* settings) { | 3611 const storage::QuotaSettings* settings) { |
3616 g_default_quota_settings = settings; | 3612 g_default_quota_settings = settings; |
3617 } | 3613 } |
OLD | NEW |