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

Side by Side 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, 6 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/chrome_pages.h" 5 #include "chrome/browser/ui/chrome_pages.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 #endif 127 #endif
128 } 128 }
129 129
130 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { 130 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) {
131 return kContentSettingsExceptionsSubPage + std::string(kHashMark) + 131 return kContentSettingsExceptionsSubPage + std::string(kHashMark) +
132 options::ContentSettingsHandler::ContentSettingsTypeToGroupName(type); 132 options::ContentSettingsHandler::ContentSettingsTypeToGroupName(type);
133 } 133 }
134 134
135 } // namespace 135 } // namespace
136 136
137 bool IsInternalPage(const GURL& url) {
138 // TODO(groby): Figure out if TabManager/session restore rely on this
139 // being a shortened list, or if all WebUI pages qualify.
140
141 // There are many chrome:// UI URLs, but only look for the ones that users
142 // are likely to have open. Most of the benefit is from the NTP URL.
143 const char* const kReloadableUrlPrefixes[] = {
144 chrome::kChromeUIDownloadsURL, chrome::kChromeUIHistoryURL,
145 chrome::kChromeUINewTabURL, chrome::kChromeUISettingsURL,
146 };
147 // Prefix-match against the table above. Use strncmp to avoid allocating
148 // 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
149 for (size_t i = 0; i < arraysize(kReloadableUrlPrefixes); ++i) {
150 if (!strncmp(url.spec().c_str(), kReloadableUrlPrefixes[i],
151 strlen(kReloadableUrlPrefixes[i])))
152 return true;
Dan Beam 2016/06/02 02:20:38 culies?
Dan Beam 2016/06/02 02:20:49 curlies*
153 }
Dan Beam 2016/06/02 02:20:38 i don't really think this for loop of 4 entries is
154 return false;
155 }
156
137 void ShowBookmarkManager(Browser* browser) { 157 void ShowBookmarkManager(Browser* browser) {
138 content::RecordAction(UserMetricsAction("ShowBookmarkManager")); 158 content::RecordAction(UserMetricsAction("ShowBookmarkManager"));
139 content::RecordAction(UserMetricsAction("ShowBookmarks")); 159 content::RecordAction(UserMetricsAction("ShowBookmarks"));
140 ShowSingletonTabOverwritingNTP( 160 ShowSingletonTabOverwritingNTP(
141 browser, 161 browser,
142 GetSingletonTabNavigateParams(browser, GURL(kChromeUIBookmarksURL))); 162 GetSingletonTabNavigateParams(browser, GURL(kChromeUIBookmarksURL)));
143 } 163 }
144 164
145 void ShowBookmarkManagerForNode(Browser* browser, int64_t node_id) { 165 void ShowBookmarkManagerForNode(Browser* browser, int64_t node_id) {
146 OpenBookmarkManagerWithHash(browser, std::string(), node_id); 166 OpenBookmarkManagerWithHash(browser, std::string(), node_id);
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 SigninManagerFactory::GetForProfile(original_profile); 413 SigninManagerFactory::GetForProfile(original_profile);
394 DCHECK(manager->IsSigninAllowed()); 414 DCHECK(manager->IsSigninAllowed());
395 if (manager->IsAuthenticated()) 415 if (manager->IsAuthenticated())
396 ShowSettings(browser); 416 ShowSettings(browser);
397 else 417 else
398 ShowBrowserSignin(browser, access_point); 418 ShowBrowserSignin(browser, access_point);
399 } 419 }
400 #endif 420 #endif
401 421
402 } // namespace chrome 422 } // namespace chrome
OLDNEW
« 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