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

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

Issue 2029263002: [MD Settings] Add feature to enable md-settings by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix URL CHECK statement. (Use URL, not Host) 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/profiles/profile_window.cc » ('j') | 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // Material design history is handled on the top-level chrome://history 86 // Material design history is handled on the top-level chrome://history
87 // host. 87 // host.
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 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 (::switches::AboutInSettingsEnabled()) {
99 host = chrome::kChromeUISettingsFrameHost; 99 host = chrome::kChromeUISettingsFrameHost;
100 } else if (base::FeatureList::IsEnabled(
101 features::kMaterialDesignSettingsFeature)) {
102 return true; // Prevent further rewriting - this is a valid URL.
100 } else { 103 } else {
101 host = chrome::kChromeUIUberHost; 104 host = chrome::kChromeUIUberHost;
102 path = chrome::kChromeUISettingsHost + url->path(); 105 path = chrome::kChromeUISettingsHost + url->path();
103 } 106 }
104 // Redirect chrome://help 107 // Redirect chrome://help, unless MD settings is enabled.
105 } else if (host == chrome::kChromeUIHelpHost) { 108 } else if (host == chrome::kChromeUIHelpHost) {
106 if (::switches::AboutInSettingsEnabled()) { 109 if (::switches::AboutInSettingsEnabled()) {
107 host = chrome::kChromeUISettingsFrameHost; 110 host = chrome::kChromeUISettingsFrameHost;
108 if (url->path().empty() || url->path() == "/") 111 if (url->path().empty() || url->path() == "/")
109 path = chrome::kChromeUIHelpHost; 112 path = chrome::kChromeUIHelpHost;
113 } else if (base::FeatureList::IsEnabled(
114 features::kMaterialDesignSettingsFeature)) {
115 return true; // Prevent further rewriting - this is a valid URL.
110 } else { 116 } else {
111 host = chrome::kChromeUIUberHost; 117 host = chrome::kChromeUIUberHost;
112 path = chrome::kChromeUIHelpHost + url->path(); 118 path = chrome::kChromeUIHelpHost + url->path();
113 } 119 }
114 } 120 }
115 121
116 GURL::Replacements replacements; 122 GURL::Replacements replacements;
117 replacements.SetHostStr(host); 123 replacements.SetHostStr(host);
118 if (!path.empty()) 124 if (!path.empty())
119 replacements.SetPathStr(path); 125 replacements.SetPathStr(path);
(...skipping 13 matching lines...) Expand all
133 FROM_HERE, base::Bind(&chrome::AttemptRestart)); 139 FROM_HERE, base::Bind(&chrome::AttemptRestart));
134 return true; 140 return true;
135 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { 141 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) {
136 base::ThreadTaskRunnerHandle::Get()->PostTask( 142 base::ThreadTaskRunnerHandle::Get()->PostTask(
137 FROM_HERE, base::Bind(&chrome::AttemptExit)); 143 FROM_HERE, base::Bind(&chrome::AttemptExit));
138 return true; 144 return true;
139 } 145 }
140 146
141 return false; 147 return false;
142 } 148 }
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/profiles/profile_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698