| 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |