summaryrefslogtreecommitdiffstats
path: root/chrome/browser/content_setting_bubble_model.cc
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 08:55:18 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 08:55:18 +0000
commitdcd5b33317e700f4dbce32122bcdc1da5a31ae8d (patch)
tree2965fe27f9f8458bf2938e1ad148aa40547c2549 /chrome/browser/content_setting_bubble_model.cc
parent5d9a4f7781c7d4871238400e1dbeb72fc533570b (diff)
downloadchromium_src-dcd5b33317e700f4dbce32122bcdc1da5a31ae8d.zip
chromium_src-dcd5b33317e700f4dbce32122bcdc1da5a31ae8d.tar.gz
chromium_src-dcd5b33317e700f4dbce32122bcdc1da5a31ae8d.tar.bz2
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*.*:ContentSetting*.*:TabSpecific*.* Review URL: http://codereview.chromium.org/3014056 Review URL: http://codereview.chromium.org/3121007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55692 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/content_setting_bubble_model.cc')
-rw-r--r--chrome/browser/content_setting_bubble_model.cc29
1 files changed, 25 insertions, 4 deletions
diff --git a/chrome/browser/content_setting_bubble_model.cc b/chrome/browser/content_setting_bubble_model.cc
index e73b37a..7fc7462 100644
--- a/chrome/browser/content_setting_bubble_model.cc
+++ b/chrome/browser/content_setting_bubble_model.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
+#include "chrome/browser/tab_contents/tab_specific_content_settings.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
@@ -34,7 +35,7 @@ class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel {
private:
void SetTitle() {
- static const int kTitleIDs[] = {
+ static const int kBlockedTitleIDs[] = {
IDS_BLOCKED_COOKIES_TITLE,
IDS_BLOCKED_IMAGES_TITLE,
IDS_BLOCKED_JAVASCRIPT_TITLE,
@@ -43,10 +44,30 @@ class ContentSettingTitleAndLinkModel : public ContentSettingBubbleModel {
0, // Geolocation does not have an overall title.
0, // Notifications do not have a bubble.
};
- COMPILE_ASSERT(arraysize(kTitleIDs) == CONTENT_SETTINGS_NUM_TYPES,
+ static const int kAccessedTitleIDs[] = {
+ IDS_ACCESSED_COOKIES_TITLE,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ };
+ COMPILE_ASSERT(arraysize(kAccessedTitleIDs) == CONTENT_SETTINGS_NUM_TYPES,
+ Need_a_setting_for_every_content_settings_type);
+ COMPILE_ASSERT(arraysize(kBlockedTitleIDs) == CONTENT_SETTINGS_NUM_TYPES,
Need_a_setting_for_every_content_settings_type);
- if (kTitleIDs[content_type()])
- set_title(l10n_util::GetStringUTF8(kTitleIDs[content_type()]));
+ const int *title_ids = kBlockedTitleIDs;
+ if (tab_contents() &&
+ tab_contents()->GetTabSpecificContentSettings()->IsContentAccessed(
+ content_type()) &&
+ !tab_contents()->GetTabSpecificContentSettings()->IsContentBlocked(
+ content_type()) &&
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableCookiePrompt))
+ title_ids = kAccessedTitleIDs;
+ if (title_ids[content_type()])
+ set_title(l10n_util::GetStringUTF8(title_ids[content_type()]));
}
void SetManageLink() {