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 08:27:52 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 08:27:52 +0000
commit64ec3d13abf89f523f5d834a3dddb76e115bdf88 (patch)
tree80ca491a9e61ff35ad2edbda8bace09dd98c5681 /chrome/browser/content_setting_image_model.cc
parent5699b94105b6a97b528837f5ae5278deeb461b84 (diff)
downloadchromium_src-64ec3d13abf89f523f5d834a3dddb76e115bdf88.zip
chromium_src-64ec3d13abf89f523f5d834a3dddb76e115bdf88.tar.gz
chromium_src-64ec3d13abf89f523f5d834a3dddb76e115bdf88.tar.bz2
Revert 55536 - 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/3146003 TBR=jochen@chromium.org Review URL: http://codereview.chromium.org/3127002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55540 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);
}