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

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: 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
« no previous file with comments | « chrome/browser/ui/chrome_pages.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
Dan Beam 2016/06/02 02:20:38 why do we have to avoid this? because it's called
+ for (size_t i = 0; i < arraysize(kReloadableUrlPrefixes); ++i) {
+ if (!strncmp(url.spec().c_str(), kReloadableUrlPrefixes[i],
+ strlen(kReloadableUrlPrefixes[i])))
+ return true;
Dan Beam 2016/06/02 02:20:38 culies?
Dan Beam 2016/06/02 02:20:49 curlies*
+ }
Dan Beam 2016/06/02 02:20:38 i don't really think this for loop of 4 entries is
+ return false;
+}
+
void ShowBookmarkManager(Browser* browser) {
content::RecordAction(UserMetricsAction("ShowBookmarkManager"));
content::RecordAction(UserMetricsAction("ShowBookmarks"));
« no previous file with comments | « chrome/browser/ui/chrome_pages.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698