diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-10 09:39:48 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-10 09:39:48 +0000 |
commit | b2d8f363a11f1e674eb14a297d0a20c3b2134906 (patch) | |
tree | c57623fe575da463685e426ebed7e68d773b67ab /chrome/browser/cocoa/location_bar | |
parent | 7c64b2dd993a3835e4d9e7934e235d11846c143e (diff) | |
download | chromium_src-b2d8f363a11f1e674eb14a297d0a20c3b2134906.zip chromium_src-b2d8f363a11f1e674eb14a297d0a20c3b2134906.tar.gz chromium_src-b2d8f363a11f1e674eb14a297d0a20c3b2134906.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/3148002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55548 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/location_bar')
-rw-r--r-- | chrome/browser/cocoa/location_bar/location_bar_view_mac.h | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/location_bar/location_bar_view_mac.mm | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/chrome/browser/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/cocoa/location_bar/location_bar_view_mac.h index 7c1db4e..2400252 100644 --- a/chrome/browser/cocoa/location_bar/location_bar_view_mac.h +++ b/chrome/browser/cocoa/location_bar/location_bar_view_mac.h @@ -158,7 +158,7 @@ class LocationBarViewMac : public AutocompleteEditController, // Updates visibility of the content settings icons based on the current // tab contents state. - void RefreshContentSettingsDecorations(); + bool RefreshContentSettingsDecorations(); void ShowFirstRunBubbleInternal(FirstRun::BubbleType bubble_type); diff --git a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm index 32d021c..585cf35 100644 --- a/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/cocoa/location_bar/location_bar_view_mac.mm @@ -144,9 +144,10 @@ void LocationBarViewMac::FocusSearch() { } void LocationBarViewMac::UpdateContentSettingsIcons() { - RefreshContentSettingsDecorations(); - [field_ updateCursorAndToolTipRects]; - [field_ setNeedsDisplay:YES]; + if (RefreshContentSettingsDecorations()) { + [field_ updateCursorAndToolTipRects]; + [field_ setNeedsDisplay:YES]; + } } void LocationBarViewMac::UpdatePageActions() { @@ -429,13 +430,20 @@ void LocationBarViewMac::PostNotification(NSString* notification) { object:[NSValue valueWithPointer:this]]; } -void LocationBarViewMac::RefreshContentSettingsDecorations() { +bool LocationBarViewMac::RefreshContentSettingsDecorations() { const bool input_in_progress = toolbar_model_->input_in_progress(); const TabContents* tab_contents = input_in_progress ? NULL : browser_->GetSelectedTabContents(); + bool icons_updated = false; for (size_t i = 0; i < content_setting_decorations_.size(); ++i) { + bool was_visible = content_setting_decorations_[i]->is_visible(); + int old_icon = content_setting_decorations_[i]->get_icon(); content_setting_decorations_[i]->UpdateFromTabContents(tab_contents); + if (was_visible != content_setting_decorations_[i]->is_visible() || + old_icon != content_setting_decorations_[i]->get_icon()) + icons_updated = true; } + return icons_updated; } void LocationBarViewMac::DeletePageActionDecorations() { |