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

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

Issue 2088473002: Fix Material Settings Help and Settings redirect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SettingsCrash
Patch Set: git cl format Created 4 years, 6 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
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()) {
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.
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_about_handler_unittest.cc » ('j') | chrome/browser/browser_about_handler_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698