summaryrefslogtreecommitdiffstats
path: root/chrome/browser/content_setting_image_model.cc
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 10:01:15 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 10:01:15 +0000
commit66053514a93ed317f3cf650a09c8c59a85310cd1 (patch)
tree4cd28fed7ac4e046e67ce9a888a4854b11ce30eb /chrome/browser/content_setting_image_model.cc
parent672a4d48d2ba85ff25f67986d5696a599ab4c405 (diff)
downloadchromium_src-66053514a93ed317f3cf650a09c8c59a85310cd1.zip
chromium_src-66053514a93ed317f3cf650a09c8c59a85310cd1.tar.gz
chromium_src-66053514a93ed317f3cf650a09c8c59a85310cd1.tar.bz2
Revert 55548 - Reland r55382. When blocking cookies, also show an icon in the location bar when cookies are accessed.
If the user choses to block cookies per default, this will grant access to the collected cookies dialog as soon as the page accesses cookies. Right now, the icon is only shown if cookies were actually blocked. BUG=45230 TEST=Canned*.*:ContentSettingImage*.*:TabSpecific*.* Review URL: http://codereview.chromium.org/3014056 Review URL: http://codereview.chromium.org/3148002 TBR=jochen@chromium.org Review URL: http://codereview.chromium.org/3132003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55553 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/content_setting_image_model.cc')
-rw-r--r--chrome/browser/content_setting_image_model.cc62
1 files changed, 11 insertions, 51 deletions
diff --git a/chrome/browser/content_setting_image_model.cc b/chrome/browser/content_setting_image_model.cc
index e45aead..26e349ac 100644
--- a/chrome/browser/content_setting_image_model.cc
+++ b/chrome/browser/content_setting_image_model.cc
@@ -5,11 +5,7 @@
#include "chrome/browser/content_setting_image_model.h"
#include "app/l10n_util.h"
-#include "base/command_line.h"
-#include "chrome/browser/host_content_settings_map.h"
-#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/common/chrome_switches.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -21,10 +17,8 @@ class ContentSettingBlockedImageModel : public ContentSettingImageModel {
virtual void UpdateFromTabContents(const TabContents* tab_contents);
private:
- static const int kAccessedIconIDs[];
static const int kBlockedIconIDs[];
- static const int kAccessedTooltipIDs[];
- static const int kBlockedTooltipIDs[];
+ static const int kTooltipIDs[];
};
class ContentSettingGeolocationImageModel : public ContentSettingImageModel {
@@ -49,29 +43,14 @@ const int ContentSettingBlockedImageModel::kBlockedIconIDs[] = {
IDR_BLOCKED_POPUPS,
};
-const int ContentSettingBlockedImageModel::kAccessedIconIDs[] = {
- IDR_ACCESSED_COOKIES,
- 0,
- 0,
- 0,
- 0,
+const int ContentSettingBlockedImageModel::kTooltipIDs[] = {
+ IDS_BLOCKED_COOKIES_TITLE,
+ IDS_BLOCKED_IMAGES_TITLE,
+ IDS_BLOCKED_JAVASCRIPT_TITLE,
+ IDS_BLOCKED_PLUGINS_TITLE,
+ IDS_BLOCKED_POPUPS_TOOLTIP,
};
-const int ContentSettingBlockedImageModel::kBlockedTooltipIDs[] = {
- IDS_BLOCKED_COOKIES_TITLE,
- IDS_BLOCKED_IMAGES_TITLE,
- IDS_BLOCKED_JAVASCRIPT_TITLE,
- IDS_BLOCKED_PLUGINS_TITLE,
- IDS_BLOCKED_POPUPS_TOOLTIP,
-};
-
-const int ContentSettingBlockedImageModel::kAccessedTooltipIDs[] = {
- IDS_ACCESSED_COOKIES_TITLE,
- 0,
- 0,
- 0,
- 0,
-};
ContentSettingBlockedImageModel::ContentSettingBlockedImageModel(
ContentSettingsType content_settings_type)
@@ -82,33 +61,14 @@ void ContentSettingBlockedImageModel::UpdateFromTabContents(
const TabContents* tab_contents) {
TabSpecificContentSettings* content_settings = tab_contents ?
tab_contents->GetTabSpecificContentSettings() : NULL;
- const int* icon_ids;
- const int* tooltip_ids;
-
- if (!content_settings) {
- set_visible(false);
- return;
- }
- if (content_settings->IsContentBlocked(get_content_settings_type())) {
- icon_ids = kBlockedIconIDs;
- tooltip_ids = kBlockedTooltipIDs;
- } else if (!CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableCookiePrompt) &&
- tab_contents->profile()->GetHostContentSettingsMap()->
- GetDefaultContentSetting(get_content_settings_type()) ==
- CONTENT_SETTING_BLOCK &&
- content_settings->IsContentAccessed(get_content_settings_type())) {
- // If a content type is blocked by default and was accessed, display the
- // accessed icon.
- icon_ids = kAccessedIconIDs;
- tooltip_ids = kAccessedTooltipIDs;
- } else {
+ if (!content_settings ||
+ !content_settings->IsContentBlocked(get_content_settings_type())) {
set_visible(false);
return;
}
- set_icon(icon_ids[get_content_settings_type()]);
+ set_icon(kBlockedIconIDs[get_content_settings_type()]);
set_tooltip(
- l10n_util::GetStringUTF8(tooltip_ids[get_content_settings_type()]));
+ l10n_util::GetStringUTF8(kTooltipIDs[get_content_settings_type()]));
set_visible(true);
}