 Chromium Code Reviews
 Chromium Code Reviews Issue 2034573002:
  [Cleanup] Factor out common code. 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 2034573002:
  [Cleanup] Factor out common code. 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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")); |