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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/settings/content_settings_handler.h"
6
7 #include "base/bind.h"
8 #include "components/content_settings/core/common/content_settings_types.h"
9 #include "content/public/browser/web_ui.h"
10
11 namespace settings {
12
13 ContentSettingsHandler::ContentSettingsHandler() {
14 }
15
16 ContentSettingsHandler::~ContentSettingsHandler() {
17 }
18
19 void ContentSettingsHandler::RegisterMessages() {
20 web_ui()->RegisterMessageCallback(
21 "fetchContentSettingsData",
22 base::Bind(&ContentSettingsHandler::HandleFetchData,
23 base::Unretained(this)));
24 }
25
26 void ContentSettingsHandler::HandleFetchData(
27 const base::ListValue* args) {
28 CHECK_EQ(2U, args->GetSize());
29 int content_settings_type = -1;
30 CHECK(args->GetInteger(0, &content_settings_type));
31 bool allowedList = false;
Dan Beam 2015/10/10 01:27:40 cpp_var_names_like_this
32 CHECK(args->GetBoolean(1, &allowedList));
33
34 base::ListValue siteList;
35
36 // TODO(finnur): Remove this whole function once site_list.js has been
37 // converted.
38 /*
39 switch (content_settings_type) {
40 case CONTENT_SETTINGS_TYPE_GEOLOCATION: {
41 if (allowedList) {
42 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
43 entry->SetString("url", "http://foo.com");
44 siteList.Append(entry.release());
45 }
46 break;
47 }
48 default: {
49 if (allowedList) {
50 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
51 entry->SetString("url", "http://foo.com");
52 siteList.Append(entry.release());
53
54 scoped_ptr<base::DictionaryValue> entry2(new base::DictionaryValue());
55 entry2->SetString("url", "http://bar.com");
56 siteList.Append(entry2.release());
57 }
58
59 if (!allowedList) {
60 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
61 entry->SetString("url", "http://bar.com");
62 siteList.Append(entry.release());
63 }
64 break;
65 }
66 }
67 */
68
69 web_ui()->CallJavascriptFunction(
70 allowedList
71 ? "Settings.receiveAllowedData"
72 : "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
73 siteList, base::FundamentalValue(true));
74 }
75
76 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698