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

Unified Diff: chrome/browser/ui/chrome_pages.cc

Issue 2454093003: MD Settings: Update Content Settings Types URLs. (Closed)
Patch Set: address pkasting comments Created 4 years, 2 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/chrome_pages.cc
diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc
index fd5593c6fe2e21e4e53bc3f471e60e544237edc6..443970abfb188bad281eaeeca273b7bcefbd86c1 100644
--- a/chrome/browser/ui/chrome_pages.cc
+++ b/chrome/browser/ui/chrome_pages.cc
@@ -7,7 +7,9 @@
#include <stddef.h>
#include "base/command_line.h"
+#include "base/feature_list.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
@@ -27,6 +29,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/options/content_settings_handler.h"
#include "chrome/browser/ui/webui/site_settings_helper.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "components/signin/core/browser/signin_header_helper.h"
@@ -138,8 +141,36 @@ void ShowHelpImpl(Browser* browser, Profile* profile, HelpSource source) {
}
std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) {
- return kContentSettingsExceptionsSubPage + std::string(kHashMark) +
- site_settings::ContentSettingsTypeToGroupName(type);
+ if (!base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) {
+ return kDeprecatedOptionsContentSettingsExceptionsSubPage +
+ std::string(kHashMark) +
+ site_settings::ContentSettingsTypeToGroupName(type);
+ }
+
+ // In MD Settings, the exceptions no longer have a separate subpage.
+ // This list overrides the group names defined in site_settings_helper for the
+ // purposes of URL generation for MD Settings only. We need this because some
+ // of the old group names are no longer appropriate: i.e. "plugins" =>
+ // "flash".
+ //
+ // TODO(tommycli): Update the group names defined in site_settings_helper once
+ // Options is removed from Chrome. Then this list will no longer be needed.
+ typedef std::map<ContentSettingsType, std::string> ContentSettingPathMap;
+ CR_DEFINE_STATIC_LOCAL(
+ ContentSettingPathMap, kSettingsPathOverrides,
+ ({{CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "automaticDownloads"},
+ {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, "backgroundSync"},
+ {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "microphone"},
+ {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "camera"},
+ {CONTENT_SETTINGS_TYPE_PLUGINS, "flash"},
+ {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "unsandboxedPlugins"}}));
+ const auto it = kSettingsPathOverrides.find(type);
+ const std::string content_type_path =
+ (it == kSettingsPathOverrides.end())
+ ? site_settings::ContentSettingsTypeToGroupName(type)
+ : it->second;
+
+ return std::string(kContentSettingsSubPage) + "/" + content_type_path;
}
#if defined(OS_CHROMEOS)
« no previous file with comments | « chrome/browser/ui/browser_navigator_browsertest.cc ('k') | chrome/browser/ui/webui/bidi_checker_web_ui_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698