summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd15
-rw-r--r--chrome/browser/content_settings/content_settings_pref_provider.cc3
-rw-r--r--chrome/browser/content_settings/host_content_settings_map.cc7
-rw-r--r--chrome/browser/content_settings/host_content_settings_map_unittest.cc6
-rw-r--r--chrome/browser/resources/options/content_settings.html26
-rw-r--r--chrome/browser/resources/options/content_settings.js5
-rw-r--r--chrome/browser/resources/options/content_settings_exceptions_area.html3
-rw-r--r--chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm5
-rw-r--r--chrome/browser/ui/webui/options/content_settings_handler.cc10
-rw-r--r--chrome/common/content_settings_types.h1
10 files changed, 78 insertions, 3 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 2e26ef0..155801e 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -5636,6 +5636,21 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_NOTIFICATIONS_ASK_RADIO" desc="A radio button in Content Settings dialog to configure notifications per-site.">
Ask me when a site wants to show desktop notifications (recommended)
</message>
+ <message name="IDS_INTENTS_TAB_LABEL" desc="Label for Intents Windows tab on Content Settings dialog">
+ Web Intents
+ </message>
+ <message name="IDS_INTENTS_HEADER" desc="Header for intent exception management page on Content Settings dialog">
+ Web Intents Exceptions
+ </message>
+ <message name="IDS_INTENTS_ALLOW_RADIO" desc="A radio button in the Content Settings dialog for allowing intents to register themselves on all sites.">
+ Allow all sites to register intents
+ </message>
+ <message name="IDS_INTENTS_BLOCK_RADIO" desc="A radio button in the Content Settings dialog for preventing intents to register themselves on any sites.">
+ Do not allow any site to register intents
+ </message>
+ <message name="IDS_INTENTS_ASK_RADIO" desc="A radio button in Content Settings dialog to configure web-intents per-site.">
+ Ask me when a site wants to register intents (recommended)
+ </message>
<message name="IDS_EXCEPTIONS_HOSTNAME_HEADER" desc="A column header for the hostname column of the cookie/image/javascript/plugins exceptions dialog">
Site
</message>
diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc
index a7f62fa..4a896b3 100644
--- a/chrome/browser/content_settings/content_settings_pref_provider.cc
+++ b/chrome/browser/content_settings/content_settings_pref_provider.cc
@@ -44,6 +44,7 @@ const char* kResourceTypeNames[] = {
NULL,
NULL,
NULL, // Not used for Notifications
+ NULL, // Not used for Intents.
};
COMPILE_ASSERT(arraysize(kResourceTypeNames) == CONTENT_SETTINGS_NUM_TYPES,
resource_type_names_incorrect_size);
@@ -57,6 +58,7 @@ const ContentSetting kDefaultSettings[] = {
CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS
CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_GEOLOCATION
CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS
+ CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_INTENTS
};
COMPILE_ASSERT(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES,
default_settings_incorrect_size);
@@ -72,6 +74,7 @@ const char* kTypeNames[] = {
// TODO(markusheintz): Refactoring in progress. Content settings exceptions
// for notifications added next.
"notifications", // Only used for default Notifications settings.
+ "intents",
};
COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES,
type_names_incorrect_size);
diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc
index 4bdb243..3d15073 100644
--- a/chrome/browser/content_settings/host_content_settings_map.cc
+++ b/chrome/browser/content_settings/host_content_settings_map.cc
@@ -407,6 +407,12 @@ void HostContentSettingsMap::ClearSettingsForOneType(
// static
bool HostContentSettingsMap::IsSettingAllowedForType(
ContentSetting setting, ContentSettingsType content_type) {
+ // Intents content settings are hidden behind a switch for now.
+ if (content_type == CONTENT_SETTINGS_TYPE_INTENTS &&
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableWebIntents))
+ return false;
+
// DEFAULT, ALLOW and BLOCK are always allowed.
if (setting == CONTENT_SETTING_DEFAULT ||
setting == CONTENT_SETTING_ALLOW ||
@@ -422,6 +428,7 @@ bool HostContentSettingsMap::IsSettingAllowedForType(
switches::kEnableClickToPlay));
case CONTENT_SETTINGS_TYPE_GEOLOCATION:
case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
+ case CONTENT_SETTINGS_TYPE_INTENTS:
return (setting == CONTENT_SETTING_ASK);
default:
return false;
diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
index e78baa4..b2623fc 100644
--- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -150,6 +150,8 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
CONTENT_SETTING_ASK;
desired_settings.settings[CONTENT_SETTINGS_TYPE_NOTIFICATIONS] =
CONTENT_SETTING_ASK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_INTENTS] =
+ CONTENT_SETTING_ASK;
ContentSettings settings =
host_content_settings_map->GetContentSettings(host, host);
EXPECT_TRUE(SettingsEqual(desired_settings, settings));
@@ -596,6 +598,8 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
CONTENT_SETTING_ASK;
desired_settings.settings[CONTENT_SETTINGS_TYPE_NOTIFICATIONS] =
CONTENT_SETTING_ASK;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_INTENTS] =
+ CONTENT_SETTING_ASK;
ContentSettings settings =
host_content_settings_map->GetContentSettings(host, host);
EXPECT_TRUE(SettingsEqual(desired_settings, settings));
@@ -611,6 +615,8 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
settings.settings[CONTENT_SETTINGS_TYPE_GEOLOCATION]);
EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_COOKIES],
settings.settings[CONTENT_SETTINGS_TYPE_COOKIES]);
+ EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_INTENTS],
+ settings.settings[CONTENT_SETTINGS_TYPE_INTENTS]);
}
TEST_F(HostContentSettingsMapTest, OffTheRecord) {
diff --git a/chrome/browser/resources/options/content_settings.html b/chrome/browser/resources/options/content_settings.html
index 12af626..ea1fb11 100644
--- a/chrome/browser/resources/options/content_settings.html
+++ b/chrome/browser/resources/options/content_settings.html
@@ -211,5 +211,31 @@
i18n-content="manage_exceptions"></button>
</div>
</section>
+ <!-- Intent registration filter tab contents -->
+ <section id="intent-filter">
+ <h3 i18n-content="intentsTabLabel" class="content-settings-header"></h3>
+ <div>
+ <div class="radio">
+ <label>
+ <input type="radio" name="intents" value="allow">
+ <span i18n-content="intentsAllow"></span>
+ </label>
+ </div>
+ <div class="radio">
+ <label>
+ <input type="radio" name="intents" value="ask">
+ <span i18n-content="intentsAsk"></span>
+ </label>
+ </div>
+ <div class="radio">
+ <label>
+ <input type="radio" name="intents" value="block">
+ <span i18n-content="intentsBlock"></span>
+ </label>
+ </div>
+ <button class="exceptions-list-button" contentType="intents"
+ i18n-content="manage_exceptions"></button>
+ </div>
+ </section>
</div>
</div>
diff --git a/chrome/browser/resources/options/content_settings.js b/chrome/browser/resources/options/content_settings.js
index bc917cd..08c6015 100644
--- a/chrome/browser/resources/options/content_settings.js
+++ b/chrome/browser/resources/options/content_settings.js
@@ -60,7 +60,10 @@ cr.define('options', function() {
};
if (!templateData.enable_click_to_play)
- $('click_to_play').style.display = 'none';
+ $('click_to_play').hidden = true;
+
+ if (!templateData.enable_web_intents)
+ $('intent-filter').hidden = true;
},
};
diff --git a/chrome/browser/resources/options/content_settings_exceptions_area.html b/chrome/browser/resources/options/content_settings_exceptions_area.html
index 043c4e9..285645f 100644
--- a/chrome/browser/resources/options/content_settings_exceptions_area.html
+++ b/chrome/browser/resources/options/content_settings_exceptions_area.html
@@ -56,4 +56,7 @@
<div contentType="notifications">
<list mode="normal"></list>
</div>
+ <div contentType="intents">
+ <list mode="normal"></list>
+ </div>
</div>
diff --git a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm
index 8cfd2d3..f69ece5 100644
--- a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm
+++ b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm
@@ -55,8 +55,9 @@ ContentSettingBubbleControllerTest::~ContentSettingBubbleControllerTest() {
// Check that the bubble doesn't crash or leak for any settings type
TEST_F(ContentSettingBubbleControllerTest, Init) {
for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
- if (i == CONTENT_SETTINGS_TYPE_NOTIFICATIONS)
- continue; // Notifications have no bubble.
+ if (i == CONTENT_SETTINGS_TYPE_NOTIFICATIONS ||
+ i == CONTENT_SETTINGS_TYPE_INTENTS)
+ continue; // Notifications and web intents have no bubble.
ContentSettingsType settingsType = static_cast<ContentSettingsType>(i);
diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc
index 0992400..6ef0239 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -60,6 +60,7 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
{CONTENT_SETTINGS_TYPE_POPUPS, "popups"},
{CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"},
{CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"},
+ {CONTENT_SETTINGS_TYPE_INTENTS, "intents"},
};
ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name) {
@@ -247,6 +248,12 @@ void ContentSettingsHandler::GetLocalizedValues(
{ "notifications_allow", IDS_NOTIFICATIONS_ALLOW_RADIO },
{ "notifications_ask", IDS_NOTIFICATIONS_ASK_RADIO },
{ "notifications_block", IDS_NOTIFICATIONS_BLOCK_RADIO },
+ // Intents filter.
+ { "intentsTabLabel", IDS_INTENTS_TAB_LABEL },
+ { "intentsAllow", IDS_INTENTS_ALLOW_RADIO },
+ { "intentsAsk", IDS_INTENTS_ASK_RADIO },
+ { "intentsBlock", IDS_INTENTS_BLOCK_RADIO },
+ { "intents_header", IDS_INTENTS_HEADER },
};
RegisterStrings(localized_strings, resources, arraysize(resources));
@@ -255,6 +262,9 @@ void ContentSettingsHandler::GetLocalizedValues(
localized_strings->SetBoolean("enable_click_to_play",
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableClickToPlay));
+ localized_strings->SetBoolean("enable_web_intents",
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableWebIntents));
}
void ContentSettingsHandler::Initialize() {
diff --git a/chrome/common/content_settings_types.h b/chrome/common/content_settings_types.h
index f9ac455..4c450ea 100644
--- a/chrome/common/content_settings_types.h
+++ b/chrome/common/content_settings_types.h
@@ -19,6 +19,7 @@ enum ContentSettingsType {
CONTENT_SETTINGS_TYPE_POPUPS,
CONTENT_SETTINGS_TYPE_GEOLOCATION,
CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ CONTENT_SETTINGS_TYPE_INTENTS,
CONTENT_SETTINGS_NUM_TYPES
};