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

Side by Side Diff: chrome/browser/ui/chrome_pages.cc

Issue 2697723006: MD Settings: Fix subpage URLS for CrOS (Closed)
Patch Set: Created 3 years, 10 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/ui/chrome_pages.h" 5 #include "chrome/browser/ui/chrome_pages.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 ShowSingletonTab(browser, GURL(kChromeUIPolicyURL)); 255 ShowSingletonTab(browser, GURL(kChromeUIPolicyURL));
256 } 256 }
257 257
258 void ShowSlow(Browser* browser) { 258 void ShowSlow(Browser* browser) {
259 #if defined(OS_CHROMEOS) 259 #if defined(OS_CHROMEOS)
260 ShowSingletonTab(browser, GURL(kChromeUISlowURL)); 260 ShowSingletonTab(browser, GURL(kChromeUISlowURL));
261 #endif 261 #endif
262 } 262 }
263 263
264 GURL GetSettingsUrl(const std::string& sub_page) { 264 GURL GetSettingsUrl(const std::string& sub_page) {
265 std::string url = std::string(kChromeUISettingsURL) + sub_page; 265 return GURL(std::string(kChromeUISettingsURL) + sub_page);
266 #if defined(OS_CHROMEOS)
267 if (sub_page.find(kInternetOptionsSubPage, 0) != std::string::npos) {
268 std::string::size_type loc = sub_page.find("?", 0);
269 std::string network_page =
270 loc != std::string::npos ? sub_page.substr(loc) : std::string();
271 url = std::string(kChromeUISettingsURL) + network_page;
stevenjb 2017/02/15 20:41:23 I'm not entirely sure what this was intended to do
tommycli 2017/02/15 21:48:13 Acknowledged.
272 }
273 #endif
274 return GURL(url);
275 } 266 }
276 267
277 bool IsSettingsSubPage(const GURL& url, const std::string& sub_page) { 268 bool IsSettingsSubPage(const GURL& url, const std::string& sub_page) {
278 return (url.SchemeIs(content::kChromeUIScheme) && 269 return (url.SchemeIs(content::kChromeUIScheme) &&
279 (url.host_piece() == chrome::kChromeUISettingsHost || 270 (url.host_piece() == chrome::kChromeUISettingsHost ||
280 url.host_piece() == chrome::kChromeUISettingsFrameHost) && 271 url.host_piece() == chrome::kChromeUISettingsFrameHost) &&
281 url.path_piece() == "/" + sub_page); 272 url.path_piece() == "/" + sub_page);
282 } 273 }
283 274
284 bool IsTrustedPopupWindowWithScheme(const Browser* browser, 275 bool IsTrustedPopupWindowWithScheme(const Browser* browser,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 if (!base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { 307 if (!base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) {
317 if (sub_page == chrome::kAccessibilitySubPage) { 308 if (sub_page == chrome::kAccessibilitySubPage) {
318 sub_page_path = GenerateContentSettingsSearchQueryPath( 309 sub_page_path = GenerateContentSettingsSearchQueryPath(
319 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY); 310 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY);
320 } else if (sub_page == chrome::kBluetoothSubPage) { 311 } else if (sub_page == chrome::kBluetoothSubPage) {
321 sub_page_path = GenerateContentSettingsSearchQueryPath( 312 sub_page_path = GenerateContentSettingsSearchQueryPath(
322 IDS_OPTIONS_SETTINGS_SECTION_TITLE_BLUETOOTH); 313 IDS_OPTIONS_SETTINGS_SECTION_TITLE_BLUETOOTH);
323 } else if (sub_page == chrome::kDateTimeSubPage) { 314 } else if (sub_page == chrome::kDateTimeSubPage) {
324 sub_page_path = GenerateContentSettingsSearchQueryPath( 315 sub_page_path = GenerateContentSettingsSearchQueryPath(
325 IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); 316 IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME);
317 } else if (sub_page == chrome::kStylusSubPage ||
318 sub_page == chrome::kPowerSubPage) {
319 sub_page_path += "-overlay";
320 }
321 } else {
322 if (sub_page == chrome::kPowerSubPage) {
323 // TODO(stevenjbj/derat): Remove this once we have a 'power' subpage,
324 // crbug.com/633455.
325 sub_page_path = "device";
326 } 326 }
327 } 327 }
328 #endif 328 #endif
329 329
330 if (::switches::SettingsWindowEnabled()) { 330 if (::switches::SettingsWindowEnabled()) {
331 content::RecordAction(base::UserMetricsAction("ShowOptions")); 331 content::RecordAction(base::UserMetricsAction("ShowOptions"));
332 SettingsWindowManager::GetInstance()->ShowChromePageForProfile( 332 SettingsWindowManager::GetInstance()->ShowChromePageForProfile(
333 profile, GetSettingsUrl(sub_page_path)); 333 profile, GetSettingsUrl(sub_page_path));
334 return; 334 return;
335 } 335 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 SigninManagerFactory::GetForProfile(original_profile); 455 SigninManagerFactory::GetForProfile(original_profile);
456 DCHECK(manager->IsSigninAllowed()); 456 DCHECK(manager->IsSigninAllowed());
457 if (manager->IsAuthenticated()) 457 if (manager->IsAuthenticated())
458 ShowSettings(browser); 458 ShowSettings(browser);
459 else 459 else
460 ShowBrowserSignin(browser, access_point); 460 ShowBrowserSignin(browser, access_point);
461 } 461 }
462 #endif 462 #endif
463 463
464 } // namespace chrome 464 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698