Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Unified Diff: chrome/browser/cocoa/bookmark_bar_controller.mm

Issue 2805099: Pulse new bookmarks (as triggered by bookmark bubble). If not possible, ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/cocoa/bookmark_bar_controller_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/bookmark_bar_controller.mm
===================================================================
--- chrome/browser/cocoa/bookmark_bar_controller.mm (revision 53704)
+++ chrome/browser/cocoa/bookmark_bar_controller.mm (working copy)
@@ -228,12 +228,16 @@
folderImage_.reset([rb.GetNSImageNamed(IDR_BOOKMARK_BAR_FOLDER) retain]);
defaultImage_.reset([rb.GetNSImageNamed(IDR_DEFAULT_FAVICON) retain]);
- // Register for theme changes.
+ // Register for theme changes, bookmark button pulsing, ...
NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter];
[defaultCenter addObserver:self
selector:@selector(themeDidChangeNotification:)
name:kBrowserThemeDidChangeNotification
object:nil];
+ [defaultCenter addObserver:self
+ selector:@selector(pulseBookmarkNotification:)
+ name:bookmark_button::kPulseBookmarkButtonNotification
+ object:nil];
// This call triggers an awakeFromNib, which builds the bar, which
// might uses folderImage_. So make sure it happens after
@@ -243,6 +247,40 @@
return self;
}
+- (void)pulseBookmarkNotification:(NSNotification*)notification {
+ NSDictionary* dict = [notification userInfo];
+ const BookmarkNode* node = NULL;
+ NSValue *value = [dict objectForKey:bookmark_button::kBookmarkKey];
+ DCHECK(value);
+ if (value)
+ node = static_cast<const BookmarkNode*>([value pointerValue]);
+ NSNumber* number = [dict
+ objectForKey:bookmark_button::kBookmarkPulseFlagKey];
+ DCHECK(number);
+ BOOL doPulse = number ? [number boolValue] : NO;
+
+ // 3 cases:
+ // button on the bar: flash it
+ // button in "other bookmarks" folder: flash other bookmarks
+ // button in "off the side" folder: flash the chevron
+ for (BookmarkButton* button in [self buttons]) {
+ if ([button bookmarkNode] == node) {
+ [button setIsContinuousPulsing:doPulse];
+ return;
+ }
+ }
+ if ([otherBookmarksButton_ bookmarkNode] == node) {
+ [otherBookmarksButton_ setIsContinuousPulsing:doPulse];
+ return;
+ }
+ if (node->GetParent() == bookmarkModel_->GetBookmarkBarNode()) {
+ [offTheSideButton_ setIsContinuousPulsing:doPulse];
+ return;
+ }
+
+ NOTREACHED() << "no bookmark button found to pulse!";
+}
+
- (void)dealloc {
// We better stop any in-flight animation if we're being killed.
[[self animatableView] stopAnimation];
« no previous file with comments | « no previous file | chrome/browser/cocoa/bookmark_bar_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698