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

Unified Diff: chrome/browser/ui/webui/settings/md_settings_ui.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/settings/md_settings_ui.cc
diff --git a/chrome/browser/ui/webui/settings/md_settings_ui.cc b/chrome/browser/ui/webui/settings/md_settings_ui.cc
index 2846484261b5b9b23df52328713f1f52da0db380..fdabd2450a4e8eb4d7aa8daf5a532f4f9e1b2565 100644
--- a/chrome/browser/ui/webui/settings/md_settings_ui.cc
+++ b/chrome/browser/ui/webui/settings/md_settings_ui.cc
@@ -8,6 +8,7 @@
#include <string>
+#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/settings/about_handler.h"
@@ -25,6 +26,7 @@
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "chrome/browser/ui/webui/settings/settings_startup_pages_handler.h"
#include "chrome/browser/ui/webui/settings/site_settings_handler.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
@@ -82,8 +84,13 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
AddSettingsPageUIHandler(new SystemHandler());
#endif
+ // Host must be derived from the visible URL, since this might be serving
+ // either chrome://settings or chrome://md-settings.
+ const GURL url = web_ui->GetWebContents()->GetVisibleURL();
+ CHECK(url.GetOrigin() == GURL(chrome::kChromeUISettingsURL).GetOrigin() ||
+ url.GetOrigin() == GURL(chrome::kChromeUIMdSettingsURL).GetOrigin());
content::WebUIDataSource* html_source =
- content::WebUIDataSource::Create(chrome::kChromeUIMdSettingsHost);
+ content::WebUIDataSource::Create(url.host());
#if defined(OS_CHROMEOS)
chromeos::settings::EasyUnlockSettingsHandler* easy_unlock_handler =
« no previous file with comments | « chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc ('k') | chrome/browser/ui/webui/uber/uber_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698