| Index: chrome/browser/cocoa/bookmark_bubble_controller.mm
|
| ===================================================================
|
| --- chrome/browser/cocoa/bookmark_bubble_controller.mm (revision 53704)
|
| +++ chrome/browser/cocoa/bookmark_bubble_controller.mm (working copy)
|
| @@ -7,6 +7,7 @@
|
| #include "base/mac_util.h"
|
| #include "base/sys_string_conversions.h"
|
| #include "chrome/browser/bookmarks/bookmark_model.h"
|
| +#import "chrome/browser/cocoa/bookmark_button.h"
|
| #import "chrome/browser/cocoa/browser_window_controller.h"
|
| #import "chrome/browser/cocoa/info_bubble_view.h"
|
| #include "chrome/browser/metrics/user_metrics.h"
|
| @@ -108,6 +109,46 @@
|
| [super dealloc];
|
| }
|
|
|
| +// If this is a new bookmark somewhere visible (e.g. on the bookmark
|
| +// bar), pulse it. Else, call ourself recursively with our parent
|
| +// until we find something visible to pulse.
|
| +- (void)startPulsingBookmarkButton:(const BookmarkNode*)node {
|
| + while (node) {
|
| + if ((node->GetParent() == model_->GetBookmarkBarNode()) ||
|
| + (node == model_->other_node())) {
|
| + pulsingBookmarkNode_ = node;
|
| + NSValue *value = [NSValue valueWithPointer:node];
|
| + NSDictionary *dict = [NSDictionary
|
| + dictionaryWithObjectsAndKeys:value,
|
| + bookmark_button::kBookmarkKey,
|
| + [NSNumber numberWithBool:YES],
|
| + bookmark_button::kBookmarkPulseFlagKey,
|
| + nil];
|
| + [[NSNotificationCenter defaultCenter]
|
| + postNotificationName:bookmark_button::kPulseBookmarkButtonNotification
|
| + object:self
|
| + userInfo:dict];
|
| + return;
|
| + }
|
| + node = node->GetParent();
|
| + }
|
| +}
|
| +
|
| +- (void)stopPulsingBookmarkButton {
|
| + NSValue *value = [NSValue valueWithPointer:pulsingBookmarkNode_];
|
| + pulsingBookmarkNode_ = NULL;
|
| + NSDictionary *dict = [NSDictionary
|
| + dictionaryWithObjectsAndKeys:value,
|
| + bookmark_button::kBookmarkKey,
|
| + [NSNumber numberWithBool:NO],
|
| + bookmark_button::kBookmarkPulseFlagKey,
|
| + nil];
|
| + [[NSNotificationCenter defaultCenter]
|
| + postNotificationName:bookmark_button::kPulseBookmarkButtonNotification
|
| + object:self
|
| + userInfo:dict];
|
| +}
|
| +
|
| // Close the bookmark bubble without changing anything. Unlike a
|
| // typical dialog's OK/Cancel, where Cancel is "do nothing", all
|
| // buttons on the bubble have the capacity to change the bookmark
|
| @@ -126,6 +167,7 @@
|
| [[NSNotificationCenter defaultCenter] removeObserver:self];
|
| bookmark_observer_.reset(NULL);
|
| chrome_observer_.reset(NULL);
|
| + [self stopPulsingBookmarkButton];
|
| [self autorelease];
|
| }
|
|
|
| @@ -173,6 +215,9 @@
|
| chrome_observer_.reset(new BookmarkBubbleNotificationBridge(
|
| self, @selector(dismissWithoutEditing:)));
|
|
|
| + // Pulse something interesting on the bookmark bar.
|
| + [self startPulsingBookmarkButton:node_];
|
| +
|
| [window makeKeyAndOrderFront:self];
|
| }
|
|
|
|
|