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/ui/browser_navigator.h" | 5 #include "chrome/browser/ui/browser_navigator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 DCHECK_GT(stripped_spec.size(), strlen(content::kViewSourceScheme)); | 633 DCHECK_GT(stripped_spec.size(), strlen(content::kViewSourceScheme)); |
634 stripped_spec.erase(0, strlen(content::kViewSourceScheme) + 1); | 634 stripped_spec.erase(0, strlen(content::kViewSourceScheme) + 1); |
635 GURL stripped_url(stripped_spec); | 635 GURL stripped_url(stripped_spec); |
636 return stripped_url.is_valid() && | 636 return stripped_url.is_valid() && |
637 IsURLAllowedInIncognito(stripped_url, browser_context); | 637 IsURLAllowedInIncognito(stripped_url, browser_context); |
638 } | 638 } |
639 // Most URLs are allowed in incognito; the following are exceptions. | 639 // Most URLs are allowed in incognito; the following are exceptions. |
640 // chrome://extensions is on the list because it redirects to | 640 // chrome://extensions is on the list because it redirects to |
641 // chrome://settings. | 641 // chrome://settings. |
642 if (url.scheme() == content::kChromeUIScheme && | 642 if (url.scheme() == content::kChromeUIScheme && |
643 (url.host_piece() == chrome::kChromeUISettingsHost || | 643 (url.host_piece() == content::kChromeUISettingsHost || |
644 url.host_piece() == chrome::kChromeUIMdSettingsHost || | 644 url.host_piece() == chrome::kChromeUIMdSettingsHost || |
645 url.host_piece() == chrome::kChromeUISettingsFrameHost || | 645 url.host_piece() == chrome::kChromeUISettingsFrameHost || |
646 url.host_piece() == chrome::kChromeUIHelpHost || | 646 url.host_piece() == content::kChromeUIHelpHost || |
647 url.host_piece() == content::kChromeUIHistoryHost || | 647 url.host_piece() == content::kChromeUIHistoryHost || |
648 url.host_piece() == chrome::kChromeUIExtensionsHost || | 648 url.host_piece() == chrome::kChromeUIExtensionsHost || |
649 url.host_piece() == chrome::kChromeUIBookmarksHost || | 649 url.host_piece() == chrome::kChromeUIBookmarksHost || |
650 #if !defined(OS_CHROMEOS) | 650 #if !defined(OS_CHROMEOS) |
651 url.host_piece() == chrome::kChromeUIChromeSigninHost || | 651 url.host_piece() == chrome::kChromeUIChromeSigninHost || |
652 #endif | 652 #endif |
653 url.host_piece() == chrome::kChromeUIUberHost || | 653 url.host_piece() == chrome::kChromeUIUberHost || |
654 url.host_piece() == chrome::kChromeUIThumbnailHost || | 654 url.host_piece() == chrome::kChromeUIThumbnailHost || |
655 url.host_piece() == chrome::kChromeUIThumbnailHost2 || | 655 url.host_piece() == chrome::kChromeUIThumbnailHost2 || |
656 url.host_piece() == chrome::kChromeUIThumbnailListHost || | 656 url.host_piece() == chrome::kChromeUIThumbnailListHost || |
(...skipping 17 matching lines...) Expand all Loading... |
674 bool reverse_on_redirect = false; | 674 bool reverse_on_redirect = false; |
675 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 675 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
676 &rewritten_url, browser_context, &reverse_on_redirect); | 676 &rewritten_url, browser_context, &reverse_on_redirect); |
677 | 677 |
678 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 678 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
679 return !(rewritten_url.scheme_piece() == content::kChromeUIScheme && | 679 return !(rewritten_url.scheme_piece() == content::kChromeUIScheme && |
680 rewritten_url.host_piece() == chrome::kChromeUIUberHost); | 680 rewritten_url.host_piece() == chrome::kChromeUIUberHost); |
681 } | 681 } |
682 | 682 |
683 } // namespace chrome | 683 } // namespace chrome |
OLD | NEW |