Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2962603002: MD Settings: fix help/ redirection to only happen on chrome://help (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 return false; 638 return false;
639 639
640 *url = GURL(ntp_location); 640 *url = GURL(ntp_location);
641 return true; 641 return true;
642 } 642 }
643 643
644 // Handles rewriting Web UI URLs. 644 // Handles rewriting Web UI URLs.
645 bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { 645 bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) {
646 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { 646 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) {
647 // Rewrite chrome://help and chrome://chrome to chrome://settings/help. 647 // Rewrite chrome://help and chrome://chrome to chrome://settings/help.
648 if (url->host() == chrome::kChromeUIHelpHost || 648 if (url->SchemeIs(content::kChromeUIScheme) &&
649 (url->host() == chrome::kChromeUIUberHost && 649 (url->host() == chrome::kChromeUIHelpHost ||
650 (url->path().empty() || url->path() == "/"))) { 650 (url->host() == chrome::kChromeUIUberHost &&
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.
654 } 655 }
655 } 656 }
656 657
657 // Do not handle special URLs such as "about:foo" 658 // Do not handle special URLs such as "about:foo"
658 if (!url->host().empty()) { 659 if (!url->host().empty()) {
659 const GURL chrome_url = AddUberHost(*url); 660 const GURL chrome_url = AddUberHost(*url);
660 661
(...skipping 24 matching lines...) Expand all
685 686
686 return true; 687 return true;
687 } 688 }
688 689
689 // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to 690 // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to
690 // "chrome://foo/". 691 // "chrome://foo/".
691 bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) { 692 bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) {
692 // No need to actually reverse-rewrite the URL, but return true to update the 693 // No need to actually reverse-rewrite the URL, but return true to update the
693 // displayed URL when rewriting chrome://help to chrome://settings/help. 694 // displayed URL when rewriting chrome://help to chrome://settings/help.
694 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings) && 695 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings) &&
696 url->SchemeIs(content::kChromeUIScheme) &&
695 url->host() == chrome::kChromeUISettingsHost) { 697 url->host() == chrome::kChromeUISettingsHost) {
696 return true; 698 return true;
697 } 699 }
698 700
699 if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme)) 701 if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme))
700 return false; 702 return false;
701 703
702 return RemoveUberHost(url); 704 return RemoveUberHost(url);
703 } 705 }
704 706
(...skipping 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after
3580 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3582 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3581 return variations::GetVariationParamValue( 3583 return variations::GetVariationParamValue(
3582 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3584 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3583 } 3585 }
3584 3586
3585 // static 3587 // static
3586 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( 3588 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting(
3587 const storage::QuotaSettings* settings) { 3589 const storage::QuotaSettings* settings) {
3588 g_default_quota_settings = settings; 3590 g_default_quota_settings = settings;
3589 } 3591 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698