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

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

Issue 2743323005: MD Settings: enhance restarting Chrome + interacting w/ session restore (Closed)
Patch Set: merge Created 3 years, 9 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // If the material design extensions page is enabled, it gets its own host. 73 // If the material design extensions page is enabled, it gets its own host.
74 // Otherwise, it's handled by the uber settings page. 74 // Otherwise, it's handled by the uber settings page.
75 if (base::FeatureList::IsEnabled(features::kMaterialDesignExtensions)) { 75 if (base::FeatureList::IsEnabled(features::kMaterialDesignExtensions)) {
76 host = chrome::kChromeUIExtensionsHost; 76 host = chrome::kChromeUIExtensionsHost;
77 path = url->path(); 77 path = url->path();
78 } else { 78 } else {
79 host = chrome::kChromeUIUberHost; 79 host = chrome::kChromeUIUberHost;
80 path = chrome::kChromeUIExtensionsHost + url->path(); 80 path = chrome::kChromeUIExtensionsHost + url->path();
81 } 81 }
82 // Redirect chrome://settings/extensions (legacy URL). 82 // Redirect chrome://settings/extensions (legacy URL).
83 } else if (host == chrome::kChromeUISettingsHost && 83 } else if (host == content::kChromeUISettingsHost &&
84 url->path() == 84 url->path() ==
85 std::string("/") + chrome::kDeprecatedExtensionsSubPage) { 85 std::string("/") + chrome::kDeprecatedExtensionsSubPage) {
86 host = chrome::kChromeUIUberHost; 86 host = chrome::kChromeUIUberHost;
87 path = chrome::kChromeUIExtensionsHost; 87 path = chrome::kChromeUIExtensionsHost;
88 #endif // BUILDFLAG(ENABLE_EXTENSIONS) 88 #endif // BUILDFLAG(ENABLE_EXTENSIONS)
89 // Redirect chrome://history. 89 // Redirect chrome://history.
90 } else if (host == content::kChromeUIHistoryHost) { 90 } else if (host == content::kChromeUIHistoryHost) {
91 #if defined(OS_ANDROID) 91 #if defined(OS_ANDROID)
92 // TODO(twellington): remove this after native Android history launches. 92 // TODO(twellington): remove this after native Android history launches.
93 // See http://crbug.com/654071. 93 // See http://crbug.com/654071.
94 if (!base::FeatureList::IsEnabled(features::kNativeAndroidHistoryManager)) { 94 if (!base::FeatureList::IsEnabled(features::kNativeAndroidHistoryManager)) {
95 // On Android, redirect directly to chrome://history-frame since 95 // On Android, redirect directly to chrome://history-frame since
96 // uber page is unsupported. 96 // uber page is unsupported.
97 host = chrome::kChromeUIHistoryFrameHost; 97 host = chrome::kChromeUIHistoryFrameHost;
98 } 98 }
99 #else 99 #else
100 // Material design history is handled on the top-level chrome://history 100 // Material design history is handled on the top-level chrome://history
101 // host. 101 // host.
102 if (base::FeatureList::IsEnabled(features::kMaterialDesignHistory)) { 102 if (base::FeatureList::IsEnabled(features::kMaterialDesignHistory)) {
103 host = content::kChromeUIHistoryHost; 103 host = content::kChromeUIHistoryHost;
104 path = url->path(); 104 path = url->path();
105 } else { 105 } else {
106 host = chrome::kChromeUIUberHost; 106 host = chrome::kChromeUIUberHost;
107 path = content::kChromeUIHistoryHost + url->path(); 107 path = content::kChromeUIHistoryHost + url->path();
108 } 108 }
109 #endif 109 #endif
110 // Redirect chrome://settings, unless MD settings is enabled. 110 // Redirect chrome://settings, unless MD settings is enabled.
111 } else if (host == chrome::kChromeUISettingsHost) { 111 } else if (host == content::kChromeUISettingsHost) {
112 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { 112 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) {
113 return true; // Prevent further rewriting - this is a valid URL. 113 return true; // Prevent further rewriting - this is a valid URL.
114 } else if (::switches::SettingsWindowEnabled()) { 114 } else if (::switches::SettingsWindowEnabled()) {
115 host = chrome::kChromeUISettingsFrameHost; 115 host = chrome::kChromeUISettingsFrameHost;
116 } else { 116 } else {
117 host = chrome::kChromeUIUberHost; 117 host = chrome::kChromeUIUberHost;
118 path = chrome::kChromeUISettingsHost + url->path(); 118 path = content::kChromeUISettingsHost + url->path();
119 } 119 }
120 // Redirect chrome://help, unless MD settings is enabled. 120 // Redirect chrome://help, unless MD settings is enabled.
121 } else if (host == chrome::kChromeUIHelpHost) { 121 } else if (host == content::kChromeUIHelpHost) {
122 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { 122 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) {
123 return false; // Handled in the HandleWebUI handler. 123 return false; // Handled in the HandleWebUI handler.
124 } else if (::switches::SettingsWindowEnabled()) { 124 } else if (::switches::SettingsWindowEnabled()) {
125 host = chrome::kChromeUISettingsFrameHost; 125 host = chrome::kChromeUISettingsFrameHost;
126 if (url->path().empty() || url->path() == "/") 126 if (url->path().empty() || url->path() == "/")
127 path = chrome::kChromeUIHelpHost; 127 path = content::kChromeUIHelpHost;
128 } else { 128 } else {
129 host = chrome::kChromeUIUberHost; 129 host = chrome::kChromeUIUberHost;
130 path = chrome::kChromeUIHelpHost + url->path(); 130 path = content::kChromeUIHelpHost + url->path();
131 } 131 }
132 } 132 }
133 133
134 GURL::Replacements replacements; 134 GURL::Replacements replacements;
135 replacements.SetHostStr(host); 135 replacements.SetHostStr(host);
136 if (!path.empty()) 136 if (!path.empty())
137 replacements.SetPathStr(path); 137 replacements.SetPathStr(path);
138 *url = url->ReplaceComponents(replacements); 138 *url = url->ReplaceComponents(replacements);
139 139
140 // Having re-written the URL, make the chrome: handler process it. 140 // Having re-written the URL, make the chrome: handler process it.
(...skipping 10 matching lines...) Expand all
151 FROM_HERE, base::Bind(&chrome::AttemptRestart)); 151 FROM_HERE, base::Bind(&chrome::AttemptRestart));
152 return true; 152 return true;
153 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) { 153 } else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) {
154 base::ThreadTaskRunnerHandle::Get()->PostTask( 154 base::ThreadTaskRunnerHandle::Get()->PostTask(
155 FROM_HERE, base::Bind(&chrome::AttemptExit)); 155 FROM_HERE, base::Bind(&chrome::AttemptExit));
156 return true; 156 return true;
157 } 157 }
158 158
159 return false; 159 return false;
160 } 160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698