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

Unified Diff: chrome/browser/ui/webui/settings/content_settings_handler.cc

Issue 1372053002: Flesh out the location-page class to make it more general. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 5 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/webui/settings/content_settings_handler.cc
diff --git a/chrome/browser/ui/webui/settings/content_settings_handler.cc b/chrome/browser/ui/webui/settings/content_settings_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a458964f3a04326a3827189a08a9c1587e7a16c8
--- /dev/null
+++ b/chrome/browser/ui/webui/settings/content_settings_handler.cc
@@ -0,0 +1,76 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/settings/content_settings_handler.h"
+
+#include "base/bind.h"
+#include "components/content_settings/core/common/content_settings_types.h"
+#include "content/public/browser/web_ui.h"
+
+namespace settings {
+
+ContentSettingsHandler::ContentSettingsHandler() {
+}
+
+ContentSettingsHandler::~ContentSettingsHandler() {
+}
+
+void ContentSettingsHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback(
+ "fetchContentSettingsData",
+ base::Bind(&ContentSettingsHandler::HandleFetchData,
+ base::Unretained(this)));
+}
+
+void ContentSettingsHandler::HandleFetchData(
+ const base::ListValue* args) {
+ CHECK_EQ(2U, args->GetSize());
+ int content_settings_type = -1;
+ CHECK(args->GetInteger(0, &content_settings_type));
+ bool allowedList = false;
Dan Beam 2015/10/10 01:27:40 cpp_var_names_like_this
+ CHECK(args->GetBoolean(1, &allowedList));
+
+ base::ListValue siteList;
+
+ // TODO(finnur): Remove this whole function once site_list.js has been
+ // converted.
+/*
+ switch (content_settings_type) {
+ case CONTENT_SETTINGS_TYPE_GEOLOCATION: {
+ if (allowedList) {
+ scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
+ entry->SetString("url", "http://foo.com");
+ siteList.Append(entry.release());
+ }
+ break;
+ }
+ default: {
+ if (allowedList) {
+ scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
+ entry->SetString("url", "http://foo.com");
+ siteList.Append(entry.release());
+
+ scoped_ptr<base::DictionaryValue> entry2(new base::DictionaryValue());
+ entry2->SetString("url", "http://bar.com");
+ siteList.Append(entry2.release());
+ }
+
+ if (!allowedList) {
+ scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
+ entry->SetString("url", "http://bar.com");
+ siteList.Append(entry.release());
+ }
+ break;
+ }
+ }
+*/
+
+ web_ui()->CallJavascriptFunction(
+ allowedList
+ ? "Settings.receiveAllowedData"
+ : "Settings.receiveBlockedData",
Dan Beam 2015/10/10 01:27:41 why does it matter which one is called currently?
Finnur 2015/10/15 15:46:33 I found that if two polymer objects try to setup a
+ siteList, base::FundamentalValue(true));
+}
+
+} // namespace settings

Powered by Google App Engine
This is Rietveld 408576698