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

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

Issue 2664063002: MD Settings: Redirect chrome://help and chrome://chrome to About page. (Closed)
Patch Set: remove obsolete test. Created 3 years, 10 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 | « chrome/browser/browser_about_handler_unittest.cc ('k') | 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 profile->GetPrefs()->GetString(prefs::kNewTabPageLocationOverride); 525 profile->GetPrefs()->GetString(prefs::kNewTabPageLocationOverride);
526 if (ntp_location.empty()) 526 if (ntp_location.empty())
527 return false; 527 return false;
528 528
529 *url = GURL(ntp_location); 529 *url = GURL(ntp_location);
530 return true; 530 return true;
531 } 531 }
532 532
533 // Handles rewriting Web UI URLs. 533 // Handles rewriting Web UI URLs.
534 bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { 534 bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) {
535 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) {
536 // Rewrite chrome://help and chrome://chrome to chrome://settings/help.
537 if (url->host() == chrome::kChromeUIHelpHost ||
538 (url->host() == chrome::kChromeUIUberHost &&
539 (url->path().empty() || url->path() == "/"))) {
540 *url = ReplaceURLHostAndPath(*url, chrome::kChromeUISettingsHost,
541 chrome::kChromeUIHelpHost);
542 return true; // Return true to update the displayed URL.
543 }
544 }
545
535 // Do not handle special URLs such as "about:foo" 546 // Do not handle special URLs such as "about:foo"
536 if (!url->host().empty()) { 547 if (!url->host().empty()) {
537 const GURL chrome_url = AddUberHost(*url); 548 const GURL chrome_url = AddUberHost(*url);
538 549
539 // Handle valid "chrome://chrome/foo" URLs so the reverse handler will 550 // Handle valid "chrome://chrome/foo" URLs so the reverse handler will
540 // be called. 551 // be called.
541 if (ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL( 552 if (ChromeWebUIControllerFactory::GetInstance()->UseWebUIForURL(
542 browser_context, chrome_url)) 553 browser_context, chrome_url))
543 return true; 554 return true;
544 } 555 }
(...skipping 15 matching lines...) Expand all
560 } 571 }
561 } 572 }
562 #endif 573 #endif
563 574
564 return true; 575 return true;
565 } 576 }
566 577
567 // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to 578 // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to
568 // "chrome://foo/". 579 // "chrome://foo/".
569 bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) { 580 bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) {
581 // No need to actually reverse-rewrite the URL, but return true to update the
582 // displayed URL when rewriting chrome://help to chrome://settings/help.
583 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings) &&
584 url->host() == chrome::kChromeUISettingsHost) {
585 return true;
586 }
587
570 if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme)) 588 if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme))
571 return false; 589 return false;
572 590
573 return RemoveUberHost(url); 591 return RemoveUberHost(url);
574 } 592 }
575 593
576 bool CertMatchesFilter(const net::X509Certificate& cert, 594 bool CertMatchesFilter(const net::X509Certificate& cert,
577 const base::DictionaryValue& filter) { 595 const base::DictionaryValue& filter) {
578 // TODO(markusheintz): This is the minimal required filter implementation. 596 // TODO(markusheintz): This is the minimal required filter implementation.
579 // Implement a better matcher. 597 // Implement a better matcher.
(...skipping 2820 matching lines...) Expand 10 before | Expand all | Expand 10 after
3400 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { 3418 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() {
3401 return variations::GetVariationParamValue( 3419 return variations::GetVariationParamValue(
3402 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; 3420 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true";
3403 } 3421 }
3404 3422
3405 bool ChromeContentBrowserClient:: 3423 bool ChromeContentBrowserClient::
3406 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3424 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3407 return variations::GetVariationParamValue( 3425 return variations::GetVariationParamValue(
3408 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3426 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3409 } 3427 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_about_handler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698