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

Unified Diff: chrome/browser/ui/chrome_pages.cc

Issue 2034573002: [Cleanup] Factor out common code. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wherein we relearn that "commit -a" doesn't add new files. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/chrome_pages.cc
diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc
index 179c0bb9bc2c8e19209f385eda61c6e9e92b2df9..1ab515ff0842a6a6d39ab34aaf6cefeb451fe4ab 100644
--- a/chrome/browser/ui/chrome_pages.cc
+++ b/chrome/browser/ui/chrome_pages.cc
@@ -134,6 +134,26 @@ std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) {
} // namespace
+bool IsInternalPage(const GURL& url) {
+ // TODO(groby): Figure out if TabManager/session restore rely on this
+ // being a shortened list, or if all WebUI pages qualify.
+
+ // There are many chrome:// UI URLs, but only look for the ones that users
+ // are likely to have open. Most of the benefit is from the NTP URL.
+ const char* const kReloadableUrlPrefixes[] = {
+ chrome::kChromeUIDownloadsURL, chrome::kChromeUIHistoryURL,
+ chrome::kChromeUINewTabURL, chrome::kChromeUISettingsURL,
+ };
+ // Prefix-match against the table above. Use strncmp to avoid allocating
+ // memory to convert the URL prefix constants into std::strings.
+ for (size_t i = 0; i < arraysize(kReloadableUrlPrefixes); ++i) {
+ if (!strncmp(url.spec().c_str(), kReloadableUrlPrefixes[i],
+ strlen(kReloadableUrlPrefixes[i])))
+ return true;
+ }
+ return false;
+}
+
void ShowBookmarkManager(Browser* browser) {
content::RecordAction(UserMetricsAction("ShowBookmarkManager"));
content::RecordAction(UserMetricsAction("ShowBookmarks"));

Powered by Google App Engine
This is Rietveld 408576698