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

Unified Diff: chrome/browser/cocoa/bookmark_bubble_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
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];
}
« no previous file with comments | « chrome/browser/cocoa/bookmark_bubble_controller.h ('k') | chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698