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

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

Issue 2454093003: MD Settings: Update Content Settings Types URLs. (Closed)
Patch Set: 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 0d4739ee8c6dc5a68cf49c0a4b2d34ed6ac0683a..def144721924a743358ecc10118c60774c57631a 100644
--- a/chrome/browser/ui/chrome_pages.cc
+++ b/chrome/browser/ui/chrome_pages.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include "base/command_line.h"
+#include "base/feature_list.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
@@ -27,6 +28,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"
@@ -133,9 +135,38 @@ void ShowHelpImpl(Browser* browser, Profile* profile, HelpSource source) {
#endif
}
+// 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.
+const site_settings::ContentSettingsTypeNameEntry
Peter Kasting 2016/10/28 21:13:34 Nit: Scope this kind of a constant inside the func
tommycli 2016/10/28 21:57:13 Done.
+ kSettingsContentTypePathOverrides[] = {
Dan Beam 2016/10/27 23:44:41 why are these "Override"s?
tommycli 2016/10/28 00:01:24 They override the group names that have been used
+ {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"},
+};
+
std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) {
- return kContentSettingsExceptionsSubPage + std::string(kHashMark) +
- site_settings::ContentSettingsTypeToGroupName(type);
+ if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) {
Peter Kasting 2016/10/28 21:13:34 Nit: If you reverse this condition, the body effec
tommycli 2016/10/28 21:57:13 Done.
+ // In MD Settings, the exceptions no longer have a separate subpage.
+ std::string content_type_path =
+ site_settings::ContentSettingsTypeToGroupName(type);
+ for (size_t i = 0; i < arraysize(kSettingsContentTypePathOverrides); ++i) {
Peter Kasting 2016/10/28 21:13:34 Nit: Personally I would find it more intuitive her
tommycli 2016/10/28 21:57:13 Done.
+ if (type == kSettingsContentTypePathOverrides[i].type)
+ content_type_path = kSettingsContentTypePathOverrides[i].name;
+ }
+
+ return std::string(kContentSettingsSubPage) + "/" + content_type_path;
+ } else {
Peter Kasting 2016/10/28 21:13:34 Nit: No else after return.
tommycli 2016/10/28 21:57:13 Done.
+ return kDeprecatedOptionsContentSettingsExceptionsSubPage +
+ std::string(kHashMark) +
+ site_settings::ContentSettingsTypeToGroupName(type);
+ }
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698