summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/location_bar_view_mac.mm
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-10 13:10:03 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-10 13:10:03 +0000
commitd818e07fb7b4e680de9a38ad7af55ba04acb2cbf (patch)
tree6be52cdcff66f0c5972ce80feef7dbcf392ad899 /chrome/browser/cocoa/location_bar_view_mac.mm
parentd267ee95429eca5bff2e2d499725ca222848a1cf (diff)
downloadchromium_src-d818e07fb7b4e680de9a38ad7af55ba04acb2cbf.zip
chromium_src-d818e07fb7b4e680de9a38ad7af55ba04acb2cbf.tar.gz
chromium_src-d818e07fb7b4e680de9a38ad7af55ba04acb2cbf.tar.bz2
Remove poll'n'loop code from extension_browsertest.cc.
Also use a common wait function from extension_browsertest in the page action popup test. BUG=34339 TEST=browser_tests Review URL: http://codereview.chromium.org/582013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/location_bar_view_mac.mm')
-rw-r--r--chrome/browser/cocoa/location_bar_view_mac.mm41
1 files changed, 22 insertions, 19 deletions
diff --git a/chrome/browser/cocoa/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar_view_mac.mm
index eca15f9..fca4078 100644
--- a/chrome/browser/cocoa/location_bar_view_mac.mm
+++ b/chrome/browser/cocoa/location_bar_view_mac.mm
@@ -154,12 +154,26 @@ void LocationBarViewMac::UpdateContentBlockedIcons() {
}
void LocationBarViewMac::UpdatePageActions() {
+ size_t count_before = page_action_views_.Count();
page_action_views_.RefreshViews();
[field_ resetFieldEditorFrameIfNeeded];
+ if (page_action_views_.Count() != count_before) {
+ NotificationService::current()->Notify(
+ NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED,
+ Source<LocationBar>(this),
+ NotificationService::NoDetails());
+ }
}
void LocationBarViewMac::InvalidatePageActions() {
+ size_t count_before = page_action_views_.Count();
page_action_views_.DeleteAll();
+ if (page_action_views_.Count() != count_before) {
+ NotificationService::current()->Notify(
+ NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED,
+ Source<LocationBar>(this),
+ NotificationService::NoDetails());
+ }
}
void LocationBarViewMac::SaveStateToContents(TabContents* contents) {
@@ -353,11 +367,6 @@ void LocationBarViewMac::SetPreviewEnabledPageAction(
page_action_image_view->set_preview_enabled(preview_enabled);
page_action_image_view->UpdateVisibility(contents,
GURL(WideToUTF8(toolbar_model_->GetText())));
-
- NotificationService::current()->Notify(
- NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED,
- Source<ExtensionAction>(page_action),
- Details<TabContents>(contents));
}
size_t LocationBarViewMac::GetPageActionIndex(ExtensionAction* page_action) {
@@ -722,7 +731,13 @@ void LocationBarViewMac::PageActionImageView::UpdateVisibility(
if (!skia_icon.isNull())
SetImage(gfx::SkBitmapToNSImage(skia_icon));
}
- SetVisible(visible);
+ if (IsVisible() != visible) {
+ SetVisible(visible);
+ NotificationService::current()->Notify(
+ NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED,
+ Source<ExtensionAction>(page_action_),
+ Details<TabContents>(contents));
+ }
}
void LocationBarViewMac::PageActionImageView::SetToolTip(NSString* tooltip) {
@@ -809,20 +824,8 @@ void LocationBarViewMac::PageActionViewList::RefreshViews() {
return;
GURL url = GURL(WideToUTF8(toolbar_model_->GetText()));
- for (size_t i = 0; i < views_.size(); ++i) {
+ for (size_t i = 0; i < views_.size(); ++i)
views_[i]->UpdateVisibility(contents, url);
- // Fire the notification regardless of the visibility changes to trigger a
- // redraw and tooltip update.
- // TODO(andybons): This notification is fired on all platforms but never
- // actually used outside of the Mac implementation and one unit test. Either
- // update it to reflect a change to the extension view as a whole, or remove
- // it. http://crbug.com/34339
- ExtensionAction* action = views_[i]->page_action();
- NotificationService::current()->Notify(
- NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED,
- Source<ExtensionAction>(action),
- Details<TabContents>(contents));
- }
}
LocationBarViewMac::PageActionImageView*