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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 if (MdHistoryUI::IsEnabled(Profile::FromBrowserContext(browser_context))) { | 88 if (MdHistoryUI::IsEnabled(Profile::FromBrowserContext(browser_context))) { |
89 host = chrome::kChromeUIHistoryHost; | 89 host = chrome::kChromeUIHistoryHost; |
90 path = url->path(); | 90 path = url->path(); |
91 } else { | 91 } else { |
92 host = chrome::kChromeUIUberHost; | 92 host = chrome::kChromeUIUberHost; |
93 path = chrome::kChromeUIHistoryHost + url->path(); | 93 path = chrome::kChromeUIHistoryHost + url->path(); |
94 } | 94 } |
95 #endif | 95 #endif |
96 // Redirect chrome://settings, unless MD settings is enabled. | 96 // Redirect chrome://settings, unless MD settings is enabled. |
97 } else if (host == chrome::kChromeUISettingsHost) { | 97 } else if (host == chrome::kChromeUISettingsHost) { |
98 if (::switches::AboutInSettingsEnabled()) { | 98 if (base::FeatureList::IsEnabled( |
99 features::kMaterialDesignSettingsFeature)) { | |
100 return true; // Prevent further rewriting - this is a valid URL. | |
101 } else if (::switches::AboutInSettingsEnabled()) { | |
Lei Zhang
2016/06/21 07:54:00
There's no need for an else after a return.
michaelpg
2016/06/21 19:19:33
the whole file, including this line before my patc
Lei Zhang
2016/06/21 19:30:58
gahhhhhhhh. Fix later.
| |
99 host = chrome::kChromeUISettingsFrameHost; | 102 host = chrome::kChromeUISettingsFrameHost; |
100 } else if (base::FeatureList::IsEnabled( | |
101 features::kMaterialDesignSettingsFeature)) { | |
102 return true; // Prevent further rewriting - this is a valid URL. | |
103 } else { | 103 } else { |
104 host = chrome::kChromeUIUberHost; | 104 host = chrome::kChromeUIUberHost; |
105 path = chrome::kChromeUISettingsHost + url->path(); | 105 path = chrome::kChromeUISettingsHost + url->path(); |
106 } | 106 } |
107 // Redirect chrome://help, unless MD settings is enabled. | 107 // Redirect chrome://help, unless MD settings is enabled. |
108 } else if (host == chrome::kChromeUIHelpHost) { | 108 } else if (host == chrome::kChromeUIHelpHost) { |
109 if (::switches::AboutInSettingsEnabled()) { | 109 if (base::FeatureList::IsEnabled( |
110 features::kMaterialDesignSettingsFeature)) { | |
111 return true; // Prevent further rewriting - this is a valid URL. | |
michaelpg
2016/06/21 03:17:47
note the change from patch 3 -- there's no need to
| |
112 } else if (::switches::AboutInSettingsEnabled()) { | |
110 host = chrome::kChromeUISettingsFrameHost; | 113 host = chrome::kChromeUISettingsFrameHost; |
111 if (url->path().empty() || url->path() == "/") | 114 if (url->path().empty() || url->path() == "/") |
112 path = chrome::kChromeUIHelpHost; | 115 path = chrome::kChromeUIHelpHost; |
113 } else if (base::FeatureList::IsEnabled( | |
114 features::kMaterialDesignSettingsFeature)) { | |
115 return true; // Prevent further rewriting - this is a valid URL. | |
116 } else { | 116 } else { |
117 host = chrome::kChromeUIUberHost; | 117 host = chrome::kChromeUIUberHost; |
118 path = chrome::kChromeUIHelpHost + url->path(); | 118 path = chrome::kChromeUIHelpHost + url->path(); |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 GURL::Replacements replacements; | 122 GURL::Replacements replacements; |
123 replacements.SetHostStr(host); | 123 replacements.SetHostStr(host); |
124 if (!path.empty()) | 124 if (!path.empty()) |
125 replacements.SetPathStr(path); | 125 replacements.SetPathStr(path); |
(...skipping 13 matching lines...) Expand all Loading... | |
139 FROM_HERE, base::Bind(&chrome::AttemptRestart)); | 139 FROM_HERE, base::Bind(&chrome::AttemptRestart)); |
140 return true; | 140 return true; |
141 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { | 141 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { |
142 base::ThreadTaskRunnerHandle::Get()->PostTask( | 142 base::ThreadTaskRunnerHandle::Get()->PostTask( |
143 FROM_HERE, base::Bind(&chrome::AttemptExit)); | 143 FROM_HERE, base::Bind(&chrome::AttemptExit)); |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 return false; | 147 return false; |
148 } | 148 } |
OLD | NEW |