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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 profile->GetPrefs()->GetString(prefs::kNewTabPageLocationOverride); | 637 profile->GetPrefs()->GetString(prefs::kNewTabPageLocationOverride); |
638 if (ntp_location.empty()) | 638 if (ntp_location.empty()) |
639 return false; | 639 return false; |
640 | 640 |
641 *url = GURL(ntp_location); | 641 *url = GURL(ntp_location); |
642 return true; | 642 return true; |
643 } | 643 } |
644 | 644 |
645 // Handles rewriting Web UI URLs. | 645 // Handles rewriting Web UI URLs. |
646 bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { | 646 bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { |
647 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { | 647 // Rewrite chrome://help and chrome://chrome to chrome://settings/help. |
648 // Rewrite chrome://help and chrome://chrome to chrome://settings/help. | 648 if (url->host() == chrome::kChromeUIHelpHost || |
649 if (url->host() == chrome::kChromeUIHelpHost || | 649 (url->host() == chrome::kChromeUIUberHost && |
650 (url->host() == chrome::kChromeUIUberHost && | 650 (url->path().empty() || url->path() == "/"))) { |
651 (url->path().empty() || url->path() == "/"))) { | 651 *url = ReplaceURLHostAndPath(*url, chrome::kChromeUISettingsHost, |
652 *url = ReplaceURLHostAndPath(*url, chrome::kChromeUISettingsHost, | 652 chrome::kChromeUIHelpHost); |
653 chrome::kChromeUIHelpHost); | 653 return true; // Return true to update the displayed URL. |
654 return true; // Return true to update the displayed URL. | |
655 } | |
656 } | 654 } |
657 | 655 |
658 // Do not handle special URLs such as "about:foo" | 656 // Do not handle special URLs such as "about:foo" |
659 if (!url->host().empty()) { | 657 if (!url->host().empty()) { |
660 const GURL chrome_url = AddUberHost(*url); | 658 const GURL chrome_url = AddUberHost(*url); |
661 | 659 |
662 // Handle valid "chrome://chrome/foo" URLs so the reverse handler will | 660 // Handle valid "chrome://chrome/foo" URLs so the reverse handler will |
663 // be called. | 661 // be called. |
664 if (ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL( | 662 if (ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL( |
665 browser_context, chrome_url)) | 663 browser_context, chrome_url)) |
(...skipping 19 matching lines...) Expand all Loading... |
685 #endif | 683 #endif |
686 | 684 |
687 return true; | 685 return true; |
688 } | 686 } |
689 | 687 |
690 // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to | 688 // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to |
691 // "chrome://foo/". | 689 // "chrome://foo/". |
692 bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) { | 690 bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) { |
693 // No need to actually reverse-rewrite the URL, but return true to update the | 691 // No need to actually reverse-rewrite the URL, but return true to update the |
694 // displayed URL when rewriting chrome://help to chrome://settings/help. | 692 // displayed URL when rewriting chrome://help to chrome://settings/help. |
695 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings) && | 693 if (url->host() == chrome::kChromeUISettingsHost) |
696 url->host() == chrome::kChromeUISettingsHost) { | |
697 return true; | 694 return true; |
698 } | |
699 | 695 |
700 if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme)) | 696 if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme)) |
701 return false; | 697 return false; |
702 | 698 |
703 return RemoveUberHost(url); | 699 return RemoveUberHost(url); |
704 } | 700 } |
705 | 701 |
706 bool CertMatchesFilter(const net::X509Certificate& cert, | 702 bool CertMatchesFilter(const net::X509Certificate& cert, |
707 const base::DictionaryValue& filter) { | 703 const base::DictionaryValue& filter) { |
708 // TODO(markusheintz): This is the minimal required filter implementation. | 704 // TODO(markusheintz): This is the minimal required filter implementation. |
(...skipping 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3586 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3582 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
3587 return variations::GetVariationParamValue( | 3583 return variations::GetVariationParamValue( |
3588 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3584 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
3589 } | 3585 } |
3590 | 3586 |
3591 // static | 3587 // static |
3592 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3588 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
3593 const storage::QuotaSettings* settings) { | 3589 const storage::QuotaSettings* settings) { |
3594 g_default_quota_settings = settings; | 3590 g_default_quota_settings = settings; |
3595 } | 3591 } |
OLD | NEW |