OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 // Only handle chrome://foo/, URLFixerUpper::FixupURL translates about:foo. | 1512 // Only handle chrome://foo/, URLFixerUpper::FixupURL translates about:foo. |
1513 // TAB_CONTENTS_WEB handles about:blank, which frames are allowed to access. | 1513 // TAB_CONTENTS_WEB handles about:blank, which frames are allowed to access. |
1514 if (!url->SchemeIs(chrome::kChromeUIScheme)) | 1514 if (!url->SchemeIs(chrome::kChromeUIScheme)) |
1515 return false; | 1515 return false; |
1516 | 1516 |
1517 // Circumvent processing URLs that the renderer process will handle. | 1517 // Circumvent processing URLs that the renderer process will handle. |
1518 if (chrome_about_handler::WillHandle(*url)) | 1518 if (chrome_about_handler::WillHandle(*url)) |
1519 return false; | 1519 return false; |
1520 | 1520 |
1521 std::string host(url->host()); | 1521 std::string host(url->host()); |
| 1522 std::string path; |
1522 // Replace about with chrome-urls. | 1523 // Replace about with chrome-urls. |
1523 if (host == chrome::kChromeUIAboutHost) | 1524 if (host == chrome::kChromeUIAboutHost) |
1524 host = chrome::kChromeUIChromeURLsHost; | 1525 host = chrome::kChromeUIChromeURLsHost; |
1525 // Replace cache with view-http-cache. | 1526 // Replace cache with view-http-cache. |
1526 if (host == chrome::kChromeUICacheHost) | 1527 if (host == chrome::kChromeUICacheHost) { |
1527 host = chrome::kChromeUINetworkViewCacheHost; | 1528 host = chrome::kChromeUINetworkViewCacheHost; |
1528 // Replace gpu with gpu-internals. | 1529 // Replace gpu with gpu-internals. |
1529 else if (host == chrome::kChromeUIGpuHost) | 1530 } else if (host == chrome::kChromeUIGpuHost) { |
1530 host = chrome::kChromeUIGpuInternalsHost; | 1531 host = chrome::kChromeUIGpuInternalsHost; |
1531 // Replace sync with sync-internals (for legacy reasons). | 1532 // Replace sync with sync-internals (for legacy reasons). |
1532 else if (host == chrome::kChromeUISyncHost) | 1533 } else if (host == chrome::kChromeUISyncHost) { |
1533 host = chrome::kChromeUISyncInternalsHost; | 1534 host = chrome::kChromeUISyncInternalsHost; |
| 1535 // Redirect chrome://extensions to chrome://settings/extensions. |
| 1536 } else if (host == chrome::kChromeUIExtensionsHost) { |
| 1537 host = chrome::kChromeUISettingsHost; |
| 1538 path = chrome::kExtensionsSubPage; |
| 1539 } |
1534 GURL::Replacements replacements; | 1540 GURL::Replacements replacements; |
1535 replacements.SetHostStr(host); | 1541 replacements.SetHostStr(host); |
| 1542 if (!path.empty()) |
| 1543 replacements.SetPathStr(path); |
1536 *url = url->ReplaceComponents(replacements); | 1544 *url = url->ReplaceComponents(replacements); |
1537 | 1545 |
1538 // Handle URLs to crash the browser or wreck the gpu process. | 1546 // Handle URLs to crash the browser or wreck the gpu process. |
1539 if (host == chrome::kChromeUIBrowserCrashHost) { | 1547 if (host == chrome::kChromeUIBrowserCrashHost) { |
1540 // Induce an intentional crash in the browser process. | 1548 // Induce an intentional crash in the browser process. |
1541 CHECK(false); | 1549 CHECK(false); |
1542 } else if (host == chrome::kChromeUIGpuCleanHost) { | 1550 } else if (host == chrome::kChromeUIGpuCleanHost) { |
1543 GpuProcessHost::SendOnIO( | 1551 GpuProcessHost::SendOnIO( |
1544 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, new GpuMsg_Clean()); | 1552 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, new GpuMsg_Clean()); |
1545 } else if (host == chrome::kChromeUIGpuCrashHost) { | 1553 } else if (host == chrome::kChromeUIGpuCrashHost) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 return false; | 1600 return false; |
1593 } | 1601 } |
1594 | 1602 |
1595 std::vector<std::string> ChromePaths() { | 1603 std::vector<std::string> ChromePaths() { |
1596 std::vector<std::string> paths; | 1604 std::vector<std::string> paths; |
1597 paths.reserve(arraysize(kChromePaths)); | 1605 paths.reserve(arraysize(kChromePaths)); |
1598 for (size_t i = 0; i < arraysize(kChromePaths); i++) | 1606 for (size_t i = 0; i < arraysize(kChromePaths); i++) |
1599 paths.push_back(kChromePaths[i]); | 1607 paths.push_back(kChromePaths[i]); |
1600 return paths; | 1608 return paths; |
1601 } | 1609 } |
OLD | NEW |