Chromium Code Reviews| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 } else { | 81 } else { |
| 82 #if defined(OS_ANDROID) | 82 #if defined(OS_ANDROID) |
| 83 // On Android, redirect directly to chrome://history-frame since | 83 // On Android, redirect directly to chrome://history-frame since |
| 84 // uber page is unsupported. | 84 // uber page is unsupported. |
| 85 host = chrome::kChromeUIHistoryFrameHost; | 85 host = chrome::kChromeUIHistoryFrameHost; |
| 86 #else | 86 #else |
| 87 host = chrome::kChromeUIUberHost; | 87 host = chrome::kChromeUIUberHost; |
| 88 path = chrome::kChromeUIHistoryHost + url->path(); | 88 path = chrome::kChromeUIHistoryHost + url->path(); |
| 89 #endif | 89 #endif |
| 90 } | 90 } |
| 91 // Redirect chrome://settings | 91 // Redirect chrome://settings, unless MD settings is enabled. |
| 92 } else if (host == chrome::kChromeUISettingsHost) { | 92 } else if (host == chrome::kChromeUISettingsHost) { |
| 93 if (::switches::AboutInSettingsEnabled()) { | 93 if (::switches::AboutInSettingsEnabled()) { |
|
Nico
2016/06/10 18:41:27
this looks a bit funny -- if i enable md settings
groby-ooo-7-16
2016/06/10 20:58:17
The two flags are mutually exclusive, so any combi
| |
| 94 host = chrome::kChromeUISettingsFrameHost; | 94 host = chrome::kChromeUISettingsFrameHost; |
| 95 } else if (base::FeatureList::IsEnabled( | |
| 96 features::kMaterialDesignSettingsFeature)) { | |
| 97 return true; // Prevent further rewriting - this is a valid URL. | |
| 95 } else { | 98 } else { |
| 96 host = chrome::kChromeUIUberHost; | 99 host = chrome::kChromeUIUberHost; |
| 97 path = chrome::kChromeUISettingsHost + url->path(); | 100 path = chrome::kChromeUISettingsHost + url->path(); |
| 98 } | 101 } |
| 99 // Redirect chrome://help | 102 // Redirect chrome://help, unless MD settings is enabled. |
| 100 } else if (host == chrome::kChromeUIHelpHost) { | 103 } else if (host == chrome::kChromeUIHelpHost) { |
| 101 if (::switches::AboutInSettingsEnabled()) { | 104 if (::switches::AboutInSettingsEnabled()) { |
| 102 host = chrome::kChromeUISettingsFrameHost; | 105 host = chrome::kChromeUISettingsFrameHost; |
| 103 if (url->path().empty() || url->path() == "/") | 106 if (url->path().empty() || url->path() == "/") |
| 104 path = chrome::kChromeUIHelpHost; | 107 path = chrome::kChromeUIHelpHost; |
| 108 } else if (base::FeatureList::IsEnabled( | |
| 109 features::kMaterialDesignSettingsFeature)) { | |
| 110 return true; // Prevent further rewriting - this is a valid URL. | |
| 105 } else { | 111 } else { |
| 106 host = chrome::kChromeUIUberHost; | 112 host = chrome::kChromeUIUberHost; |
| 107 path = chrome::kChromeUIHelpHost + url->path(); | 113 path = chrome::kChromeUIHelpHost + url->path(); |
| 108 } | 114 } |
| 109 } | 115 } |
| 110 | 116 |
| 111 GURL::Replacements replacements; | 117 GURL::Replacements replacements; |
| 112 replacements.SetHostStr(host); | 118 replacements.SetHostStr(host); |
| 113 if (!path.empty()) | 119 if (!path.empty()) |
| 114 replacements.SetPathStr(path); | 120 replacements.SetPathStr(path); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 128 FROM_HERE, base::Bind(&chrome::AttemptRestart)); | 134 FROM_HERE, base::Bind(&chrome::AttemptRestart)); |
| 129 return true; | 135 return true; |
| 130 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { | 136 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { |
| 131 base::ThreadTaskRunnerHandle::Get()->PostTask( | 137 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 132 FROM_HERE, base::Bind(&chrome::AttemptExit)); | 138 FROM_HERE, base::Bind(&chrome::AttemptExit)); |
| 133 return true; | 139 return true; |
| 134 } | 140 } |
| 135 | 141 |
| 136 return false; | 142 return false; |
| 137 } | 143 } |
| OLD | NEW |