| 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/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 Loading... |
| 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. |
| 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; |
| 153 } |
| 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 Loading... |
| 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 |
| OLD | NEW |