Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(982)

Side by Side Diff: chrome/browser/browser_about_handler.cc

Issue 2654423002: MD Settings: Redirect chrome://chrome to MD About when MD Settings is on (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 host = chrome::kChromeUISettingsHost; 121 host = chrome::kChromeUISettingsHost;
122 path = chrome::kChromeUIHelpHost; 122 path = chrome::kChromeUIHelpHost;
123 } else if (::switches::AboutInSettingsEnabled()) { 123 } else if (::switches::AboutInSettingsEnabled()) {
124 host = chrome::kChromeUISettingsFrameHost; 124 host = chrome::kChromeUISettingsFrameHost;
125 if (url->path().empty() || url->path() == "/") 125 if (url->path().empty() || url->path() == "/")
126 path = chrome::kChromeUIHelpHost; 126 path = chrome::kChromeUIHelpHost;
127 } else { 127 } else {
128 host = chrome::kChromeUIUberHost; 128 host = chrome::kChromeUIUberHost;
129 path = chrome::kChromeUIHelpHost + url->path(); 129 path = chrome::kChromeUIHelpHost + url->path();
130 } 130 }
131 // Redirect chrome://chrome to chrome://settings/help, only for MD settings.
132 } else if (host == chrome::kChromeUIUberHost &&
133 base::FeatureList::IsEnabled(features::kMaterialDesignSettings) &&
134 (url->path().empty() || url->path() == "/")) {
135 host = chrome::kChromeUISettingsHost;
136 path = chrome::kChromeUIHelpHost;
131 } 137 }
132 138
133 GURL::Replacements replacements; 139 GURL::Replacements replacements;
134 replacements.SetHostStr(host); 140 replacements.SetHostStr(host);
135 if (!path.empty()) 141 if (!path.empty())
136 replacements.SetPathStr(path); 142 replacements.SetPathStr(path);
137 *url = url->ReplaceComponents(replacements); 143 *url = url->ReplaceComponents(replacements);
138 144
139 // Having re-written the URL, make the chrome: handler process it. 145 // Having re-written the URL, make the chrome: handler process it.
140 return false; 146 return false;
141 } 147 }
142 148
143 bool HandleNonNavigationAboutURL(const GURL& url) { 149 bool HandleNonNavigationAboutURL(const GURL& url) {
144 const std::string spec(url.spec()); 150 const std::string spec(url.spec());
145 151
146 if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIRestartURL)) { 152 if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIRestartURL)) {
147 // Call AttemptRestart after chrome::Navigate() completes to avoid access of 153 // Call AttemptRestart after chrome::Navigate() completes to avoid access of
148 // gtk objects after they are destroyed by BrowserWindowGtk::Close(). 154 // gtk objects after they are destroyed by BrowserWindowGtk::Close().
149 base::ThreadTaskRunnerHandle::Get()->PostTask( 155 base::ThreadTaskRunnerHandle::Get()->PostTask(
150 FROM_HERE, base::Bind(&chrome::AttemptRestart)); 156 FROM_HERE, base::Bind(&chrome::AttemptRestart));
151 return true; 157 return true;
152 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { 158 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) {
153 base::ThreadTaskRunnerHandle::Get()->PostTask( 159 base::ThreadTaskRunnerHandle::Get()->PostTask(
154 FROM_HERE, base::Bind(&chrome::AttemptExit)); 160 FROM_HERE, base::Bind(&chrome::AttemptExit));
155 return true; 161 return true;
156 } 162 }
157 163
158 return false; 164 return false;
159 } 165 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698