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 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 // Only handle chrome://foo/, URLFixerUpper::FixupURL translates about:foo. | 1488 // Only handle chrome://foo/, URLFixerUpper::FixupURL translates about:foo. |
1489 // TAB_CONTENTS_WEB handles about:blank, which frames are allowed to access. | 1489 // TAB_CONTENTS_WEB handles about:blank, which frames are allowed to access. |
1490 if (!url->SchemeIs(chrome::kChromeUIScheme)) | 1490 if (!url->SchemeIs(chrome::kChromeUIScheme)) |
1491 return false; | 1491 return false; |
1492 | 1492 |
1493 // Circumvent processing URLs that the renderer process will handle. | 1493 // Circumvent processing URLs that the renderer process will handle. |
1494 if (chrome_about_handler::WillHandle(*url)) | 1494 if (chrome_about_handler::WillHandle(*url)) |
1495 return false; | 1495 return false; |
1496 | 1496 |
1497 std::string host(url->host()); | 1497 std::string host(url->host()); |
1498 std::string path; | |
1499 // Replace about with chrome-urls. | 1498 // Replace about with chrome-urls. |
1500 if (host == chrome::kChromeUIAboutHost) | 1499 if (host == chrome::kChromeUIAboutHost) |
1501 host = chrome::kChromeUIChromeURLsHost; | 1500 host = chrome::kChromeUIChromeURLsHost; |
1502 // Replace cache with view-http-cache. | 1501 // Replace cache with view-http-cache. |
1503 if (host == chrome::kChromeUICacheHost) { | 1502 if (host == chrome::kChromeUICacheHost) |
1504 host = chrome::kChromeUINetworkViewCacheHost; | 1503 host = chrome::kChromeUINetworkViewCacheHost; |
1505 // Replace gpu with gpu-internals. | 1504 // Replace gpu with gpu-internals. |
1506 } else if (host == chrome::kChromeUIGpuHost) { | 1505 else if (host == chrome::kChromeUIGpuHost) |
1507 host = chrome::kChromeUIGpuInternalsHost; | 1506 host = chrome::kChromeUIGpuInternalsHost; |
1508 // Replace sync with sync-internals (for legacy reasons). | 1507 // Replace sync with sync-internals (for legacy reasons). |
1509 } else if (host == chrome::kChromeUISyncHost) { | 1508 else if (host == chrome::kChromeUISyncHost) |
1510 host = chrome::kChromeUISyncInternalsHost; | 1509 host = chrome::kChromeUISyncInternalsHost; |
1511 // Redirect chrome://extensions to chrome://settings/extensionSettings. | |
1512 } else if (host == chrome::kChromeUIExtensionsHost) { | |
1513 host = chrome::kChromeUISettingsHost; | |
1514 path = chrome::kExtensionsSubPage; | |
1515 } | |
1516 | |
1517 GURL::Replacements replacements; | 1510 GURL::Replacements replacements; |
1518 replacements.SetHostStr(host); | 1511 replacements.SetHostStr(host); |
1519 if (!path.empty()) | |
1520 replacements.SetPathStr(path); | |
1521 *url = url->ReplaceComponents(replacements); | 1512 *url = url->ReplaceComponents(replacements); |
1522 | 1513 |
1523 // Handle URLs to crash the browser or wreck the gpu process. | 1514 // Handle URLs to crash the browser or wreck the gpu process. |
1524 if (host == chrome::kChromeUIBrowserCrashHost) { | 1515 if (host == chrome::kChromeUIBrowserCrashHost) { |
1525 // Induce an intentional crash in the browser process. | 1516 // Induce an intentional crash in the browser process. |
1526 CHECK(false); | 1517 CHECK(false); |
1527 } else if (host == chrome::kChromeUIGpuCleanHost) { | 1518 } else if (host == chrome::kChromeUIGpuCleanHost) { |
1528 GpuProcessHost::SendOnIO( | 1519 GpuProcessHost::SendOnIO( |
1529 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, new GpuMsg_Clean()); | 1520 0, content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, new GpuMsg_Clean()); |
1530 } else if (host == chrome::kChromeUIGpuCrashHost) { | 1521 } else if (host == chrome::kChromeUIGpuCrashHost) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 return false; | 1568 return false; |
1578 } | 1569 } |
1579 | 1570 |
1580 std::vector<std::string> ChromePaths() { | 1571 std::vector<std::string> ChromePaths() { |
1581 std::vector<std::string> paths; | 1572 std::vector<std::string> paths; |
1582 paths.reserve(arraysize(kChromePaths)); | 1573 paths.reserve(arraysize(kChromePaths)); |
1583 for (size_t i = 0; i < arraysize(kChromePaths); i++) | 1574 for (size_t i = 0; i < arraysize(kChromePaths); i++) |
1584 paths.push_back(kChromePaths[i]); | 1575 paths.push_back(kChromePaths[i]); |
1585 return paths; | 1576 return paths; |
1586 } | 1577 } |
OLD | NEW |