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/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Legacy redirect from chrome://history-frame to chrome://history. | 64 // Legacy redirect from chrome://history-frame to chrome://history. |
65 if (host == chrome::kDeprecatedChromeUIHistoryFrameHost) | 65 if (host == chrome::kDeprecatedChromeUIHistoryFrameHost) |
66 host = chrome::kChromeUIHistoryHost; | 66 host = chrome::kChromeUIHistoryHost; |
67 | 67 |
68 // Replace cache with view-http-cache. | 68 // Replace cache with view-http-cache. |
69 if (host == chrome::kChromeUICacheHost) { | 69 if (host == chrome::kChromeUICacheHost) { |
70 host = content::kChromeUINetworkViewCacheHost; | 70 host = content::kChromeUINetworkViewCacheHost; |
71 // Replace sync with sync-internals (for legacy reasons). | 71 // Replace sync with sync-internals (for legacy reasons). |
72 } else if (host == chrome::kChromeUISyncHost) { | 72 } else if (host == chrome::kChromeUISyncHost) { |
73 host = chrome::kChromeUISyncInternalsHost; | 73 host = chrome::kChromeUISyncInternalsHost; |
74 // Redirect chrome://extensions. | 74 // Redirect chrome://extensions, chrome://extensions-frame, and |
| 75 // chrome://settings/extensions all to chrome://extensions and forward path. |
75 #if BUILDFLAG(ENABLE_EXTENSIONS) | 76 #if BUILDFLAG(ENABLE_EXTENSIONS) |
76 } else if (host == chrome::kChromeUIExtensionsHost) { | 77 } else if (host == chrome::kChromeUIExtensionsHost || |
77 // If the material design extensions page is enabled, it gets its own host. | 78 host == chrome::kChromeUIExtensionsFrameHost || |
78 // Otherwise, it's handled by the uber settings page. | 79 (host == chrome::kChromeUISettingsHost && |
79 if (base::FeatureList::IsEnabled(features::kMaterialDesignExtensions)) { | 80 url->path() == |
80 host = chrome::kChromeUIExtensionsHost; | 81 std::string("/") + chrome::kDeprecatedExtensionsSubPage)) { |
81 path = url->path(); | 82 host = chrome::kChromeUIExtensionsHost; |
82 } else { | 83 path = url->path(); |
83 host = chrome::kChromeUIUberHost; | |
84 path = chrome::kChromeUIExtensionsHost + url->path(); | |
85 } | |
86 // Redirect chrome://settings/extensions (legacy URL). | |
87 } else if (host == chrome::kChromeUISettingsHost && | |
88 url->path() == | |
89 std::string("/") + chrome::kDeprecatedExtensionsSubPage) { | |
90 host = chrome::kChromeUIUberHost; | |
91 path = chrome::kChromeUIExtensionsHost; | |
92 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 84 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
93 } else if (host == chrome::kChromeUIHistoryHost) { | 85 } else if (host == chrome::kChromeUIHistoryHost) { |
94 // Redirect chrome://history. | 86 // Redirect chrome://history. |
95 path = url->path(); | 87 path = url->path(); |
96 } | 88 } |
97 | 89 |
98 GURL::Replacements replacements; | 90 GURL::Replacements replacements; |
99 replacements.SetHostStr(host); | 91 replacements.SetHostStr(host); |
100 if (!path.empty()) | 92 if (!path.empty()) |
101 replacements.SetPathStr(path); | 93 replacements.SetPathStr(path); |
(...skipping 14 matching lines...) Expand all Loading... |
116 return true; | 108 return true; |
117 } | 109 } |
118 if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { | 110 if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { |
119 base::ThreadTaskRunnerHandle::Get()->PostTask( | 111 base::ThreadTaskRunnerHandle::Get()->PostTask( |
120 FROM_HERE, base::BindOnce(&chrome::AttemptExit)); | 112 FROM_HERE, base::BindOnce(&chrome::AttemptExit)); |
121 return true; | 113 return true; |
122 } | 114 } |
123 | 115 |
124 return false; | 116 return false; |
125 } | 117 } |
OLD | NEW |