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-10 07:13:06 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 07:13:06 +0000
commitd0ce4e6276eb30ec7b3957c10d42caacc51ac583 (patch)
treeeeadaa4f34325d6985e21a69babe7a963ea1d2e4 /chrome/browser/content_setting_bubble_model.cc
parente8dd1b272971bdf556b84a599fa4edaa33367191 (diff)
downloadchromium_src-d0ce4e6276eb30ec7b3957c10d42caacc51ac583.zip
chromium_src-d0ce4e6276eb30ec7b3957c10d42caacc51ac583.tar.gz
chromium_src-d0ce4e6276eb30ec7b3957c10d42caacc51ac583.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*.*:ContentSettingImage*.*:TabSpecific*.* Review URL: http://codereview.chromium.org/3014056 Review URL: http://codereview.chromium.org/3146003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55536 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 6c1c13b..8f83f02 100644
--- a/chrome/browser/content_setting_bubble_model.cc
+++ b/chrome/browser/content_setting_bubble_model.cc
@@ -14,6 +14,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"
@@ -33,7 +34,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,
@@ -42,10 +43,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() {